mirror of
https://github.com/ollama/ollama.git
synced 2026-01-12 00:06:57 +08:00
olmo3: fix flaky test (#13629)
I introduced this in <https://github.com/ollama/ollama/pull/13525>
This commit is contained in:
@@ -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"}}},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user