Documentation
¶
Overview ¶
Package model is a recall.Extractor backed by a language model, so that RememberText can be given text alone and work out the statements in it.
The model only proposes. Every proposal still goes through the registry and the fold, so a model can name only registered predicates, must quote its evidence from the text, and cannot change what supersession means.
Index ¶
Constants ¶
const DefaultAnthropicModel = "claude-opus-5-5"
DefaultAnthropicModel is the model used when a spec names the anthropic provider without a model.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Provider is "anthropic", "openai", or "ollama". openai also serves any
// endpoint that speaks the OpenAI chat completions API, such as vLLM or
// Groq, through BaseURL or OPENAI_BASE_URL.
Provider string
Model string
BaseURL string
APIKey string
// HTTPClient is optional.
HTTPClient *http.Client
}
Config selects the model. Empty BaseURL and APIKey are read from the provider's usual environment variables.
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor proposes statements from text with a language model.
func NewExtractor ¶
NewExtractor checks the configuration and builds the extractor. It makes no request until the first Extract.
func (*Extractor) Extract ¶
func (e *Extractor) Extract(ctx context.Context, text string, reg recall.Registry) ([]recall.Proposal, error)
Extract asks the model for the statements in text, then keeps only the ones the registry admits. A proposal that misquotes the text or gives a value of the wrong type is dropped rather than failing the batch; the text itself is kept as a note either way.
For a client with an open vocabulary (recall.OpenVocabulary), the model sees the predicates already in use and may coin new ones, giving each a cardinality, a description, and a value type.