一个阿里云通义千问工单

这篇博客记录我在阿里云提交的一次工单,产品是通义千问,问题点是 OpenAI 兼容接口的函数调用(function call)。界面上所选产品分类是“大模型服务平台百炼”。因为早有耳闻网友吐槽阿里云客服,我提工单后,一开始回复就令我摸不着头脑、疑似 AI 生成、毫无帮助,即刻印证我的刻板印象,而最后以创建钉钉群结束,自认为有一定参考价值,值得记录。因为问题最终得到解决,我在过程中间耐心也不多,加之我的业务不重要(不是公司业务),所以特别声明我不持批评态度,而更多以现象学的宗旨提供客观文本,悬置其中的立场和争议。各位可以自行作出判断。

首先我将工单对话按原样贴上,之后给出附件内容,最后以结语总结钉钉群内容。

工单内容

我:(附件:aliyun请求响应体.txt)

qwen-max 模型,通过 openai 兼容格式调用,使用 tool 的 function call,能调用成功,但没有响应 function call 的 ID。见附件,响应的 choices[0].message.tool_calls[0].id 是空字符串。后续调用方这边后续进一步提交函数调用结果,传入相应 ID(空字符串),模型不能正确识别,导致回报通用内容(如“What would you like to know or discuss? I'm here to help with any questions you might have!”)。
此问题于昨日发现,今日仍然存在。之前是好的。

售后工程师:2024-06-05 08:02:44

已收到您提交的问题

售后工程师:

您好,关于您遇到的问题,看起来是Function Call的ID没有正确返回,这可能导致后续工具调用的整合出现错误。通常,tool_calls字段应该包含调用工具的相关信息,包括ID,以便于后续处理。由于您提到之前功能正常,现在出现异常,可能是由于服务的临时性问题或者更新导致的。

建议您检查以下几点:

确认调用的API版本是否最新,是否有更新导致的不兼容性。
检查请求的参数是否完整,特别是与tool_calls相关的部分。
如果可能,尝试使用不同的工具ID或者更新工具描述看看是否有所改善。
如果问题持续存在,您可以尝试联系阿里云的技术支持,提供具体的调用日志和错误信息,以便他们能更深入地调查。在问题解决之前,可能需要通过不依赖ID的临时解决方案来整合工具输出和模型回答。

我:

这是 AI 回复吗?我不是在联系技术支持是在联系什么?API 不返回 function call 的 ID 我这边也不能编造一个呀。

售后工程师:

您好,您的问题我们正在查询确认,需要一些时间,请您稍等。

售后工程师:

您好,麻烦您提供一下您的代码

我:

关键的请求、响应体已经在附件里。URL 就是官方文档上写的 openai 兼容地址,加上凭据就能复现我的情况了。

售后工程师:

您好,您的问题我已反馈给后端,有进展我会第一时间同步给您,请您耐心等待,感谢

售后工程师:

您好,麻烦您提供一下requestId

我:

是指响应体返回的 id 吗?响应体也附在附件了,看最后。我手机不方便复制。

售后工程师:

好的

售后工程师:

您好,您的问题我已反馈给后端,有进展我会第一时间同步给您,请您耐心等待,感谢

售后工程师:

您好,这个id一直是个空值,这个也可从官方文档中看到的。

阿里云工单图1

我:(附件:aliyun两轮对话.md)

好的,那可能是我误会了。那么现在我的问题就变成,不知为何在第二轮中我的 function call response 没有被识别,模型返回了无知的通用回复。记得6月3日还是好的;现在用同一套代码可以请求 openai 获得正常返回(模型正确回答我的问题),应该能排除格式问题。在此我将两轮请求、响应的 body 都附上。

售后工程师:

请您稍等,您的问题我正在帮您核实

售后工程师:

抱歉,您这个响应我看不出来问题

我:

问题就是没有根据我的 function call response 回复问题。并且 usage 中 prompt_tokens 也显著低于正常时候。在我的报文中,prompt_tokens 是 8,显然是没有将我的 function call response 当作输入。所以要不就是我错了,要不就是你们逻辑错了。

售后工程师:

请您稍等,您的问题我正在帮您核实

我:

在正常情况下(比如3号的时候),模型应该回复“Firefox 127 正式版预计将在2024年6月11日发布”之类的话(正如 function call response 指示的)。现在回复 What would you like to know or discuss?,怕是不仅没有看到我的 function call response,结合 prompt_tokens=8,怕是连我最开始的问题都没看见。不然起码会说“根据我的搜索,无法直接找到关于 Firefox 127 版本的具体发布信息……”或者“我没有能力访问互联网”之类的话(像没有使用 function call 那样)。

售后工程师:

请您稍等,您的问题我正在帮您核实

售后工程师:

您好,tools暂时无法与stream=True同时使用。使用tools不要用流失增量输出

我:

但是我3号及之前还用的好好的。我理解tools不能与流式输出同时使用,是因为response不好返回tool_calls;但是调用方给function call response 的时候可以流式输出,因为这时 API 的 response 跟不用 tools 一样。你看我第一轮用 function call,非流式;第二轮请求把 tools 摘掉没传了,这时候是要支持流式的,支持流式跟文档不相悖。请你们再次确认。

售后工程师:

您好,您看一下
参考链接:https://help.aliyun.com/zh/dashscope/developer-reference/compatibility-of-openai-with-dashscope/?spm=a2c4g.11186623.0.i2

阿里云工单图2

我:

我知道,但我第二轮请求已经没有传入tools,这时候是需要支持流式输出的。另一个说明很可能你们模型内部出问题的佐证是,我刚全改成非流式请求,模型在第二轮仍然不能返回期望 content 回复。第二轮响应如下:
{"choices":[{"message":{"role":"assistant","content":"What would you like to know or discuss?"},"finish_reason":"stop","index":0,"logprobs":null}],"object":"chat.completion","usage":{"prompt_tokens":8,"completion_tokens":9,"total_tokens":17},"created":1717581073,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-1cddb35d-6a10-9f4d-83d9-2a1b31fba969"}

售后工程师:

那您这边试一下,简单的function试一下呢,看一下能否正常调用

我:

既然确认我的调用符合文档,不是应该你们编写用例缩小范围排查问题吗?你们不仔细看我的附件报文,我指出来了。你们说tools跟流式不能共用,我不仅从理论上说明我的请求不属于这种情况,还实际构造了用例。现在还要我接着当debug工程师么……

售后工程师:

您好,您这边不提供您的代码确实不方便排查问题哈,还是麻烦您提供一下您的代码

我:(附件:aliyun.js)

MVP 代码见附件

售后工程师:2024-06-05 20:39:31

您好,您的问题正在帮您确认中,可能还需要一些时间,还请您先耐心等待一下,一有结果我们会第一时间工单回复您的,对您造成的不便请见谅

售后工程师:2024-06-06 09:53:03

您好,我这边看一您的代码,应该是参数类型给错了,content是字符串入参,不能是一个数组。

阿里云工单图3

我:

在你标红框往上面看,if 上面,把 object 序列化为 json 字符串了

售后工程师:

您好,建议您用纯文本格式试一下。

我:

哈?但是很明显实际数据就会很复杂啊。还是同样的,如果确认我的调用符合文档(这里也确实是字符串),应该你们编写用例缩小范围排查问题。不是要我试这试那的。我试完了,纯文本没有问题,那你们要不要改?纯文本有问题,那你们要不要改?

售后工程师:

您好,请稍等,我这边本地测试一下。

售后工程师:

您好,我这边直接使用纯文本形式是可以的。

阿里云工单图4

我:

但你们要解决的问题是我的例子,这只能说你缩小了问题范围,请解决了问题再给出反馈;如果不需要解决就说明理由——你这只反馈一半进度啊,不需要我教做事吧。在这个例子中,如果你们确实兼容openai接口,那么就要支持json序列化后的字符串。因为这是 tools[].function.parameters.type = "object" 的含义,是由openai接口定义和JSON Schema共同决定的。我又不是要 type = "string",这样才是你说的纯文本。但结论是,不管根据规范还是业务实践,函数都需要返回 object,也就是说 function call response 的 content 要支持json序列化后的字符串。

售后工程师:2024-06-06 13:44:15(群号已脱敏)

您好,这个问题拉了一个钉钉群为您更快的解决问题,请您加一下钉钉群:“【客-临时】000ETC61UP 模型兼容openai使用functioncall调用问题”群的钉钉群号: 9344xxxxxxx

附件内容

aliyun请求响应体.txt

请求JSON:
{"messages":[{"role":"user","content":"你现在有能力联 网搜索、访问网页。请用英语关键词搜索,用中文回答我的问题,并给出参考来源:\nFirefox 127正式版预计什么时候发布"}],"stream":false,"model":"qwen-max","temperature":1,"presence_penalty":0,"frequency_penalty":0,"top_p":0.99,"max_tokens":2000,"tools":[{"type":"function","function":{"name":"searchWeb","description":"Perform a web search using specific keywords. (like Google search)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the web search."}},"required":["query"]}}},{"type":"function","function":{"name":"searchNews","description":"Search for news articles using specific keywords. (like Google News)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the news search."}},"required":["query"]}}},{"type":"function","function":{"name":"readWebPage","description":"Fetch and parse the content of the given URL's webpage. (like Reader View of Firefox)","parameters":{"type":"object","properties":{"url":{"type":"string","description":"The URL of the webpage."}},"required":["url"]}}},{"type":"function","function":{"name":"searchAndReadFirstResult","description":"Perform a web search and read the content of the first search result. (like I'm Feeling Lucky of Google)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the web search."}},"required":["query"]}}}]}

响应JSON:
{"choices":[{"message":{"role":"assistant","tool_calls":[{"function":{"name":"searchWeb","arguments":"{\"query\": \"Firefox 127 release date\"}"},"id":"","type":"function"}],"content":""},"finish_reason":"tool_calls","index":0,"logprobs":null}],"object":"chat.completion","usage":{"prompt_tokens":479,"completion_tokens":23,"total_tokens":502},"created":1717545113,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-c6e58eae-f4d6-968a-b88b-2e324d1c6c38"}

aliyun两轮对话.md

# 第一次请求

{"messages":[{"role":"user","content":"你现在有能力联网搜索、访问网页。请用英语关键词搜索,用中文回答我的问题,并给出参考来源:\nFirefox 127 正式版预计什么时候发布?"}],"stream":false,"model":"qwen-max","temperature":1,"presence_penalty":0,"frequency_penalty":0,"top_p":0.99,"max_tokens":2000,"tools":[{"type":"function","function":{"name":"searchWeb","description":"Perform a web search using specific keywords. (like Google search)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the web search."}},"required":["query"]}}},{"type":"function","function":{"name":"searchNews","description":"Search for news articles using specific keywords. (like Google News)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the news search."}},"required":["query"]}}},{"type":"function","function":{"name":"readWebPage","description":"Fetch and parse the content of the given URL's webpage. (like Reader View of Firefox)","parameters":{"type":"object","properties":{"url":{"type":"string","description":"The URL of the webpage."}},"required":["url"]}}},{"type":"function","function":{"name":"searchAndReadFirstResult","description":"Perform a web search and read the content of the first search result. (like I'm Feeling Lucky of Google)","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Keywords for the web search."}},"required":["query"]}}}]}

# 第一次响应

{"choices":[{"message":{"role":"assistant","tool_calls":[{"function":{"name":"searchWeb","arguments":"{\"query\": \"Firefox 127 release date\"}"},"id":"","type":"function"}],"content":""},"finish_reason":"tool_calls","index":0,"logprobs":null}],"object":"chat.completion","usage":{"prompt_tokens":482,"completion_tokens":23,"total_tokens":505},"created":1717570659,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-a2449d01-bc30-9613-bfa2-aec1f8ee7c01"}

# 第二次请求

{"messages":[{"role":"user","content":"你现在有能力联网搜索、访问网页。请用英语关键词搜索,用中文回答我的问题,并给出参考来源:\nFirefox 127 正式版预计什么时候发布?"},{"role":"assistant","tool_calls":[{"function":{"name":"searchWeb","arguments":"{\"query\": \"Firefox 127 release date\"}"},"id":"","type":"function"}],"content":""},{"tool_call_id":"","role":"tool","name":"searchWeb","content":"{\"allSearchResults\":[{\"title\":\"Firefox 127 for developers - Mozilla | MDN\",\"url\":\"https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/127\",\"snippet\":\"5 days ago ... Firefox 127 is the current Beta version of Firefox and ships on June 11, 2024. Changes for web developers. Developer Tools. HTML. data: ...\"},{\"title\":\"Release Management/Release owners - MozillaWiki\",\"url\":\"https://wiki.mozilla.org/Release_Management/Release_owners\",\"snippet\":\"May 27, 2024 ... Firefox 127, Pascal (CET), RyanVM (EST), Haik Aftandilian (PST), bhearsum (EST), gbrown (MST), RelMan (ESR 115.12), 2024-06-11. Firefox 126 ...\"},{\"title\":\"Milestones and key data for Firefox 127\",\"url\":\"https://whattrainisitnow.com/release/?version=127\",\"snippet\":\"Release day! We ship Firefox 127 at 14:00 UTC (6AM PST) at 25% rollout. June 11. In 2 weeks. Planned dot ...\"},{\"title\":\"Firefox Beta and Developer Edition Release Notes\",\"url\":\"https://www.mozilla.org/en-US/firefox/127.0beta/releasenotes/\",\"snippet\":\"May 14, 2024 ... New · You can now set Firefox to automatically launch whenever you start or restart your Windows computer. · In Firefox 127, we completed work to ...\"},{\"title\":\"Firefox version history - Wikipedia\",\"url\":\"https://en.wikipedia.org/wiki/Firefox_version_history\",\"snippet\":\"Firefox was created by Dave Hyatt and Blake Ross as an experimental branch of the Mozilla browser, first released as Firefox 1.0 on November 9, 2004.\"},{\"title\":\"Update Firefox to the latest release | Firefox Help\",\"url\":\"https://support.mozilla.org/en-US/kb/update-firefox-latest-release\",\"snippet\":\"Customize this article. Firefox. Version 128, Version 127 ... Update Firefox to the latest release. Firefox ... Firefox, download the Firefox installer, then close ...\"},{\"title\":\"Upgraded add-on signatures required for Firefox 127 : r/firefox\",\"url\":\"https://www.reddit.com/r/firefox/comments/1c4y8ey/upgraded_addon_signatures_required_for_firefox_127/\",\"snippet\":\"Apr 15, 2024 ... ... Firefox 127 : r/firefox.  . TOPICS ... date they were uploaded and whether they are ... Release (Jun 11). Add-ons installed prior to ...\"},{\"title\":\"Firefox users on Windows 7, 8 and 8.1 moving to Extended Support ...\",\"url\":\"https://support.mozilla.org/en-US/kb/firefox-users-windows-7-8-and-81-moving-extended-support\",\"snippet\":\"Firefox version 115 ESR will be the last supported release for Windows 7, 8 and 8.1.\"},{\"title\":\"Unable to connect to host 127.0.0.1 on port 7055.Selenium 3 ...\",\"url\":\"https://stackoverflow.com/questions/41116679/unable-to-connect-to-host-127-0-0-1-on-port-7055-selenium-3-firefox-38-6-0\",\"snippet\":\"Dec 13, 2016 ... 0. See releases here. If you look at the Firefox release date and the Selenium release date, you'll see you need something that was released ...\"},{\"title\":\"[Stable Update] 2023-08-11 - Kernels, Plasma, Nvidia, Firefox ...\",\"url\":\"https://forum.manjaro.org/t/stable-update-2023-08-11-kernels-plasma-nvidia-firefox-thunderbird-pamac-pipewire-mesa/146081/127\",\"snippet\":\"Aug 11, 2023 ... Hi,. In my case the up date don't solve the issue, with htop no 100% cpu use with mariadb or obs, but ksysguard show a 100% cpu use with obs ...\"}]}"}],"stream":true,"model":"qwen-max","temperature":1,"presence_penalty":0,"frequency_penalty":0,"top_p":0.99,"max_tokens":2000,"stream_options":{"include_usage":true}}

# 第二次响应

data: {"choices":[{"delta":{"content":"","role":"assistant"},"index":0,"logprobs":null,"finish_reason":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"finish_reason":null,"delta":{"content":"What"},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"delta":{"content":" would"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"delta":{"content":" you"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"delta":{"content":" like to know or discuss"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"delta":{"content":"?"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[{"finish_reason":"stop","delta":{"content":""},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: {"choices":[],"object":"chat.completion.chunk","usage":{"prompt_tokens":8,"completion_tokens":9,"total_tokens":17},"created":1717570662,"system_fingerprint":null,"model":"qwen-max","id":"chatcmpl-b963bdd4-d08b-9458-ad0a-d71d38117a3c"}

data: [DONE]

# 问题

模型回答 `What would you like to know or discuss?`,似乎没有识别 "role":"tool" content 给的 function call 回复。记得6月3日还是好的。6月4日发现回复 `What would you like to know or discuss?` 之类的通用回答,回报 usage 也显著减少。

aliyun.js

const baseUrl = 'https://dashscope.aliyuncs.com/compatible-mode'
const apiKey = '???????'

async function main() {
    const userMessage = "你现在有能力联网搜索、访问网页。请用英语关键词搜索,用中文回答我的问题,并给出参考来源:\n" +
        "Firefox 127正式版预计什么时候发布"

    const requestHeader = {
        "Content-Type": "application/json",
        "Cache-Control": "no-store",
        "Authorization": "Bearer " + apiKey,
    }
    const requestBody = {
        "messages": [
            createMessage("user", userMessage)
        ],
        "stream": false,
        "model": "qwen-max",
        "temperature": 1,
        "presence_penalty": 0,
        "frequency_penalty": 0,
        "top_p": 0.99,
        "max_tokens": 2000,
        "tools": tools
    }
    const messages = requestBody.messages
    console.log('[openai]发送第一轮请求……requestBody', JSON.stringify(requestBody));
    const response = await fetch(`${baseUrl}/v1/chat/completions`, {
        method: 'POST',
        headers: requestHeader,
        body: JSON.stringify(requestBody)
    });

    let responseJson = await response.json();
    // console.log('[openai]确认解析后的 data 对象:', data);
    if (!responseJson) {
        throw Error('[openai]no response');
    }
    messages.push(responseJson.choices[0].message);
    // console.log('[openai]更新后的 messages 数组:', messages);
    // 检查是否有函数调用
    console.log('[openai]开始检查是否有函数调用');
    const availableFunctions = {
        "searchWeb": search,
    };
    let calledCustomFunction = false;
    if (responseJson.choices[0].message.tool_calls) {
        const toolCalls = responseJson.choices[0].message.tool_calls;
        const unprocessedMessages = JSON.parse(JSON.stringify(messages));
        for (const toolCall of toolCalls) {
            const functionName = toolCall.function.name;
            const functionToCall = availableFunctions[functionName];
            const functionArgs = JSON.parse(toolCall.function.arguments);
            let functionResponse;
            if (functionName === 'searchWeb') {
                functionResponse = await functionToCall(functionArgs.query);
            }
            functionResponse = JSON.stringify(functionResponse)
            if (functionResponse != null) {
                messages.push({
                    tool_call_id: toolCall.id,
                    role: "tool",
                    name: functionName,
                    content: functionResponse,
                });
                calledCustomFunction = true;
            }
        }
    }
    console.log('[openai]function call checked');

    if (!calledCustomFunction) {
        // 没有调用自定义函数,直接返回原始回复
        throw Error("这不是要测试的情况")
    } else {
        // 如果调用了自定义函数,再次向 API 发送请求
        console.log('[openai]function call needed, sending request again');
        const secondRequestBody = {
            ...requestBody,
            //这里即使改成流式、非流式,回答都不对
            // stream: true,
            // stream_options: {
            //     include_usage: true,
            // },
            //摘除tools
            tools: undefined,
            tool_choice: undefined,
            messages: messages,
        };
        try {
            console.log('[openai]sending second response...');
            console.log('[sending]secondRequestBody', JSON.stringify(secondRequestBody));
            let secondResponse = await fetch(`${baseUrl}/v1/chat/completions`, {
                method: 'POST',
                headers: requestHeader,
                body: JSON.stringify(secondRequestBody)
            });
            //强制流式

            // return {
            //     status: secondResponse.status,
            //     headers: { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache',...corsHeaders,
            //     },
            //     body: secondResponse.body
            // };
            console.log("第二轮 secondResponse", JSON.stringify(await secondResponse.json()));
        } catch (error) {
            throw Error('[openai]API second failed:' + error.message);
        }
    }


}
function createMessage(role, content) {
    return {role, content}
}
const tools = [
    {
        type: "function",
        function: {
            name: "searchWeb",
            description: "Perform a web search using specific keywords. (like Google search)",
            parameters: {
                type: "object",
                properties: {
                    query: { type: "string","description": "Keywords for the web search."}
                },
                required: ["query"]
            }
        }
    }
]

function search(query) {
    //mock
    return {
        "allSearchResults": [
        {
            "title": "Firefox 127 for developers - Mozilla | MDN",
            "url": "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/127",
            "snippet": "5 days ago ... Firefox 127 is the current Beta version of Firefox and ships on June 11, 2024. Changes for web developers. Developer Tools. HTML. data: ..."
        },
        {
            "title": "Release Management/Release owners - MozillaWiki",
            "url": "https://wiki.mozilla.org/Release_Management/Release_owners",
            "snippet": "May 27, 2024 ... Firefox 127, Pascal (CET), RyanVM (EST), Haik Aftandilian (PST), bhearsum (EST), gbrown (MST), RelMan (ESR 115.12), 2024-06-11. Firefox 126 ..."
        },
        {
            "title": "Milestones and key data for Firefox 127",
            "url": "https://whattrainisitnow.com/release/?version=127",
            "snippet": "Release day! We ship Firefox 127 at 14:00 UTC (6AM PST) at 25% rollout. June 11. In 2 weeks. Planned dot ..."
        },
        {
            "title": "Firefox Beta and Developer Edition Release Notes",
            "url": "https://www.mozilla.org/en-US/firefox/127.0beta/releasenotes/",
            "snippet": "May 14, 2024 ... New · You can now set Firefox to automatically launch whenever you start or restart your Windows computer. · In Firefox 127, we completed work to ..."
        },
        {
            "title": "Firefox version history - Wikipedia",
            "url": "https://en.wikipedia.org/wiki/Firefox_version_history",
            "snippet": "Firefox was created by Dave Hyatt and Blake Ross as an experimental branch of the Mozilla browser, first released as Firefox 1.0 on November 9, 2004."
        },
        {
            "title": "Update Firefox to the latest release | Firefox Help",
            "url": "https://support.mozilla.org/en-US/kb/update-firefox-latest-release",
            "snippet": "Customize this article. Firefox. Version 128, Version 127 ... Update Firefox to the latest release. Firefox ... Firefox, download the Firefox installer, then close ..."
        },
        {
            "title": "Upgraded add-on signatures required for Firefox 127 : r/firefox",
            "url": "https://www.reddit.com/r/firefox/comments/1c4y8ey/upgraded_addon_signatures_required_for_firefox_127/",
            "snippet": "Apr 15, 2024 ... ... Firefox 127 : r/firefox.  . TOPICS ... date they were uploaded and whether they are ... Release (Jun 11). Add-ons installed prior to ..."
        },
        {
            "title": "Firefox users on Windows 7, 8 and 8.1 moving to Extended Support ...",
            "url": "https://support.mozilla.org/en-US/kb/firefox-users-windows-7-8-and-81-moving-extended-support",
            "snippet": "Firefox version 115 ESR will be the last supported release for Windows 7, 8 and 8.1."
        },
        {
            "title": "Unable to connect to host 127.0.0.1 on port 7055.Selenium 3 ...",
            "url": "https://stackoverflow.com/questions/41116679/unable-to-connect-to-host-127-0-0-1-on-port-7055-selenium-3-firefox-38-6-0",
            "snippet": "Dec 13, 2016 ... 0. See releases here. If you look at the Firefox release date and the Selenium release date, you'll see you need something that was released ..."
        },
        {
            "title": "[Stable Update] 2023-08-11 - Kernels, Plasma, Nvidia, Firefox ...",
            "url": "https://forum.manjaro.org/t/stable-update-2023-08-11-kernels-plasma-nvidia-firefox-thunderbird-pamac-pipewire-mesa/146081/127",
            "snippet": "Aug 11, 2023 ... Hi,. In my case the up date don't solve the issue, with htop no 100% cpu use with mariadb or obs, but ksysguard show a 100% cpu use with obs ..."
        }
    ]
    }
}

main();

结语

在钉钉群中,售后工程师拉上相关人员一起排查问题。我首先小结了问题及当前进展:

# 我遇到的问题
qwen-max 模型,通过 openai 兼容接口调用,使用 tool 的 function call,能调用成功,但是模型给出的回答显然不正常,没有回答我的问题。6月4号发现,记得6月3号是好的。6月5号提工单。现在用同一套代码可以请求 openai(dot)com 获得正常返回(模型正确回答我的问题),应该能排除格式问题。两轮请求、响应的 body 见于 aliyun两轮对话.txt
# 我的推测
模型给出的回复是 What would you like to know or discuss? 一类貌似无知的通用回复。在正常情况下(比如3号的时候),模型应该回复“Firefox 127 正式版预计将在2024年6月11日发布”之类的话(正如 function call response 指示的)。并且 usage 中 prompt_tokens 也显著低于正常时候。在我的报文中,prompt_tokens 是 8,显然是没有将我的 function call response 当作输入。甚至于,很可能没有“看见”我的第一条文本输入,不然起码会说“根据我的搜索,无法直接找到关于 Firefox 127 版本的具体发布信息……”或者“我没有能力访问互联网”之类的话(像没有使用 function call 那样)。
# 解决进展
最开始我怀疑是因为 API 没返回 function call 的 ID,但被售后工程师用文档指出 ID 就是空字符串,排除。
接着工程师指出“tools暂时无法与stream=True同时使用。使用tools不要用流失增量输出”。我表示3号及之前还正常。表达理解tools不能与流式输出同时使用,是因为response不好返回tool_calls;但是调用方给function call response 的时候可以流式输出,因为这时 API 的 response 跟不用 tools 一样。我第一轮用 function call,非流式;第二轮请求把 tools 摘掉没传,这时候是要支持流式的,支持流式跟文档不相悖。并且构造了一个反例,两次都使用非流式请求,同样有回答不正常的问题。
最新进展是工程师使用简单的“纯文本形式”表示没有问题,怀疑是 function call response 的 content 是 JSON 序列化字符串导致。(过程中我提供的代码见 aliyun.js)
# 我为什么仍然认为这是问题
如果阿里云确实兼容openai接口,那么就要支持json序列化后的字符串。因为这是 tools[].function.parameters.type = "object" 的含义,是由openai接口定义和JSON Schema共同决定的。我又不是要 type = "string",这样才是所谓的纯文本。但结论是,不管根据规范还是业务实践,函数都有需要返回 object,也就是说 function call response 的 content 要支持json序列化后的字符串。

群内有人询问,是否尝试过第二轮请求带上 tools 参数。几轮对话后,我尝试如此操作,结果恢复正常。尽管我翻看代码提交记录,这一块地方问题发生前后没有改动,当时请求 openai 官方接口也无问题,我修改了我的逻辑,于是问题解决。尽管从我的角度,逻辑并不等价,只是考虑到阿里云的 openai 兼容或许是大致格式兼容,优先保证能用。(从截图上看,变更后的行为也符合文档,所以无可厚非。)此时是 7 月 6 号 19 时。

“结”外生枝

本来这篇博客就这么完结,甚至我可能不会整理发表。然而几天前(7 月 17 日),我发现接口又报错了:

{
    "error": {
        "code": "invalid_type",
        "param": "messages[0].content",
        "message": "Invalid type for 'messages[0].content': expected one of a string or array of objects, but got an object instead.",
        "type": "invalid_request_error"
    }
}

而回看我的请求,对应内容是什么呢:

        {
            "tool_call_id": "",
            "role": "tool",
            "name": "readWebPage",
            "content": "{\"title\":\"The Vision for Space Exploration\",\"url\":\"https://www.nasa.gov/wp-content/uploads/2023/01/55583main_vision_space_exploration2.pdf\",\"content\":\"# National Aeronautics and Space Administration \\n\\n# The Vision for Space Exploration February 2004 “This cause of exploration and discovery is not an option we choose; it is a desire written in the human heart.” \\n\\n## President George W. Bush February 4, 2003 \\n\\n# “We leave as we came, and God willing as we shall return, with peace and hope for all mankind.” \\n\\n## Eugene Cernan (Commander of last Apollo mission) December 17, 1972 \\n\\n# “. . . America will make those words come true.” \\n\\n## President George W. Bush January 14, 2004 Message from the NASA Administrator \\n\\nDear Reader, With last year’s budget, NASA released a new Strategic Plan outlining a new approach to space exploration using a “building block” strategy to explore scientifically valuable destinations across our solar system. At the same time that we released the Strategic Plan, our Nation and the NASA family also suffered the loss of the seven brave astronauts aboard the Space Shuttle Columbia . The report of the Columbia Accident Investigation Board emphasized the need for a clearer direction from which to drive NASA’s human exploration agenda. On January 14, 2004, the President articulated a new vision for space exploration. You hold in your hands a new, bolder framework for exploring our solar system that builds upon the policy that was announced by the President after months of careful deliberations within the Administration. This plan does not undertake exploration merely for the sake of adventure, however exciting that may be, but seeks answers to profound scientific and philosophical questions, responds to recent discoveries, will put in place revolutionary technologies and capabilities for the future, and will genuinely inspire our Nation, the world, and the next generation. Our aim is to explore in a sustainable, affordable, and flexible manner. We believe the principles and roadmap set down in this document will stand the test of time. Its details will be subject to revision and expansion as new discoveries are made, new technologies are applied, and new challenges are met and over-come. This plan is guided by the Administration’s new space exploration policy, “A Renewed Spirit of Discovery: The President’s Vision for U.S. Space Exploration,” a copy of which is provided on the follow-ing pages. NASA is releasing this plan simultaneously with NASA’s FY 2005 Budget Justification. This plan is fiscally responsible, consistent with the Administration’s goal of cutting the budget deficit in half within the next five years. I cannot overstate how much NASA will change in the coming years as this plan is implemented. I also can-not overstate how profound the rewards will be on this new course. With the support of Congress, the sci-ence community, the NASA civil and contractor workforce, and most importantly, the American public, we will embark on this very exciting future. When Christopher Columbus made his voyages across the Atlantic in the 15th and 16th centuries, his ships carried the inscription “Following the light of the sun, we left the Old World.” I look forward to joining you as we follow the light of the planets and the stars into the new worlds of the 21st century. Sean O'Keefe Administrator Top image: The Mars Exploration Rover Opportunity ’s view of Mars’ Meridiani Planum, taken with the panoramic camera. Lower image: \\n\\nOpportunity looks back at its empty lander as it begins to explore Meridiani Planum. A Renewed Spirit of Discovery: The President’s Vision for U.S. Space Exploration Background \\n\\nFrom the Apollo landings on the Moon, to robotic surveys of the Sun and the planets, to the compelling images captured by advanced space telescopes, U.S. achievements in space have revolutionized humanity’s view of the universe and have inspired Americans and people around the world. These achievements also have led to the development of technologies that have widespread applications to address problems on Earth. As the world enters the second century of powered flight, it is time to articulate a new vision that will define and guide U.S. space exploration activities for the next several decades. Today, humanity has the potential to seek answers to the most fundamental questions posed about the exis-tence of life beyond Earth. Telescopes have found planets around other stars. Robotic probes have identified potential resources on the Moon, and evidence of water -- a key ingredient for life -- has been found on Mars and the moons of Jupiter. Direct human experience in space has fundamentally altered our perspective of humanity and our place in the universe. Humans have the ability to respond to the unexpected developments inherent in space travel and possess unique skills that enhance discoveries. Just as Mercury, Gemini, and Apollo challenged a gen-eration of Americans, a renewed U.S. space exploration program with a significant human component can inspire us -- and our youth -- to greater achievements on Earth and in space. The loss of Space Shuttles Challenger and Columbia and their crews are a stark reminder of the inherent risks of space flight and the severity of the challenges posed by space exploration. In preparation for future human exploration, we must advance our ability to live and work safely in space and, at the same time, develop the technologies to extend humanity’s reach to the Moon, Mars, and beyond. The new technologies required for further space exploration also will improve the Nation’s other space activities and may provide applications that could be used to address problems on Earth. Like the explorers of the past and the pioneers of flight in the last century, we cannot today identify all that we will gain from space exploration; we are confident, nonetheless, that the eventual return will be great. Like their efforts, the success of future U.S. space exploration will unfold over generations. \\n\\n# Goal and Objectives \\n\\nThe fundamental goal of this vision is to advance U.S. scientific, security, and economic interests through a robust space exploration program. In support of this goal, the United States will: • Implement a sustained and affordable human and robotic program to explore the solar system and beyond; • Extend human presence across the solar system, starting with a human return to the Moon by the year 2020, in preparation for human exploration of Mars and other destinations; • Develop the innovative technologies, knowledge, and infrastructures both to explore and to support decisions about the destinations for human exploration; and • Promote international and commercial participation in exploration to further U.S. scientific, security, and economic interests. Bringing the Vision to Reality \\n\\nThe Administrator of the National Aeronautics and Space Administration will be responsible for the plans, programs, and activities required to implement this vision, in coordination with other agencies, as deemed appropriate. The Administrator will plan and implement an integrated, long-term robotic and human explo-ration program structured with measurable milestones and executed on the basis of available resources, accu-mulated experience, and technology readiness. To implement this vision, the Administrator will conduct the following activities and take other actions as required: \\n\\nA. Exploration Activities in Low Earth Orbit Space Shuttle \\n\\n• Return the Space Shuttle to flight as soon as practical, based on the recommendations of the Columbia Accident Investigation Board; • Focus use of the Space Shuttle to complete assembly of the International Space Station; and • Retire the Space Shuttle as soon as assembly of the International Space Station is completed, planned for the end of this decade; \\n\\nInternational Space Station \\n\\n• Complete assembly of the International Space Station, including the U.S. components that support U.S. space exploration goals and those provided by foreign partners, planned for the end of this decade; • Focus U.S. research and use of the International Space Station on supporting space exploration goals, with emphasis on understanding how the space environment affects astronaut health and capabilities and developing countermeasures; and • Conduct International Space Station activities in a manner consistent with U.S. obligations contained in the agreements between the United States and other partners in the International Space Station. \\n\\nB. Space Exploration Beyond Low Earth Orbit The Moon \\n\\n• Undertake lunar exploration activities to enable sustained human and robotic exploration of Mars and more distant destinations in the solar system; • Starting no later than 2008, initiate a series of robotic missions to the Moon to prepare for and support future human exploration activities; • Conduct the first extended human expedition to the lunar surface as early as 2015, but no later than the year 2020; and • Use lunar exploration activities to further science, and to develop and test new approaches, technologies, and systems, including use of lunar and other space resources, to support sustained human space exploration to Mars and other destinations. Mars and Other Destinations \\n\\n• Conduct robotic exploration of Mars to search for evidence of life, to understand the history of the solar system, and to prepare for future human exploration; • Conduct robotic exploration across the solar system for scientific purposes and to support human exploration. In particular, explore Jupiter’s moons, asteroids and other bodies to search for evidence of life, to understand the history of the solar system, and to search for resources; • Conduct advanced telescope searches for Earth-like planets and habitable environments around other stars; • Develop and demonstrate power generation, propulsion, life support, and other key capabilities required to support more distant, more capable, and/or longer duration human and robotic exploration of Mars and other destinations; and • Conduct human expeditions to Mars after acquiring adequate knowledge about the planet using robotic missions and after successfully demonstrating sustained human exploration missions to the Moon. \\n\\nC. Space Transportation Capabilities Supporting Exploration \\n\\n• Develop a new crew exploration vehicle to provide crew transportation for missions beyond low Earth orbit; « Conduct the initial test flight before the end of this decade in order to provide an operational capability to support human exploration missions no later than 2014; • Separate to the maximum practical extent crew from cargo transportation to the International Space Station and for launching exploration missions beyond low Earth orbit; « Acquire cargo transportation as soon as practical and affordable to support missions to and from the International Space Station; and « Acquire crew transportation to and from the International Space Station, as required, after the Space Shuttle is retired from service. \\n\\nD. International and Commercial Participation \\n\\n• Pursue opportunities for international participation to support U.S. space exploration goals; and • Pursue commercial opportunities for providing transportation and other services supporting the International Space Station and exploration missions beyond low Earth orbit. \\n\\n# P R E S I D E N T G E O R G E W . B U S H J A N U A R Y 1 4 , 2 0 0 4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 NASA Guiding Principles for Exploration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Solar System and Beyond—Exploration Roadmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Lunar Testbeds and Missions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Mars Research, Testbeds, and Missions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 Outer Moons Research and Missions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\\n[...Content is omitted...]\\nw and cargo on different launches, a safer approach to crew transport. NASA will initiate Project Constellation to develop a new Crew Exploration Vehicle for future crew trans-port . This vehicle will be developed in stages, with the first automated test flight in 2008, more advanced test flights soon thereafter, and a fully operational capability no later than 2014. The design of the Crew Exploration Vehicle will be driv-en by the needs of the future human exploration missions described in this document. The Crew Exploration Vehicle might also supplement interna-tional partner crew transport systems to the Space Station. For cargo transport to the Space Station after 2010, NASA will rely on existing or new commercial cargo transport systems, as well as international part-ner cargo transport systems. NASA does not plan to develop new launch vehicle capabilities except where critical NASA needs—such as heavy lift—are not met by commercial or military systems. Depending on future human mission designs, NASA could decide to develop or acquire a heavy lift vehi-cle later this decade. Such a vehicle could be derived from elements of the Space Shuttle, existing commercial launch vehicles, or new designs. In the days of the Apollo program, human explo-ration systems employed expendable, single-use vehicles requiring large ground crews and careful monitoring. For future, sustainable exploration pro-grams, NASA requires cost-effective vehicles that may be reused, have systems that could be applied to more than one destination, and are highly reliable and need only small ground crews. NASA plans to invest in a number of new approaches to explo-ration, such as robotic networks, modular systems, pre-positioned propellants, advanced power and propulsion, and in-space assembly, that could enable these kinds of vehicles. These technologies will be demonstrated on the ground, at the Space Station and other locations in Earth orbit, and on the Moon start-ing this decade and into the next. Other break-through technologies, such as nuclear power and propulsion, optical communications, and potential use of space resources, will be demonstrated as part of robotic exploration missions. The challenges of designing these systems will accelerate the develop-ment of fundamental technologies that are critical not only to NASA, but also to the Nation’s econom-ic and national security. National Aeronautics and Space Administration 16 \\n\\nAbove: Mars as seen by the Hubble Space Telescope. 17 The Vision for Space Exploration NASA Transformation \\n\\n“No one regards what is before his feet; we all gaze at the stars.” \\n\\n> Quintus Ennius (239–169 BC)\\n\\nTo successfully execute the President’s vision, NASA will refocus its organization, create new offices where necessary, realign ongoing programs and personnel, experiment with new ways of doing business, and tap the great innovative and creative talents of our Nation. Prior to this plan, six Enterprises comprised NASA’s organization—Space Science, Earth Science, Biological and Physical Research, Aerospace Technology, Education, and Space Flight. To devel-op the exploration building blocks described in this document, NASA has created a new Exploration Systems Enterprise. Exploration Systems will be initially responsible for developing the solar system exploration vehicles and technologies described in this plan, including the Crew Exploration Vehicle, nuclear power and propulsion systems, and neces-sary supporting technologies. Relevant elements of the Aerospace Technology, Space Science, and Space Flight enterprises were transferred to the Exploration Systems Enterprise. The Aerospace Technology Enterprise was renamed the Aeronautics Enterprise. In the past, NASA’s human space flight programs and robotic exploration programs have largely oper-ated independently of each other. As human explor-ers prepare to join their robotic counterparts, closer coordination and integration will be necessary. The Exploration Systems Enterprise will work closely with the Space Science Enterprise to use the Moon as a testing ground for solar system exploration vehi-cles and technologies. NASA’s Space Science Enterprise will have respon-sibility for carrying out robotic testbeds on the Moon and Mars and will also demonstrate other key tech-nologies for human and robotic exploration in other missions to Mars and the outer moons. NASA’s Space Science Enterprise will eventually need to integrate human capabilities into Mars science plan-ning, and potentially deep space observatory or outer moon planning. Many other elements of the NASA organization will be focused to support this new direction. NASA’s Biological and Physical Research Enterprise will put much greater emphasis on bioastronautics research to enable human exploration of other worlds. Similarly, Space Station research will be prioritized to support human exploration. NASA’s Office of the Space Architect will be responsible for coordinating and integrating the exploration activities of NASA’s different Enterprises and for maintaining exploration roadmaps and high-level requirements. As we move outward into the solar system, NASA will rely more heavily on private sector space capa-bilities to support activities in Earth orbit and future exploration activities. In particular, NASA will seek to use existing or new commercial launch vehicles for cargo transport to the Space Station, and poten-tially to the Moon and other destinations. Building on its long history and extensive and close ties with the space and research agencies of other nations, NASA will also actively seek international partners and work with the space agencies of these partners in executing future exploration activities. Many of the technical challenges that NASA will face in the coming years will require innovative solutions. In addition to tapping creative thinking within the NASA organization, NASA will need to leverage the ideas and expertise resident in the Nation’s universities and industry. One way that NASA plans to do this is through a series of Centennial Challenges. As in the barnstorming days of early aviation, NASA plans to establish prizes for specific accomplishments that advance solar system exploration and other NASA goals. NASA will also invigorate its workforce, focus its facilities, and revitalize its field centers. Congress is reviewing human capital legislation that will provide NASA with necessary workforce tools. NASA is also planning to phase out older, underutilized build-ings and facilities. As exploration activities get underway, NASA anticipates additional planning, reviews, and changes to align and improve its infra-structure. National Aeronautics and Space Administration 18 \\n\\nAbove: The Moon as seen by the Galileo spacecraft. 19 The Vision for Space Exploration Resources \\n\\nTo confine our attention to terrestrial matters would be to limit the human spirit. \\n\\nStephen Hawking (1942– ) \\n\\nThe President’s Vision for solar system exploration is affordable in both the short-term and the long-term. NASA’s budget will increase by five percent per year over the next three years and at about one percent for the following two years. Although the budget increases are modest, NASA will be able to carry out a robust exploration pro-gram. NASA will free up resources in its budget in three ways: holding down growth in existing pro-grams that do not support the vision; retiring the Space Shuttle to free up billions of dollars in the next decade; and focusing on innovations that reduce the cost of sustained space operations. The chart above reflects the shift in funding that will occur over time as the new vision for human and robotic exploration of the solar system and beyond is implemented. \\n\\n# Exploration Strategy Based on Long-Term Affordability National Aeronautics and Space Administration 20 21 The Vision for Space Exploration National Benefits \\n\\nJust as Meriwether Lewis and William Clark could not have predicted the settlement of the American West within a hundred years of the start of their famous 19th century expedition, the total benefits of a single exploratory undertaking or discovery cannot be predicted in advance. Because the very purpose of exploratory voyages and research is to understand the unknown, exact benefits defy calculation. Nonetheless, we can define important categories of benefits to the Nation and society. Preparing for exploration and research accelerates the development of technologies that are important to the economy and national security. The space missions in this plan require advanced systems and capabilities that will accelerate the development of many critical technologies, including power, com-puting, nanotechnology, biotechnology, communica-tions, networking, robotics, and materials. These technologies underpin and advance the U.S. econo-my and help ensure national security. NASA plans to work with other government agencies and the pri-vate sector to develop space systems that can address national and commercial needs. Space exploration holds a special place in the human imagination. Youth are especially drawn to Mars rovers, astronauts, and telescopes. If engaged effec-tively and creatively, space inspires children to seek careers in math, science, and engineering, careers that are critical to our future national economic com-petitiveness. The accomplishments of U.S. space explorers are also a particularly potent symbol of American democracy, a reminder of what the human spirit can achieve in a free society. However, space explo-ration also encourages international cooperation, where spacecraft and explorers come to represent our world as well as our Nation. When the unknown becomes known, it catalyzes change, stimulating human thought, creativity and imagination. The scientific questions that this plan pursues have the potential to revolutionize whole fields of research. For example, scientists are still working to understand how similarly sized planets, such as Mars and Earth, could have developed so differently and what that could mean for our planet. If life is found beyond Earth, biological processes on other worlds may be very different from those evolved on our world. Outside the sciences, the very knowledge that life exists elsewhere in the universe may hold revelations for fields in the humanities. Exploration and discovery are key agents of growth in society—technologically, economically, socially, internationally, and intellectually. This plan sets in motion activities that will contribute to change and growth in the U.S. and the world over the next century. \\n\\n> NASA research stimulates and inspires young minds and provides critical technologies for the Nation.\\n\\n“Mankind is drawn to the heavens for the same reason we were once drawn into unknown lands and across the open sea. We choose to explore space because doing so improves our lives, and lifts our national spirit.” \\n\\nPresident George W. Bush January 14, 2004 National Aeronautics and Space Administration 22 \\n\\nAbove: An artist’s drawing of a human exploration base on Callisto, Jupiter’s second largest moon. \\n\\n# Image Credits \\n\\nPage vi An artist’s concept of a spacecraft, equipped with a centrifuge and nuclear–electric propulsion, traveling to Mars, John Frassanito and Associates. Page 6 An artist’s concept of lunar exploration, John Frassanito and Associates. Page 8 A drawing of astronauts and robots exploring Mars, John Frassanito and Associates. Page 12 A drawing of astronauts and advanced robotic assistants building a space telescope, Pat Rawlings, SAIC. Below Analytical Mechanics Associates. Editing, layout, and design by The Tauri Group, LLC, and Eileen Schramm visual communication. Above: Spiral galaxy M81, located approximately 12 million light-years from Earth, as seen by the Spitzer Space Telescope. National Aeronautics and Space Administration \\n\\nNASA Headquarters \\n\\nWashington, DC 20546 NP-2004-01-334-HQ \\n\\nhttp://www.nasa.gov\\n\"}"
        }

有点幽默,通义千问的接口认为 JSON string 不是 string。难道阿里云认真开始限制这里只能是简单字符串(“纯文本格式”)?我就不提所谓 object 对实际业务有多么重要(尽管 tools[].function.parameters.type = "object" 可能是指入参而不是出参格式)。再一次出现这样的情况:原本正常工作的代码由于接口行为变更而报错。这次,我索性从我的 function call 用例移除通义千问。

若无特别说明,本文系原创,遵循 署名-非商业性使用 3.0 (CC BY-NC 3.0) 协议,转载文章请注明来自【闪星空间】,或链接上原文地址:http://shansing.com/read/543/

3 条评论

  1. 我一般使用 GPT-4o,我觉得还不错

    1. 我一般也用 GPT、Claude,是看阿里云支持 openai 兼容接口才接入的。结果还挺多坑。

  2. 最近一直用的阿里云服务器,它的售后是真的赞!

发表评论»

NO SPAMS! 不要发垃圾评论哦!

表情