diff --git a/providers/openai/openai_test.go b/providers/openai/openai_test.go index 97e5a8e9fe97e452749411ca8cc635db221be503..adc1cf2e8df311722b7aab878a32e47109226f7f 100644 --- a/providers/openai/openai_test.go +++ b/providers/openai/openai_test.go @@ -2407,11 +2407,11 @@ func TestDoStream(t *testing.T) { require.NotEqual(t, -1, toolCall) // Verify tool deltas combine to form the complete input - fullInput := "" + var fullInput strings.Builder for _, delta := range toolDeltas { - fullInput += delta + fullInput.WriteString(delta) } - require.Equal(t, `{"value":"Sparkle Day"}`, fullInput) + require.Equal(t, `{"value":"Sparkle Day"}`, fullInput.String()) }) t.Run("should stream annotations/citations", func(t *testing.T) { diff --git a/schema/schema_test.go b/schema/schema_test.go index a0d1758198706c3aad0f718138269b7d443796c7..b49323a38f0e214fcd9f094b41bbda1ccc26b291 100644 --- a/schema/schema_test.go +++ b/schema/schema_test.go @@ -15,7 +15,7 @@ func TestEnumSupport(t *testing.T) { Format string `json:"format,omitempty" enum:"json,xml,text"` } - schema := Generate(reflect.TypeOf(WeatherInput{})) + schema := Generate(reflect.TypeFor[WeatherInput]()) require.Equal(t, "object", schema.Type) @@ -300,7 +300,7 @@ func TestGenerateSchemaPointerTypes(t *testing.T) { Age *int `json:"age"` } - schema := Generate(reflect.TypeOf(StructWithPointers{})) + schema := Generate(reflect.TypeFor[StructWithPointers]()) require.Equal(t, "object", schema.Type) @@ -324,7 +324,7 @@ func TestGenerateSchemaNestedStructs(t *testing.T) { Address Address `json:"address"` } - schema := Generate(reflect.TypeOf(Person{})) + schema := Generate(reflect.TypeFor[Person]()) require.Equal(t, "object", schema.Type) @@ -345,7 +345,7 @@ func TestGenerateSchemaRecursiveStructs(t *testing.T) { Next *Node `json:"next,omitempty"` } - schema := Generate(reflect.TypeOf(Node{})) + schema := Generate(reflect.TypeFor[Node]()) require.Equal(t, "object", schema.Type) @@ -367,7 +367,7 @@ func TestGenerateSchemaWithEnumTags(t *testing.T) { Optional string `json:"optional,omitempty" enum:"a,b,c"` } - schema := Generate(reflect.TypeOf(ConfigInput{})) + schema := Generate(reflect.TypeFor[ConfigInput]()) // Check level field levelSchema := schema.Properties["level"] @@ -398,7 +398,7 @@ func TestGenerateSchemaComplexTypes(t *testing.T) { Interface any `json:"interface"` } - schema := Generate(reflect.TypeOf(ComplexInput{})) + schema := Generate(reflect.TypeFor[ComplexInput]()) // Check string slice stringSliceSchema := schema.Properties["string_slice"]