perception

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Denoiser

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

Denoiser handles input noise detection and suggestion

func NewDenoiser

func NewDenoiser() *Denoiser

NewDenoiser creates a new denoiser

func (*Denoiser) SuggestCorrection

func (d *Denoiser) SuggestCorrection(input string) string

SuggestCorrection suggests corrections for noisy input

type Entity

type Entity struct {
	Type  string `json:"type"`  // e.g., "language", "file", "tool"
	Value string `json:"value"` // e.g., "Python", "data.csv"
}

Entity represents extracted named entities from user input

type IntentClassification

type IntentClassification struct {
	Type        IntentType     `json:"type"`
	Confidence  float64        `json:"confidence"` // 0.0 - 1.0
	Complexity  TaskComplexity `json:"complexity,omitempty"`
	Entities    []Entity       `json:"entities,omitempty"`
	Keywords    []string       `json:"keywords,omitempty"`
	Description string         `json:"description,omitempty"`
}

IntentClassification represents the result of intent parsing

type IntentType

type IntentType string

IntentType represents the type of user intent

const (
	// IntentTask is for task-oriented requests ("Write a Python script")
	IntentTask IntentType = "task"

	// IntentQuestion is for information requests
	IntentQuestion IntentType = "question"

	// IntentClarification is when user clarifies previous message
	IntentClarification IntentType = "clarification"

	// IntentCorrection is when user corrects the assistant
	IntentCorrection IntentType = "correction"

	// IntentFeedback is feedback, positive or negative
	IntentFeedback IntentType = "feedback"

	// IntentChitChat is casual conversation
	IntentChitChat IntentType = "chitchat"

	// IntentUnknown is when intent cannot be classified
	IntentUnknown IntentType = "unknown"
)

type NoiseDetection

type NoiseDetection struct {
	HasNoise    bool        `json:"has_noise"`
	NoiseTypes  []NoiseType `json:"noise_types,omitempty"`
	Suggestions []string    `json:"suggestions,omitempty"`
}

NoiseDetection represents detected noise in user input

type NoiseType

type NoiseType string

NoiseType represents types of input noise

const (
	NoiseTypo        NoiseType = "typo"
	NoiseIncomplete  NoiseType = "incomplete"
	NoiseAmbiguous   NoiseType = "ambiguous"
	NoiseContradicts NoiseType = "contradicts"
	NoiseIrrelevant  NoiseType = "irrelevant"
)

type Parser

type Parser struct {
}

Parser handles intent classification and entity extraction

func NewParser

func NewParser() *Parser

NewParser creates a new perception parser

func (*Parser) Parse

func (p *Parser) Parse(input string, contextHistory []string) *PerceptionResult

Parse performs full perception analysis on user input

type PerceptionResult

type PerceptionResult struct {
	Input        string               `json:"input"`
	Intent       IntentClassification `json:"intent"`
	Noise        NoiseDetection       `json:"noise"`
	ContextHints []string             `json:"context_hints,omitempty"`
	Priority     int                  `json:"priority"` // 1 (highest) - 5 (lowest)
}

PerceptionResult is the complete output of the perception layer

type TaskComplexity

type TaskComplexity string

TaskComplexity indicates how complex a task is

const (
	ComplexitySimple   TaskComplexity = "simple"   // Single tool call
	ComplexityMedium   TaskComplexity = "medium"   // 2-5 tool calls
	ComplexityAdvanced TaskComplexity = "advanced" // 5+ tool calls, may need sub-agents
)

Jump to

Keyboard shortcuts

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