Expand description
Core types, traits, and errors for LLMTrace
This crate contains foundational types and traits shared across all LLMTrace components. It provides the core data structures for representing traces, security findings, and storage/analysis interfaces.
Structs§
- Agent
Action - A single agent action captured during or after an LLM interaction.
- Agent
Cost Cap - Per-agent cost cap override.
- Alert
Channel Config - Configuration for a single alert channel.
- Alert
Config - Alert engine configuration for webhook notifications.
- Alert
Escalation Config - Optional alert escalation configuration.
- Analysis
Context - Analysis context for security analyzers.
- Anomaly
Detection Config - Anomaly detection configuration.
- ApiKey
Record - A stored API key record (the plaintext key is never persisted).
- Audit
Event - An audit log entry recording a tenant-scoped action.
- Audit
Query - Query parameters for filtering audit events.
- Auth
Config - Authentication and RBAC configuration.
- Auth
Context - Authenticated context injected by the auth middleware.
- Budget
Cap - A USD budget cap for a given time window.
- Category
Enforcement - Per-category enforcement override.
- Circuit
Breaker Config - Circuit breaker configuration.
- Compliance
Report Record - A stored compliance report record for persistence.
- Cost
CapConfig - Top-level cost cap configuration section within
ProxyConfig. - Cost
Estimation Config - Cost estimation configuration.
- Enforcement
Config - Security enforcement configuration.
- Grpc
Config - gRPC ingestion gateway configuration.
- Health
Check Config - Health check configuration.
- Logging
Config - Logging configuration.
- Model
Pricing Config - Pricing for a single model (per 1 million tokens).
- Otel
Ingest Config - OpenTelemetry OTLP ingestion configuration.
- Output
Safety Config - Output safety configuration for response content analysis.
- PiiConfig
- PII detection and redaction configuration.
- Proxy
Config - Configuration for the transparent proxy.
- Rate
Limit Config - Rate limiting configuration.
- Report
Query - Query parameters for listing compliance reports.
- Security
Analysis Config - Security analysis configuration for ML-based prompt injection detection.
- Security
Finding - A security finding detected during analysis.
- Shutdown
Config - Graceful shutdown configuration.
- Span
Event - An event that occurred during a span.
- Storage
- Composite storage that wires together the three repository concerns.
- Storage
Config - Storage configuration section within
ProxyConfig. - Storage
Stats - Storage statistics for a tenant.
- Streaming
Analysis Config - Configuration for real-time streaming security analysis.
- Tenant
- A tenant in the system.
- Tenant
Config - Per-tenant configuration for security thresholds and feature flags.
- Tenant
Id - Unique identifier for a tenant.
- Tenant
Rate Limit Override - Per-tenant rate limit override.
- Token
Cap - Per-request token caps.
- Trace
Event - A complete trace event representing an LLM interaction.
- Trace
Query - Query parameters for filtering traces.
- Trace
Span - A single span within a trace representing a portion of an LLM interaction.
Enums§
- Agent
Action Type - Type of agent action observed during an LLM interaction.
- Analysis
Depth - Analysis depth for enforcement.
- Anomaly
Type - Type of anomaly detected.
- ApiKey
Role - Role for API key-based access control.
- Budget
Window - Time window for budget enforcement.
- Enforcement
Mode - Enforcement mode for the proxy.
- LLMProvider
- Supported LLM providers.
- LLMTrace
Error - Core error types.
- Monitoring
Scope - Controls which parts of an LLM interaction are stored/queried for a tenant.
- Operating
Point - Pre-defined operating points that balance precision against recall.
- PiiAction
- Action to take when PII is detected in request or response content.
- Security
Severity - Severity level for security findings.
Constants§
- AGENT_
ACTION_ RESULT_ MAX_ BYTES - Maximum size in bytes for captured action results (stdout, response bodies, etc.).
- VOTING_
MAJORITY - Value indicating a finding was confirmed by multiple detectors.
- VOTING_
RESULT_ KEY - Metadata key for ensemble voting result (“majority” or “single_detector”).
- VOTING_
SINGLE_ DETECTOR - Value indicating a finding came from a single detector only.
Traits§
- Cache
Layer - Cache layer for hot queries and sessions.
- Metadata
Repository - Repository for metadata (tenants, configs, audit events).
- Security
Analyzer - Trait for security analyzers.
- Trace
Repository - Repository for trace and span storage (analytical, high-volume data).
Functions§
- is_
auxiliary_ finding_ type - Returns
trueif a finding type is auxiliary (informational, not a direct injection/attack indicator). Auxiliary findings should not drive the security score above the flagging threshold on their own.
Type Aliases§
- Result
- Convenience alias for
std::result::Result<T, LLMTraceError>.