Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Example ¶
type Example struct {
Subject string `json:"-"`
UserText string `json:"-"`
FormattedTo string `json:"-"`
}
Example is a structured grounding example for the prompt.
func (Example) MarshalJSON ¶
func (*Example) UnmarshalJSON ¶
func (*Example) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler for Example.
type MatchOption ¶
type MatchOption func(*matchConfig)
func WithGenerator ¶
func WithGenerator(gen genx.Generator) MatchOption
WithGenerator sets a custom generator for Match.
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is a compiled matcher built from rules.
func (*Matcher) Match ¶
func (m *Matcher) Match(ctx context.Context, pattern string, mc genx.ModelContext, opts ...MatchOption) iter.Seq2[Result, error]
Match executes the matcher against user input and returns streaming results.
func (*Matcher) Parse ¶
Parse converts arbitrary text chunks into ordered Match results. Chunk boundaries do not affect line framing.
func (*Matcher) SystemPrompt ¶
SystemPrompt returns the rendered system prompt for debugging.
type Pattern ¶
Pattern is a single input/output pattern example for one rule.
func (Pattern) MarshalJSON ¶
func (*Pattern) UnmarshalJSON ¶
func (*Pattern) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler for Pattern.
type Rule ¶
type Rule struct {
Name string `json:"name" yaml:"name"`
References map[string]string `json:"references,omitempty" yaml:"references,omitempty"`
Vars map[string]Var `json:"vars,omitempty" yaml:"vars,omitempty"`
Patterns []Pattern `json:"patterns,omitempty" yaml:"patterns,omitempty"`
Examples []Example `json:"examples,omitempty" yaml:"examples,omitempty"`
}
Rule is a schema-driven rule definition.
func ParseRuleYAML ¶
ParseRuleYAML parses a Rule from YAML bytes.