fix: strip output_config for MiniMax (#820)

This commit is contained in:
Rezky Hamid
2026-05-01 16:16:01 +07:00
committed by GitHub
parent cad31a171b
commit 30b114ab75
2 changed files with 76 additions and 0 deletions

View File

@@ -96,6 +96,74 @@ describe("request normalization", () => {
expect(userMessage.content).toBe("hello\nworld");
});
it("translateRequest strips unsupported Anthropic output_config for MiniMax Claude-compatible endpoints", () => {
const body = {
model: "MiniMax-M2.7",
system: [{ type: "text", text: "You are helpful." }],
messages: [
{
role: "user",
content: [{ type: "text", text: "continue" }],
},
],
max_tokens: 1024,
output_config: {
effort: "medium",
format: {
type: "json_schema",
schema: {
type: "object",
properties: { title: { type: "string" } },
required: ["title"],
additionalProperties: false,
},
},
},
};
const result = translateRequest(
FORMATS.CLAUDE,
FORMATS.CLAUDE,
"MiniMax-M2.7",
JSON.parse(JSON.stringify(body)),
true,
null,
"minimax",
);
expect(result.output_config).toBeUndefined();
expect(result.messages[0].content[0].text).toBe("continue");
});
it("translateRequest preserves output_config for Anthropic Claude", () => {
const body = {
model: "claude-sonnet-4.5",
system: [{ type: "text", text: "You are helpful." }],
messages: [
{
role: "user",
content: [{ type: "text", text: "continue" }],
},
],
max_tokens: 1024,
output_config: {
format: { type: "json_schema", schema: { type: "object" } },
},
};
const result = translateRequest(
FORMATS.CLAUDE,
FORMATS.CLAUDE,
"claude-sonnet-4.5",
JSON.parse(JSON.stringify(body)),
true,
null,
"claude",
);
expect(result.output_config).toEqual(body.output_config);
});
it("parseSSELine supports provider raw NDJSON stream lines", () => {
const raw = JSON.stringify({
model: "gpt-oss:120b",