fix(minimax): buffer unprefixed tool wrappers
This commit is contained in:
committed by
can1357
parent
9bfcc54869
commit
f745416b62
@@ -19,6 +19,8 @@ const MINIMAX_WRAPPER_TAGS: Readonly<Record<string, true>> = { tool_call: true }
|
||||
const MINIMAX_BASE_TAG_PREFIXES = [
|
||||
"<minimax:tool_call",
|
||||
"</minimax:tool_call",
|
||||
"<tool_call",
|
||||
"</tool_call",
|
||||
"<invoke",
|
||||
"</invoke",
|
||||
"<parameter",
|
||||
|
||||
@@ -182,6 +182,22 @@ describe("in-band tool dialects", () => {
|
||||
expect(calls[0]?.arguments).not.toHaveProperty('parameter name="count"');
|
||||
});
|
||||
|
||||
it("buffers unprefixed MiniMax wrappers across streaming tag splits", () => {
|
||||
const raw =
|
||||
'<tool_call>\n<invoke name="read">\n<parameter name="path" string="true">src/a.ts</parameter>\n<parameter name="count" string="false">2</parameter>\n</invoke>\n</tool_call>';
|
||||
const events = feedText("minimax", raw);
|
||||
const calls = toolEnds(events);
|
||||
const visibleText = events
|
||||
.filter((event): event is Extract<InbandScanEvent, { type: "text" }> => event.type === "text")
|
||||
.map(event => event.text)
|
||||
.join("");
|
||||
|
||||
expect(calls).toHaveLength(1);
|
||||
expect(calls[0]?.name).toBe("read");
|
||||
expect(calls[0]?.arguments).toEqual({ path: "src/a.ts", count: 2 });
|
||||
expect(visibleText).toBe("");
|
||||
});
|
||||
|
||||
it("stops before hallucinated Anthropic function results", () => {
|
||||
const parsed = parseInbandToolMessage(
|
||||
assistant([
|
||||
|
||||
Reference in New Issue
Block a user