feat: add strict schema enforcement and strip hallucinated fields from tool call parameters

This commit is contained in:
CJACK
2026-04-05 16:59:39 +08:00
parent 298a6f27cc
commit 088a750338
2 changed files with 8 additions and 0 deletions

View File

@@ -158,6 +158,10 @@ func filterToolCallsDetailed(parsed []ParsedToolCall, availableToolNames []strin
}
if tc.Input == nil {
tc.Input = map[string]any{}
} else {
// Remove known hallucinated fields often generated by models trying to bridge XML and JSON
delete(tc.Input, "_raw")
delete(tc.Input, "_xml")
}
out = append(out, tc)
}