async-openai icon indicating copy to clipboard operation
async-openai copied to clipboard

Fixed duplicated arguments in tool-call-stream example

Open mmende opened this issue 9 months ago • 1 comments

When playing around with the tool-call-stream example in combination with mistral's API I encountered a strange bug where the arguments where duplicated (e.g. instead of { "city": "Berlin" } I would always get { "city": "Berlin" }{ "city": "Berlin" }).

This issue is caused by mistral's API streaming the arguments together with the tool call id and function name which in the example results in the ChatCompletionMessageToolCall being inserted including arguments and then the arguments would be concatenated to itself again.

The adjusted example in this PR fixes this issue.

mmende avatar Feb 04 '25 07:02 mmende

Yeah noticed that same with groq mistral model as well

b0xtch avatar Feb 18 '25 06:02 b0xtch