Documentation
¶
Overview ¶
Package structuredoutput lets LLM text-prompt components accept a JSON Schema that describes the desired response. The component shows a default schema the user edits; the backend validates that it is well-formed JSON before the provider request is fired, and normalizes it to the constraints both providers enforce:
- Every object node gets "additionalProperties": false.
- OpenAI strict mode (strict=true) additionally forces every object's "required" to list all of its properties; optional fields are expressed by making their type nullable in the schema itself.
- Anthropic (strict=false) leaves "required" as the user wrote it.
Index ¶
Constants ¶
const DefaultSchema = `` /* 264-byte string literal not displayed */
DefaultSchema is the starter JSON Schema shown in the field for the user to edit.
Variables ¶
This section is empty.
Functions ¶
func ConfigField ¶
func ConfigField(name, label, description string) configuration.Field
ConfigField returns the togglable JSON-schema text field for a component.
func Parse ¶
Parse reads the raw config value (a JSON Schema string) into a schema object. It returns (nil, nil) when the field is unset, so callers can treat structured output as optional. Otherwise it validates that the value is a JSON object that looks like an object schema, so malformed input surfaces at config/Setup time rather than as a provider error.
Types ¶
This section is empty.