Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractJSON ¶
ExtractJSON tries to recover a valid JSON object/array from model output. It accepts pure JSON or mixed text with embedded JSON.
Types ¶
type Config ¶
type Config struct {
// Output must be a non-nil pointer to target value (struct, slice, map, etc).
Output any
// MaxAttempts is total attempts (first generation + repairs).
// If <= 0, default is 3.
MaxAttempts int
// BasePrompt allows overriding the initial prompt template.
// Supported placeholders: {{SCHEMA}}, {{USER_INPUT}}.
BasePrompt string
// RepairPrompt allows overriding the self-repair prompt template.
// Supported placeholders: {{SCHEMA}}, {{ERROR}}, {{LAST_RESPONSE}}, {{USER_INPUT}}.
RepairPrompt string
// AllowUnknownFields disables strict unknown-field checks during decode.
AllowUnknownFields bool
}
type Controller ¶
type Controller[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any](cfg Config) *Controller[T]
func (*Controller[T]) Run ¶
func (c *Controller[T]) Run(ctx context.Context, agent controller.AgentLike[T], input string) (string, error)
Click to show internal directories.
Click to hide internal directories.