Documentation
¶
Overview ¶
Package structured provides utilities for generating JSON Schema from Go structs and parsing model responses into typed values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseResponse ¶
func ParseResponse(resp *types.ModelResponse, target interface{}) error
ParseResponse unmarshals a ModelResponse.Content into the target struct. The target must be a non-nil pointer.
Types ¶
type OutputSchema ¶
type OutputSchema struct {
Name string // Name of the schema (derived from struct name)
Description string // Optional description
Schema map[string]interface{} // JSON Schema as map
}
OutputSchema describes a JSON Schema derived from a Go struct.
func SchemaFromType ¶
func SchemaFromType(v interface{}) (*OutputSchema, error)
SchemaFromType generates a JSON Schema from a Go struct using reflection. The value must be a struct or pointer to struct. Self-referencing types are detected and produce a generic object schema to avoid infinite recursion.
func (*OutputSchema) ToResponseFormat ¶
func (s *OutputSchema) ToResponseFormat() *models.ResponseFormat
ToResponseFormat converts an OutputSchema to a models.ResponseFormat. The resulting JSONSchema map includes "name" and "description" metadata alongside the schema properties, ready for provider consumption.