Documentation
¶
Overview ¶
Package awareness models what an agent pays attention to in content.
Awareness is about perception: what you notice. PII detection is awareness: you notice an email address in text. Topic classification is awareness: you recognize what a conversation is about. Intent detection is awareness: you understand what someone is trying to do.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Awareness ¶
type Awareness struct {
shield.Entity
ID id.AwarenessID `json:"id" bun:",pk"`
Name string `json:"name" bun:",notnull"`
Description string `json:"description,omitempty"`
AppID string `json:"app_id" bun:",notnull"`
TenantID string `json:"tenant_id,omitempty"`
Focus Focus `json:"focus" bun:",notnull"`
Detectors []Detector `json:"detectors,omitempty" bun:"type:jsonb"`
Action string `json:"action" bun:",notnull"` // "redact", "flag", "block", "vault"
Enabled bool `json:"enabled" bun:",notnull,default:true"`
Metadata map[string]any `json:"metadata,omitempty" bun:"type:jsonb"`
}
Awareness represents what an agent pays attention to in content. Awareness detectors run after instincts and notice patterns, entities, and characteristics in text.
type Detector ¶
type Detector struct {
Name string `json:"name"`
Focus Focus `json:"focus"`
Patterns []string `json:"patterns,omitempty"` // regex patterns for pattern-based detection
Config map[string]any `json:"config,omitempty"`
}
Detector defines a specific awareness detection strategy.
type Focus ¶
type Focus string
Focus defines what type of content an awareness detector looks for.
const ( // FocusPII detects personal identifiable information. FocusPII Focus = "pii" // FocusSecrets detects credentials: API keys, tokens, private keys and // passwords in connection strings or assignments. FocusSecrets Focus = "secrets" // FocusTopic classifies conversation topics. FocusTopic Focus = "topic" // FocusSentiment analyzes emotional tone. FocusSentiment Focus = "sentiment" // FocusIntent classifies user intent. FocusIntent Focus = "intent" // FocusLanguage detects language. FocusLanguage Focus = "language" // FocusCustom is a user-defined focus. FocusCustom Focus = "custom" )
type ListFilter ¶
type ListFilter struct {
AppID string
TenantID string
Focus Focus
Enabled *bool
Limit int
Offset int
}
ListFilter defines filtering options for listing awareness detectors.
type PIIAction ¶
type PIIAction string
PIIAction defines what to do when PII is found.
const ( // PIIActionRedact replaces PII with placeholders. PIIActionRedact PIIAction = "redact" // PIIActionFlag marks content as containing PII. PIIActionFlag PIIAction = "flag" // PIIActionBlock prevents content from passing. PIIActionBlock PIIAction = "block" // PIIActionVault redacts PII exactly as PIIActionRedact does. Shield // stores no token and does not encrypt or keep the original value. PIIActionVault PIIAction = "vault" )
type Store ¶
type Store interface {
CreateAwareness(ctx context.Context, a *Awareness) error
GetAwareness(ctx context.Context, aID id.AwarenessID) (*Awareness, error)
GetAwarenessByName(ctx context.Context, appID, name string) (*Awareness, error)
UpdateAwareness(ctx context.Context, a *Awareness) error
DeleteAwareness(ctx context.Context, aID id.AwarenessID) error
ListAwareness(ctx context.Context, filter *ListFilter) ([]*Awareness, error)
}
Store defines persistence operations for awareness detectors.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package perception holds the deterministic awareness detectors: personal data, secrets and topics, plus the placeholders that redact what they find.
|
Package perception holds the deterministic awareness detectors: personal data, secrets and topics, plus the placeholders that redact what they find. |