mirror of https://github.com/openclaw/openclaw.git
fix(providers): disable z.ai strict tool shaping
This commit is contained in:
parent
745f1c9812
commit
eec6f59a77
|
|
@ -445,6 +445,37 @@ describe("openai transport stream", () => {
|
|||
expect(params).not.toHaveProperty("max_completion_tokens");
|
||||
});
|
||||
|
||||
it("omits strict tool shaping for Z.ai default-route completions providers", () => {
|
||||
const params = buildOpenAICompletionsParams(
|
||||
{
|
||||
id: "glm-5",
|
||||
name: "GLM 5",
|
||||
api: "openai-completions",
|
||||
provider: "zai",
|
||||
baseUrl: "",
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
} satisfies Model<"openai-completions">,
|
||||
{
|
||||
systemPrompt: "system",
|
||||
messages: [],
|
||||
tools: [
|
||||
{
|
||||
name: "lookup_weather",
|
||||
description: "Get forecast",
|
||||
parameters: { type: "object", properties: {} },
|
||||
},
|
||||
],
|
||||
} as never,
|
||||
undefined,
|
||||
) as { tools?: Array<{ function?: { strict?: boolean } }> };
|
||||
|
||||
expect(params.tools?.[0]?.function).not.toHaveProperty("strict");
|
||||
});
|
||||
|
||||
it("uses Mistral compat defaults for direct Mistral completions providers", () => {
|
||||
const params = buildOpenAICompletionsParams(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1398,7 +1398,7 @@ function detectCompat(model: OpenAIModeModel) {
|
|||
: "openai",
|
||||
openRouterRouting: {},
|
||||
vercelGatewayRouting: {},
|
||||
supportsStrictMode: !usesConfiguredNonOpenAIEndpoint,
|
||||
supportsStrictMode: !isZai && !usesConfiguredNonOpenAIEndpoint,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue