fix:fix ChatZhipuAI tool call bug #26693
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR title: "community:fix ChatZhipuAI tool call bug"
Description: ZhipuAI api response as follows:
{'id': '20240920132549e379a9152a6a4d7c', 'created': 1726809949, 'model': 'glm-4-flash', 'choices': [{'index': 0, 'finish_reason': 'tool_calls', 'delta': {'role': 'assistant', 'tool_calls': [{'id': 'call_20240920132549e379a9152a6a4d7c', 'index': 0, 'type': 'function', 'function': {'name': 'get_datetime_offline', 'arguments': '{}'}}]}}]}
so, tool_calls = dct.get("tool_call", None) in _convert_delta_to_message_chunk should be "tool_calls"