qwen3-coder: support anyOf when parsing tool calls

This commit is contained in:
Devon Rifkin
2025-10-14 15:33:05 -07:00
parent 850da848c5
commit 08fbb60bb2
2 changed files with 23 additions and 1 deletions

View File

@@ -276,7 +276,14 @@ func parseToolCall(raw qwenEventRawToolCall, tools []api.Tool) (api.ToolCall, er
var paramType api.PropertyType
if matchedTool != nil && matchedTool.Function.Parameters.Properties != nil {
if prop, ok := matchedTool.Function.Parameters.Properties[parameter.Name]; ok {
paramType = prop.Type
// Handle anyOf by collecting all types from the union
if len(prop.AnyOf) > 0 {
for _, anyOfProp := range prop.AnyOf {
paramType = append(paramType, anyOfProp.Type...)
}
} else {
paramType = prop.Type
}
}
}