Documentation
¶
Overview ¶
Package output provides output strategies for structured text generation. This mirrors the ai-sdk output module (text, object, array, choice, json).
All strategies implement stream.Output so they can be assigned to stream.Input.Output.
Index ¶
- func Array(opts ArrayOptions) stream.Output
- func Choice(opts ChoiceOptions) stream.Output
- func JSON(opts JSONOptions) stream.Output
- func Object(opts ObjectOptions) stream.Output
- func Text() stream.Output
- type ArrayOptions
- type ChoiceOptions
- type JSONOptions
- type NoObjectGeneratedError
- type ObjectOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Array ¶
func Array(opts ArrayOptions) stream.Output
Array generates an array of elements matching the element schema. The model responds with {"elements": [...]} wrapper.
func Choice ¶
func Choice(opts ChoiceOptions) stream.Output
Choice generates one of the predefined choice options. The model responds with {"result": "chosen_option"} wrapper.
func JSON ¶
func JSON(opts JSONOptions) stream.Output
JSON generates unstructured JSON (any valid JSON value).
func Object ¶
func Object(opts ObjectOptions) stream.Output
Object generates a typed object matching the schema.
Types ¶
type ArrayOptions ¶
type ArrayOptions struct {
// Element is the schema for array elements.
Element *schema.Schema
Name string
Description string
}
ArrayOptions configures array output generation.
type ChoiceOptions ¶
ChoiceOptions configures choice output generation.
type JSONOptions ¶
JSONOptions configures unstructured JSON output generation.
type NoObjectGeneratedError ¶
type NoObjectGeneratedError struct {
Message string
Cause error
Text string
FinishReason stream.FinishReason
Usage stream.Usage
}
NoObjectGeneratedError indicates the model failed to generate a valid object.
func (*NoObjectGeneratedError) Error ¶
func (e *NoObjectGeneratedError) Error() string
func (*NoObjectGeneratedError) Unwrap ¶
func (e *NoObjectGeneratedError) Unwrap() error