olmo3: fix flaky test (#13629)

I introduced this in <https://github.com/ollama/ollama/pull/13525>
This commit is contained in:
Devon Rifkin
2026-01-05 22:37:20 -08:00
committed by GitHub
parent e51dead636
commit 6c3faafed2
2 changed files with 21 additions and 6 deletions

View File

@@ -227,9 +227,9 @@ func TestOlmo3Renderer(t *testing.T) {
ID: "call_1", ID: "call_1",
Function: api.ToolCallFunction{ Function: api.ToolCallFunction{
Name: "book_flight", Name: "book_flight",
Arguments: testArgs(map[string]any{ Arguments: testArgsOrdered([]orderedArg{
"from": "SFO", {"from", "SFO"},
"to": "NYC", {"to", "NYC"},
}), }),
}, },
}, },
@@ -243,9 +243,9 @@ func TestOlmo3Renderer(t *testing.T) {
Name: "book_flight", Name: "book_flight",
Parameters: api.ToolFunctionParameters{ Parameters: api.ToolFunctionParameters{
Type: "object", Type: "object",
Properties: testPropsMap(map[string]api.ToolProperty{ Properties: testPropsOrdered([]orderedProp{
"from": {Type: api.PropertyType{"string"}}, {"from", api.ToolProperty{Type: api.PropertyType{"string"}}},
"to": {Type: api.PropertyType{"string"}}, {"to", api.ToolProperty{Type: api.PropertyType{"string"}}},
}), }),
}, },
}, },

View File

@@ -34,3 +34,18 @@ func testArgsOrdered(pairs []orderedArg) api.ToolCallFunctionArguments {
} }
return args return args
} }
// orderedProp represents a key-value pair for ordered property creation
type orderedProp struct {
Key string
Value api.ToolProperty
}
// testPropsOrdered creates a ToolPropertiesMap with a specific key order
func testPropsOrdered(pairs []orderedProp) *api.ToolPropertiesMap {
props := api.NewToolPropertiesMap()
for _, p := range pairs {
props.Set(p.Key, p.Value)
}
return props
}