Documentation
¶
Overview ¶
Package classify is nib's interface to small classification models: a model that answers structured questions about a text instead of generating one. The approval_mode "classify" gate and the TUI's reply suggestions are built on it. Backends live in subpackages.
Index ¶
Constants ¶
const ( TypeNoul = "noul" // is the described thing present, 0–1, with entity spans TypeChoice = "choice" // pick one of Choices TypeScore = "score" // pick one of Levels )
Question types.
const DefaultTimeout = 2 * time.Second
DefaultTimeout bounds a request when classifier.timeout is unset.
Variables ¶
var Categories = []string{"inspect", "build_test", "local_edit", "destructive", "network", "system"}
Categories are the risk categories a tool call is classified into.
Functions ¶
func Resolve ¶
Resolve returns the base URL and API key the classifier talks to: the named endpoint's, or the top-level ones when classifier.endpoint is empty.
func ValidCategory ¶
ValidCategory reports whether name is one of Categories.
Types ¶
type Answer ¶
type Answer struct {
Noul float64 // noul
Entities []Entity // noul
Choice string // choice
Confidence float64 // choice, score
Probabilities map[string]float64 // choice, score
Score float64 // score
}
Answer is one question's answer. Which fields are set depends on the type.
type Builder ¶
type Builder func(baseURL, apiKey, model string, timeout time.Duration) Classifier
Builder makes a Classifier for one API. Subpackages register themselves so this package does not import them.
type Classifier ¶
type Classifier interface {
Classify(ctx context.Context, state string, qs map[string]Question) (map[string]Answer, error)
}
Classifier answers questions about a text. Answers are keyed like qs.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package systemone is a classify.Classifier for the SystemOne API (kev-compatible), which LocalAI, vllm.cpp and kev serve at POST {base_url}/systemone.
|
Package systemone is a classify.Classifier for the SystemOne API (kev-compatible), which LocalAI, vllm.cpp and kev serve at POST {base_url}/systemone. |