-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tongyi json output #5396
fix: tongyi json output #5396
Conversation
Thanks for your contribution, please open an issue first, then link it to this PR. It will helpful for us to manage our community. 😇 |
The If the model doesn't return the expected format, we shouldn't parse it. Alternatively, you can implement it within the Tongyi LLM. |
But no markdown requires in any system prompt, maybe we should change system prompt? |
Yeah, maybe we should rewrite the system prompt and test it on more models. Let's discuss this in the related issue. |
So, I changed the block_prompts in tongyi model and add test cases for json ouput. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for doing that. We'll evaluate the default system prompt later.
* refs/heads/deploy/dev: (273 commits) chore: host required fix: monitor copywrite feat: make show citations enable default chore: use singular style in middleware config class name (#5502) refactor: extract hosted service configs into dify config (#5504) fix: summary of duckduckgo_search (#5488) fix: zhipu tool calling, this PR fixes the bug described in issue #5496 (#5469) fix: tongyi json output (#5396) fix: firecrawl apikey not start with fc- (#5498) fix lock refactor: extract db configs and celery configs into dify config (#5491) refactor: extract storage provider configs into dify configs (#5443) chore: use singular style in config class name (#5489) chore: remove pip support for api service (#5453) Add Oracle23ai as a vector datasource (#5342) build: support Poetry for depencencies tool in api's Dockerfile (#5105) feat: add ops trace encrypt_config decrypt_config obfuscate_config feat: add remove tracing app fix: max_tokens of qwen-plus & qwen-plus-chat (#5480) feat: add support for Vertex AI claude-3-5-sonnet@20240620 (#5475) ...
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #5397
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
api change
Accroding to tongyi api docs. There's no different between chat models and completaion models.
original code: in
api/core/model_runtime/model_providers/tongyi/llm/llm.py
line 245, 249 will cause prompt missing when using json response formatjson parse change
as comment in file
api/core/model_runtime/model_providers/__base/large_language_model.py
, some LLM with directly output json data without markdown blocktest result with same prompt
before change
after change
Suggested Checklist:
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint godsoptional
I have made corresponding changes to the documentationoptional
I have added tests that prove my fix is effective or that my feature worksoptional
New and existing unit tests pass locally with my changes