model

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

func Parse

func Parse(spec string) (Config, error)

Parse reads a "provider:model" spec, such as "anthropic:claude-opus-5-5", "openai:gpt-5-mini", or "ollama:llama3.1". A bare "anthropic" selects DefaultAnthropicModel.

type Extractor

type Extractor struct {
	// contains filtered or unexported fields
}

Extractor proposes statements from text with a language model.

func NewExtractor

func NewExtractor(cfg Config) (*Extractor, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL