Documentation
¶
Overview ¶
Package classifier implements an LLM-judge per-step model-role router.
The classifier sees the user's most recent message, asks a small fast model to rank the difficulty among the configured candidate roles, and caches the answer keyed by a prompt-prefix hash so repeat prompts don't re-pay the classifier latency budget.
Routing happens synchronously on before:llm.request:
- Cache hit: rewrite Role immediately. Zero added latency.
- Cache miss: leave Role unchanged (default routing), and spawn a background goroutine that classifies via the LLM and warms the cache for the next call. This avoids paying the classifier round-trip on the very first request — the trade-off documented in the idea 09 plan ("first step in a chain pays cache creation").
Recursion guard: the classifier's own llm.request is tagged `_source: nexus.router.classifier` and the handler skips when that tag is set, so the classifier cannot route itself.
Index ¶
- func New() engine.Plugin
- type Plugin
- func (p *Plugin) Capabilities() []engine.Capability
- func (p *Plugin) ConfigSchema() []byte
- func (p *Plugin) Dependencies() []string
- func (p *Plugin) Emissions() []string
- func (p *Plugin) ID() string
- func (p *Plugin) Init(ctx engine.PluginContext) error
- func (p *Plugin) Name() string
- func (p *Plugin) Ready() error
- func (p *Plugin) Requires() []engine.Requirement
- func (p *Plugin) Shutdown(_ context.Context) error
- func (p *Plugin) Subscriptions() []engine.EventSubscription
- func (p *Plugin) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the LLM-classifier router.
func (*Plugin) Capabilities ¶
func (p *Plugin) Capabilities() []engine.Capability
func (*Plugin) ConfigSchema ¶
ConfigSchema implements engine.ConfigSchemaProvider.
func (*Plugin) Dependencies ¶
func (*Plugin) Requires ¶
func (p *Plugin) Requires() []engine.Requirement
func (*Plugin) Subscriptions ¶
func (p *Plugin) Subscriptions() []engine.EventSubscription