Support toolCall XML tags and XML child arguments in DetectToolCalls
This commit is contained in:
@@ -670,6 +670,22 @@ Some postamble.`
|
||||
if rem4 != "" {
|
||||
t.Errorf("expected empty remaining, got %q", rem4)
|
||||
}
|
||||
|
||||
// 5. XML toolCall with child tags
|
||||
xmlChildTags := "```xml\n<toolCall>\n <name>get_weather</name>\n <arguments>\n <loc>Paris</loc>\n </arguments>\n</toolCall>\n```"
|
||||
calls5, rem5, ok5 := DetectToolCalls(xmlChildTags)
|
||||
if !ok5 || len(calls5) != 1 {
|
||||
t.Fatalf("expected 1 call from xmlChildTags, got %d", len(calls5))
|
||||
}
|
||||
if calls5[0].Function.Name != "get_weather" {
|
||||
t.Errorf("expected get_weather, got %q", calls5[0].Function.Name)
|
||||
}
|
||||
if !strings.Contains(calls5[0].Function.Arguments, `"Paris"`) {
|
||||
t.Errorf("expected Paris in arguments, got %s", calls5[0].Function.Arguments)
|
||||
}
|
||||
if rem5 != "" {
|
||||
t.Errorf("expected empty remaining, got %q", rem5)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUniversalStreamToolCallFilterVariants(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user