Zhuoxi2000 opened a new issue, #1167: URL: https://github.com/apache/flink-agents/issues/1167
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description The Python `TongyiChatModelConnection` sends tool results to DashScope without a `tool_call_id`, so a result cannot be matched to the call that produced it. Two pieces don't line up with how the tool call action passes the provider's call id around: 1. When parsing a response, the connection stores DashScope's call id only under `additional_kwargs.original_tool_call_id`. The tool call action reads `tool_call["original_id"]` (as the OpenAI, Anthropic and watsonx connections set it) to fill the tool result's `external_id`, so for Tongyi that id is always `None`. 2. When converting a TOOL message, the connection looks for the id in `message.tool_calls[0]`, but the chat model action builds tool results with an empty `tool_calls` and the id in `extra_args["external_id"]`. Expected: the tool message carries `tool_call_id` equal to DashScope's call id, as for the other providers. Actual: the tool message is sent as `{"role": "tool", "content": ...}` with no `tool_call_id`. With several parallel calls the model cannot tell the results apart. ### How to reproduce 1. Build a Python agent with a `TongyiChatModelSetup` and one tool. 2. Send an input that makes the model call the tool. 3. Inspect the `messages` passed to `Generation.call` on the next turn: the tool message has no `tool_call_id`. ### Version and environment main (eb35a38), Python `TongyiChatModelConnection`, dashscope 1.24. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
