Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否将openai_api_server.py升级到gpt4的tools调用相兼容的api #64

Closed
1 of 2 tasks
anming81 opened this issue Jun 6, 2024 · 4 comments
Closed
1 of 2 tasks
Assignees

Comments

@anming81
Copy link

anming81 commented Jun 6, 2024

System Info / 系統信息

接口兼容性问题,与硬件无关

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

  1. 运行basic_demo/openai_api_server.py脚本
  2. 调用/v1/chat/completions接口,传入工具调用的api
    { "messages": [ { "content": "What's the weather like in San Francisco", "role": "user" } ], "model": "glm4", "stream": false, "temperature": 0.8, "tools": [ { "type": "function", "function": { "description": "根据传入的城市获取天气信息", "name": "getCurrentWeather", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "城市名称,如:武汉" } }, "required": [ "location" ] } } } ], "tool_choice": "auto" }
  3. 返回的是gpt3版本的function_call
    { "model": "glm4", "id": "", "object": "chat.completion", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "getCurrentWeather\n{\"location\": \"San Francisco\"}", "name": null, "function_call": { "name": "getCurrentWeather", "arguments": "{\"location\": \"San Francisco\"}" } }, "finish_reason": "function_call" } ], "created": 1717641432, "usage": { "prompt_tokens": 157, "total_tokens": 168, "completion_tokens": 11 } }

Expected behavior / 期待表现

期望能够返回与GPT4最新的tool_calls调用相兼容的api
{ "model": "glm4", "id": "", "object": "chat.completion", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "getCurrentWeather\n ```python\ntool_call(location='San Francisco')\n```", "tool_calls": [ { "id": "call0", "type": "function", "function": { "name": "getCurrentWeather", "arguments": "{\"location\": \"San Francisco\"}" } } ] }, "finish_reason": "tool_calls" } ], "created": 1717635659, "usage": { "prompt_tokens": 162, "total_tokens": 183, "completion_tokens": 21 } }

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR self-assigned this Jun 6, 2024
@zRzRzRzRzRzRzR
Copy link
Member

看到这个请求了,我们会在之后的排期中做

@chenhaoqiang
Copy link

看到这个请求了,我们会在之后的排期中做

vllm应该还不支持FunctionCall和ToolCall,有相关的PR:https://github.com/vllm-project/vllm/pull/4656,这个特性跟踪了好久了,有半年了,还没开发好。期待完全兼容OpenAI接口!

@nerd4me
Copy link

nerd4me commented Jun 7, 2024

遇到了同样的问题,在使用 langchain 的结构化输出功能的时候(with_structured_output),由于返回格式不一样,解析不了

zRzRzRzRzRzRzR added a commit that referenced this issue Jun 7, 2024
@zRzRzRzRzRzRzR
Copy link
Member

已经修了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants