Documentation
¶
Overview ¶
Package jsonformat provides JSON schema-based response formatting and validation for structured agent output, deriving schemas from Go types and validating and normalizing values against them.
Index ¶
- func Any() agent.ResponseFormat
- func For[T any]() (agent.ResponseFormat, error)
- func ForType(rt reflect.Type) (agent.ResponseFormat, error)
- func MustFor[T any]() agent.ResponseFormat
- func New(name, description string, schema *jsonschema.Schema) agent.ResponseFormat
- func Nothing() agent.ResponseFormat
- type Format
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶
func Any() agent.ResponseFormat
Any returns a ResponseFormat representing the any type (no schema constraints).
func For ¶
func For[T any]() (agent.ResponseFormat, error)
For creates a ResponseFormat for the type T.
func ForType ¶
func ForType(rt reflect.Type) (agent.ResponseFormat, error)
ForType creates a ResponseFormat for the given reflect.Type. A nil rt is treated as Nothing.
func New ¶
func New(name, description string, schema *jsonschema.Schema) agent.ResponseFormat
New creates a new JSON response format with the given name, description, and schema. A nil schema represents an unconstrained JSON value.
func Nothing ¶
func Nothing() agent.ResponseFormat
Nothing returns a ResponseFormat that matches no values.
Types ¶
type Format ¶
type Format struct {
agent.ResponseFormat
// contains filtered or unexported fields
}
Format provides JSON schema-based response formatting and validation.
func FromResponseFormat ¶
func FromResponseFormat(format agent.ResponseFormat) (*Format, error)
FromResponseFormat creates a Format from a response format data value.
func (*Format) Marshal ¶
Marshal marshals v into JSON according to the provided format, validating against the format's schema.