QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen2, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
2.51k stars 249 forks source link

BUG: stream tool call failed #229

Open codingl2k1 opened 4 days ago

codingl2k1 commented 4 days ago

I have tested the Qwen-Agent tool call with qwen2 7b and qwen 1.5 7b by https://github.com/QwenLM/Qwen-Agent/blob/main/examples/function_calling.py

The stream=True returns a plain string: image

The stream=False returns a correct tool call result: image

JianxinMa commented 4 days ago

I couldn't reproduce this issue with stream=True and oai qwen2-7b (the final output of llm.chat is a function call message, as expected). Is any code of qwen-agent modified? I'm using pip install -U "qwen-agent>=0.0.6"

JianxinMa commented 4 days ago

BTW, last_msg, as shown in your screenshot, is indeed plain text, not a function-call like structured message. This is expected. Users should not use last_msg directly here. Instead, users should use the final output of llm.chat (which is post-processed and is structured as a function call message).

codingl2k1 commented 4 days ago

I am using the latest master. Qwen 2 7b and Qwen 1.5 7b are from the latest huggingface. The stream result can't be parsed as a tool call result, so I inspect the original output from the LLM as shown in the screenshot.