Skip to content
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: zhipu tool calling, this PR fixes the bug described in issue #5496 #5469

Merged
merged 2 commits into from
Jun 22, 2024

Conversation

vccler
Copy link
Contributor

@vccler vccler commented Jun 21, 2024

Description

Agent App with Zhipu GLM-4 Model and workflow tool always fails to get the response when asking the second question after the first tool calling is done.

reproduce steps:

  1. select chat model to ZhiPu GLM-4 model
  2. Create a agent app with a tool published by a workflow
  3. Ask a question to the agent and it MUST invoke a tool for the question and the answer is feedbacked by the agent.
  4. In the save conversation, then you ask the second question, the UI will pop an error message like 'Got unknown type role=<PromptMessageRole.TOOL: 'tool'> content='{"company_info": "[]", "register_info": "{"company_info": "[]"}"}' name='getCompanyInfo' tool_call_id='47e36eb3-a484-4eb9-955c-3122655d9143'

Fixes #5496

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

Please follow with the reproduce steps

Got unknown type role=<PromptMessageRole.TOOL: 'tool'> content='{"company_info": "[]", "register_info": "{\"company_info\": \"[]\"}"}' name='getCompanyInfo' tool_call_id='47e36eb3-a484-4eb9-955c-3122655d9143

reproduce environment:
1. select chat model to ZhiPu GLM-4 model
2. Create a agent app with a tool published by a workflow
3. Ask a question to the agent and it MUST invoke a tool for the question and the answer is feedbacked by the agent.
4. In the save conversation, then you ask the second question, the UI will pop an error message like 'Got unknown type role=<PromptMessageRole.TOOL: 'tool'> content='{"company_info": "[]", "register_info": "{\"company_info\": \"[]\"}"}' name='getCompanyInfo' tool_call_id='47e36eb3-a484-4eb9-955c-3122655d9143'
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🔨 feat:tools Tools for agent, function call related stuff. 🤖 feat:agent Agent related topics labels Jun 21, 2024
@vccler vccler changed the base branch from deploy/dev to main June 21, 2024 05:58
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 21, 2024
@crazywoola crazywoola requested a review from laipz8200 June 21, 2024 07:48
@laipz8200
Copy link
Member

Thanks for your contribution, please open an issue first, then link it to this PR. It will be helpful for us to manage our community. 😇

@vccler vccler changed the title Fixes zhipu tool calling Fixes zhipu tool calling: This PR fixes the bug described in issue #5496 Jun 22, 2024
@vccler
Copy link
Contributor Author

vccler commented Jun 22, 2024

Thanks for your contribution, please open an issue first, then link it to this PR. It will be helpful for us to manage our community. 😇

I have updated the PR's title and description to link to an new issue #5496

@vccler vccler changed the title Fixes zhipu tool calling: This PR fixes the bug described in issue #5496 fix: zhipu tool calling, this PR fixes the bug described in issue #5496 Jun 22, 2024
laipz8200
laipz8200 previously approved these changes Jun 22, 2024
Copy link
Member

@laipz8200 laipz8200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 22, 2024
@laipz8200 laipz8200 merged commit 48757e5 into langgenius:main Jun 22, 2024
5 checks passed
XiaoLey pushed a commit to XiaoLey/dify that referenced this pull request Jun 22, 2024
…ggenius#5496 (langgenius#5469)

Co-authored-by: vccler <vccler@163.com>
Co-authored-by: -LAN- <laipz8200@outlook.com>
ZhouhaoJiang added a commit that referenced this pull request Jun 24, 2024
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 feat:agent Agent related topics 🔨 feat:tools Tools for agent, function call related stuff. lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when ask the second question after the first function call with ZhiPu Model
3 participants