-
Notifications
You must be signed in to change notification settings - Fork 198
Open
Description
Hi team,
I've been experimenting with the structured outputs example and successfully implemented response formatting based on the provided code.
While the example works well for flat or non-recursive structures, I'm encountering a stack overflow when attempting to parse recursive structs. For instance, consider the following type definition:
type HistoricalComputer struct {
Origin Origin `json:"origin" jsonschema_description:"The origin of the computer"`
Name string `json:"full_name" jsonschema_description:"The name of the device model"`
Legacy string `json:"legacy" jsonschema:"enum=positive,enum=neutral,enum=negative" jsonschema_description:"Its influence on the field of computing"`
// Recursive reference
NotableFacts []HistoricalComputer `json:"notable_facts" jsonschema_description:"A few key facts about the computer"`
}
When this type is used in a request involving structured output, the program crashes due to infinite recursion during schema generation or JSON parsing, resulting in a stack overflow.
Metadata
Metadata
Assignees
Labels
No labels