classifier

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() engine.Plugin

New creates a new classifier router instance.

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

func (p *Plugin) ConfigSchema() []byte

ConfigSchema implements engine.ConfigSchemaProvider.

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

func (*Plugin) Emissions

func (p *Plugin) Emissions() []string

func (*Plugin) ID

func (p *Plugin) ID() string

func (*Plugin) Init

func (p *Plugin) Init(ctx engine.PluginContext) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Ready

func (p *Plugin) Ready() error

func (*Plugin) Requires

func (p *Plugin) Requires() []engine.Requirement

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(_ context.Context) error

func (*Plugin) Subscriptions

func (p *Plugin) Subscriptions() []engine.EventSubscription

func (*Plugin) Version

func (p *Plugin) Version() string

Jump to

Keyboard shortcuts

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