OpenAI tools兼容bug
我部署了 qwen2 服务,使用 qwen-agent 跑通了 tools。但是使用 OpenAI 的接口进行 tools 调用是失败的,具体查看Function calling - OpenAI API。
这样,我在 fastgpt 里面就无法使用 qwen2 进行工具调用。
vllm也同样无法正常调用tools
应该是Qwen2不支持tools
形式的函数调用,只支持functions
。官方文档:https://qwen.readthedocs.io/en/latest/framework/function_call.html
我测试了vllm,lmdeploy都不支持functions
这种格式。不知道千问官方会不会更新模型,支持tools
格式的调用。
支持openai function吗
Qwen2 models support tool use/tool calling/function calling however you name it.
the frameworks, as in transformers, vllm, or ollama are not necessarily aware how to make use of the tool use support. that's where Qwen-Agent comes into place. it provides the templating suitable for Qwen2 models.
there is progress at the framework side to support tool use, but it should be noted that they are not the same:
- for transformers, the tokenizer supports chat template with tools now. see https://github.com/QwenLM/Qwen2/issues/805#issuecomment-2258310024
- for ollama, see https://github.com/ollama/ollama/issues/6007#issuecomment-2262154658
- for vllm, vllm does not support tool use per se (it supports the parameters but you need to do the templating yourselves). the PR is waiting to be merged. once its merged, it is the similar to how transformers handle that.