Documentation
¶
Overview ¶
Package decider asks a language model typed questions at points where the crawler would otherwise guess. Answers are validated against what the crawler offers, so the model can never introduce values or actions of its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Answer ¶
type Answer struct {
Bool bool `json:"bool,omitempty"`
Choice string `json:"choice,omitempty"`
Score float64 `json:"score,omitempty"`
}
Answer holds the field matching the question kind. Score is in [0, 1].
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache wraps a Decider with answer reuse, a per crawl call budget and optional record and replay through a JSON file.
func NewCache ¶
NewCache loads recorded answers from path when it exists. With replay set, next is never called and unrecorded questions fail with ErrNotRecorded. maxCalls <= 0 means unlimited.
type Jev ¶
type Jev struct {
// contains filtered or unexported fields
}
Jev is a Decider for TypeSafe's Jev models through the System One API, which answers typed questions directly instead of generating text.
type OpenAI ¶
type OpenAI struct {
// contains filtered or unexported fields
}
OpenAI is a Decider for any OpenAI compatible chat completions API, such as OpenAI, Ollama, vLLM or LM Studio.
func NewOpenAI ¶
NewOpenAI takes the API base URL, for example http://127.0.0.1:11434/v1 for Ollama.
type Question ¶
type Question struct {
Kind Kind `json:"kind"`
Prompt string `json:"prompt"`
// Options are the only valid answers for a Choice question.
Options []string `json:"options,omitempty"`
// Context is page content, which is untrusted input.
Context string `json:"context,omitempty"`
}
Question is a single typed question about a page.