test: use exact match for tool name assertion
Address review feedback - drop function.name fallback and strings.Contains in favor of direct == comparison.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package chat_completions
|
package chat_completions
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
@@ -623,14 +622,9 @@ func TestToolsDefinitionTranslated(t *testing.T) {
|
|||||||
t.Fatal("no tools found in output")
|
t.Fatal("no tools found in output")
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for "search" tool
|
|
||||||
found := false
|
found := false
|
||||||
for _, tool := range tools {
|
for _, tool := range tools {
|
||||||
name := tool.Get("name").String()
|
if tool.Get("name").String() == "search" {
|
||||||
if name == "" {
|
|
||||||
name = tool.Get("function.name").String()
|
|
||||||
}
|
|
||||||
if strings.Contains(name, "search") {
|
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user