mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
refactor(llmclient): make JSONSchema.Schema raw json for pinned field order
This commit is contained in:
1 parent
08e588a79f
commit
0ead53757c
2 files changed
+6
-3
No files matched your search
@@ -107,11 +107,14 @@ type ResponseFormat struct {
|
|||||||
JSONSchema JSONSchema `json:"json_schema"`
|
JSONSchema JSONSchema `json:"json_schema"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSONSchema is the strict structured-output schema.
|
// JSONSchema is the strict structured-output schema. Schema is raw JSON so the
|
||||||
|
// caller controls property ORDER: OpenAI emits fields in schema order, and a
|
||||||
|
// reasoning-first schema must not be re-sorted alphabetically (as a Go map
|
||||||
|
// would be).
|
||||||
type JSONSchema struct {
|
type JSONSchema struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Strict bool `json:"strict"`
|
Strict bool `json:"strict"`
|
||||||
Schema map[string]any `json:"schema"`
|
Schema json.RawMessage `json:"schema"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response is the slice of a chat-completions response we read.
|
// Response is the slice of a chat-completions response we read.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func TestChatCompletionRequestShapeAndParse(t *testing.T) {
|
|||||||
JSONSchema: JSONSchema{
|
JSONSchema: JSONSchema{
|
||||||
Name: "ranked_actions",
|
Name: "ranked_actions",
|
||||||
Strict: true,
|
Strict: true,
|
||||||
Schema: map[string]any{"type": "object"},
|
Schema: json.RawMessage(`{"type":"object"}`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user