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

线上api如何稳定的触发 tool_calls #84

Open
wssnail opened this issue Aug 26, 2024 · 4 comments
Open

线上api如何稳定的触发 tool_calls #84

wssnail opened this issue Aug 26, 2024 · 4 comments

Comments

@wssnail
Copy link

wssnail commented Aug 26, 2024

写了一个tool_calls,用来创建SQL的,但是在提问题的时候需要写到上特殊的标记,比如:
promt: 创建会员表 call executeSql 或者 创建会员表 tool_calls
用上述的提示词,第一次还能稳定生成
但是当message携带的内容多了之后,上述提示词就不起作用了,如下

[
  	{...},
    {
        "role": "user",
        "content": "创建会员表 tool_calls"
    },
    {
        "role": "assistant",
        "content": "```json\n{\n  \"name\": \"executeSql\",\n  \"parameters\": {\n    \"sql\": \"CREATE TABLE IF NOT EXISTS members (id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL, email VARCHAR(100) UNIQUE NOT NULL, join_date DATE NOT NULL, membership_status VARCHAR(50) NOT NULL);\"\n  }\n}\n```"
    },
    {
        "role": "user",
        "content": "创建老师表 tool_calls"
    }
]

上述在“创建会员表 tool_calls”这里的时候,还可以稳定的输出

{"tool_calls":[ {"id": "call_0_0956d049-6667-411f-a5e0-2e421e488205", "type": "function", "function": {"name": "executeSql", "arguments": "{\"sql\": \"CREATE TABLE IF NOT EXISTS members (id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL, join_date DATE NOT NULL, membership_status VARCHAR(50) NOT NULL)\"}"}}]},

但是在“创建老师表 tool_calls”的时候就无法输出tool_calls了,这个功能在GPT-4o上很稳定,这个能修复吗?或者添加一个指令,确保能稳定输出tool_calls,不然稳定性太差,线上的api都无法满足企业化需求

@mujiannan
Copy link

遇到了同样问题,DeepSeek调用工具的欲望非常低,即便在提示词中明确要求尽可能调用工具获取详细信息后再回答,它依然懒洋洋的。

@luochen1990
Copy link

遇到了同样问题,DeepSeek调用工具的欲望非常低,即便在提示词中明确要求尽可能调用工具获取详细信息后再回答,它依然懒洋洋的。

2.5 之前没这个问题的,升到2.5 之后就这样了,而且有时候强制指定 tool_choice 到特定 function name 都不管用

@ITMeow
Copy link

ITMeow commented Oct 22, 2024

可能是和他低价缓存的机制有关,会优先返回之前提问的内容,坐等修复,期待期待

@luochen1990
Copy link

可能是和他低价缓存的机制有关,会优先返回之前提问的内容,坐等修复,期待期待

你说的是这个 么? 这个缓存的是 input, 不会缓存 output,所以理论上应该与这个无关

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