Skip to content

[Request] 派欧算力(PPIO)部分模型已经支持函数调用,希望能够支持 #7464

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

Open
azicen opened this issue Apr 18, 2025 · 1 comment
Labels
🌠 Feature Request New feature or request | 特性与建议

Comments

@azicen
Copy link

azicen commented Apr 18, 2025

🥰 需求描述

派欧算力(PPIO)部分模型已经支持函数调用(例如dsv3,dsr1),希望能够支持

🧐 解决方案

与openai api调用一致,增加 search:fc

📝 补充信息

派欧算力接口接入 one-api 后,自定义 deploymentName 添加 search:fc 调用函数时遇到以下问题

  • 以下接口 https://lobechat.example.com/webapi/chat/openai 响应被 unicode 编码。
  • 函数调用结果中 arguments 参数首和尾各出现一个 {}
  • 接口 https://lobechat.example.com/webapi/plugin/gateway 因上述原因无法执行。

lobehub 接口响应:

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: usage
data: {"inputTextTokens":2976,"totalInputTokens":2976,"totalTokens":2976}

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: tool_calls
data: [{"function":{"arguments":"{}","name":"realtime-weather____fetchCurrentWeather"},"id":"chatcmpl-tool-fce2f59ae3b0487790ec70f4ef30aff2","index":0,"type":"function"}]

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: tool_calls
data: [{"function":{"arguments":"{\"city\": \"","name":null},"id":"chatcmpl-tool-fce2f59ae3b0487790ec70f4ef30aff2","index":0,"type":"function"}]

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: tool_calls
data: [{"function":{"arguments":"\\u5357\\u5b81","name":null},"id":"chatcmpl-tool-fce2f59ae3b0487790ec70f4ef30aff2","index":0,"type":"function"}]

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: tool_calls
data: [{"function":{"arguments":"{}","name":null},"id":"chatcmpl-tool-fce2f59ae3b0487790ec70f4ef30aff2","index":0,"type":"function"}]

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: tool_calls
data: [{"function":{"arguments":"\"}","name":null},"id":"chatcmpl-tool-fce2f59ae3b0487790ec70f4ef30aff2","index":0,"type":"function"}]

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: usage
data: {"inputTextTokens":2976,"outputTextTokens":26,"totalInputTokens":2976,"totalOutputTokens":26,"totalTokens":3002}

id: chatcmpl-39eda49426ee4abf9689548bba68c602
event: usage
data: {"inputTextTokens":2976,"outputTextTokens":26,"totalInputTokens":2976,"totalOutputTokens":26,"totalTokens":3002}

派欧算力接口与 one-api 接口通过 curl 调用,结果均正常:

派欧算力:

curl https://api.ppinfra.com/v3/openai/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_" \
-d '{
    "model": "deepseek/deepseek-v3/community",
    "stream": true,
    "messages": [
        {
            "role": "user",
            "content": "今天北京天气怎么样"
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "description": "获取当前天气情况",
                "name": "realtime-weather____fetchCurrentWeather",
                "parameters": {
                    "type": "object",
                    "required": [
                        "city"
                    ],
                    "properties": {
                        "city": {
                            "type": "string",
                            "description": "城市名称"
                        }
                    }
                }
            }
        }
    ]
}'

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"call_b9a35lamrb3jmarhghmctojq","type":"function","function":{"name":"realtime-weather____fetchCurrentWeather"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":16,"total_tokens":147,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"{\""}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":17,"total_tokens":148,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"city"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":18,"total_tokens":149,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"\":\""}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":19,"total_tokens":150,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"北京"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":20,"total_tokens":151,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"\"}"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":21,"total_tokens":152,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449671908966aaf167cb2a7c7c011043d495fd2987a1541e5","object":"chat.completion.chunk","created":1744967191,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":"tool_calls","content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":131,"completion_tokens":24,"total_tokens":155,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: [DONE]

one-api 接入的派欧算力:

curl https://oneapi.example.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-" \
-d '{
    "model": "deepseek-chat",
    "stream": true,
    "messages": [
        {
            "role": "user",
            "content": "今天北京天气怎么样"
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "description": "获取当前天气情况",
                "name": "realtime-weather____fetchCurrentWeather",
                "parameters": {
                    "type": "object",
                    "required": [
                        "city"
                    ],
                    "properties": {
                        "city": {
                            "type": "string",
                            "description": "城市名称"
                        }
                    }
                }
            }
        }
    ]
}'

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"call_0dupiyabjbrp9ngvcj2qvk6l","type":"function","function":{"name":"realtime-weather____fetchCurrentWeather"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":16,"total_tokens":148,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"{\""}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":17,"total_tokens":149,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"city"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":18,"total_tokens":150,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"\":\""}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":19,"total_tokens":151,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"北京"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":20,"total_tokens":152,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"","type":"","function":{"arguments":"\"}"}}]},"finish_reason":null,"content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":21,"total_tokens":153,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: {"id":"0217449672408666aaf167cb2a7c7c011043d495fd2987aecba6c","object":"chat.completion.chunk","created":1744967241,"model":"deepseek/deepseek-v3/community","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":"tool_calls","content_filter_results":{"hate":{"filtered":false},"self_harm":{"filtered":false},"sexual":{"filtered":false},"violence":{"filtered":false},"jailbreak":{"filtered":false,"detected":false},"profanity":{"filtered":false,"detected":false}}}],"system_fingerprint":"","usage":{"prompt_tokens":132,"completion_tokens":24,"total_tokens":156,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"completion_tokens_details":{"audio_tokens":0,"reasoning_tokens":0}}}

data: [DONE]

其他尝试:

  • 使用其他平台或接入 oneapi 的其他支持函数的模型,使用正常,可以正常调用函数
@lobehubbot
Copy link
Member

👀 @azicen

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@dosubot dosubot bot added the 🌠 Feature Request New feature or request | 特性与建议 label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议
Projects
None yet
Development

No branches or pull requests

2 participants