Skip to main content

Crate llmtrace_core

Crate llmtrace_core 

Source
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§

AgentAction
A single agent action captured during or after an LLM interaction.
AgentCostCap
Per-agent cost cap override.
AlertChannelConfig
Configuration for a single alert channel.
AlertConfig
Alert engine configuration for webhook notifications.
AlertEscalationConfig
Optional alert escalation configuration.
AnalysisContext
Analysis context for security analyzers.
AnomalyDetectionConfig
Anomaly detection configuration.
ApiKeyRecord
A stored API key record (the plaintext key is never persisted).
AuditEvent
An audit log entry recording a tenant-scoped action.
AuditQuery
Query parameters for filtering audit events.
AuthConfig
Authentication and RBAC configuration.
AuthContext
Authenticated context injected by the auth middleware.
BudgetCap
A USD budget cap for a given time window.
CategoryEnforcement
Per-category enforcement override.
CircuitBreakerConfig
Circuit breaker configuration.
ComplianceReportRecord
A stored compliance report record for persistence.
CostCapConfig
Top-level cost cap configuration section within ProxyConfig.
CostEstimationConfig
Cost estimation configuration.
EnforcementConfig
Security enforcement configuration.
GrpcConfig
gRPC ingestion gateway configuration.
HealthCheckConfig
Health check configuration.
LoggingConfig
Logging configuration.
ModelPricingConfig
Pricing for a single model (per 1 million tokens).
OtelIngestConfig
OpenTelemetry OTLP ingestion configuration.
OutputSafetyConfig
Output safety configuration for response content analysis.
PiiConfig
PII detection and redaction configuration.
ProxyConfig
Configuration for the transparent proxy.
RateLimitConfig
Rate limiting configuration.
ReportQuery
Query parameters for listing compliance reports.
SecurityAnalysisConfig
Security analysis configuration for ML-based prompt injection detection.
SecurityFinding
A security finding detected during analysis.
ShutdownConfig
Graceful shutdown configuration.
SpanEvent
An event that occurred during a span.
Storage
Composite storage that wires together the three repository concerns.
StorageConfig
Storage configuration section within ProxyConfig.
StorageStats
Storage statistics for a tenant.
StreamingAnalysisConfig
Configuration for real-time streaming security analysis.
Tenant
A tenant in the system.
TenantConfig
Per-tenant configuration for security thresholds and feature flags.
TenantId
Unique identifier for a tenant.
TenantRateLimitOverride
Per-tenant rate limit override.
TokenCap
Per-request token caps.
TraceEvent
A complete trace event representing an LLM interaction.
TraceQuery
Query parameters for filtering traces.
TraceSpan
A single span within a trace representing a portion of an LLM interaction.

Enums§

AgentActionType
Type of agent action observed during an LLM interaction.
AnalysisDepth
Analysis depth for enforcement.
AnomalyType
Type of anomaly detected.
ApiKeyRole
Role for API key-based access control.
BudgetWindow
Time window for budget enforcement.
EnforcementMode
Enforcement mode for the proxy.
LLMProvider
Supported LLM providers.
LLMTraceError
Core error types.
MonitoringScope
Controls which parts of an LLM interaction are stored/queried for a tenant.
OperatingPoint
Pre-defined operating points that balance precision against recall.
PiiAction
Action to take when PII is detected in request or response content.
SecuritySeverity
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§

CacheLayer
Cache layer for hot queries and sessions.
MetadataRepository
Repository for metadata (tenants, configs, audit events).
SecurityAnalyzer
Trait for security analyzers.
TraceRepository
Repository for trace and span storage (analytical, high-volume data).

Functions§

is_auxiliary_finding_type
Returns true if 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>.