Documentation
¶
Index ¶
- Variables
- type ArenaConversationState
- type ArenaStateStore
- func (s *ArenaStateStore) Delete(ctx context.Context, conversationID string) error
- func (s *ArenaStateStore) DumpToJSON(ctx context.Context, conversationID string) ([]byte, error)
- func (s *ArenaStateStore) Fork(ctx context.Context, sourceID, newID string) error
- func (s *ArenaStateStore) GetArenaState(ctx context.Context, conversationID string) (*ArenaConversationState, error)
- func (s *ArenaStateStore) GetResult(ctx context.Context, runID string) (*RunResult, error)
- func (s *ArenaStateStore) GetRunResult(ctx context.Context, runID string) (*RunResult, error)
- func (s *ArenaStateStore) ListRunIDs(ctx context.Context) ([]string, error)
- func (s *ArenaStateStore) Load(ctx context.Context, conversationID string) (*runtimestore.ConversationState, error)
- func (s *ArenaStateStore) Save(ctx context.Context, state *runtimestore.ConversationState) error
- func (s *ArenaStateStore) SaveMetadata(ctx context.Context, conversationID string, metadata *RunMetadata) error
- func (s *ArenaStateStore) SaveRunMetadata(ctx context.Context, conversationID string, metadata *RunMetadata) error
- func (s *ArenaStateStore) SaveWithTrace(ctx context.Context, state *runtimestore.ConversationState, ...) error
- func (s *ArenaStateStore) UpdateLastAssistantMessage(msg *types.Message)
- type AssertionsSummary
- type ConversationValidationResult
- type Feedback
- type MediaOutput
- type RunMetadata
- type RunResult
- type SelfPlayRoleInfo
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = runtimestore.ErrNotFound
ErrNotFound is re-exported from runtime statestore
Functions ¶
This section is empty.
Types ¶
type ArenaConversationState ¶
type ArenaConversationState struct {
runtimestore.ConversationState // Embed standard state
// Arena-specific run metadata
RunMetadata *RunMetadata `json:"run_metadata,omitempty"`
}
ArenaConversationState extends runtimestore.ConversationState with Arena-specific telemetry All telemetry is computed on-demand from the messages to avoid redundancy
type ArenaStateStore ¶
type ArenaStateStore struct {
// contains filtered or unexported fields
}
ArenaStateStore is an in-memory state store with Arena-specific telemetry
func NewArenaStateStore ¶
func NewArenaStateStore() *ArenaStateStore
NewArenaStateStore creates a new Arena state store
func (*ArenaStateStore) Delete ¶
func (s *ArenaStateStore) Delete(ctx context.Context, conversationID string) error
Delete removes conversation state
func (*ArenaStateStore) DumpToJSON ¶
DumpToJSON exports the arena state in the same format as Arena results
func (*ArenaStateStore) Fork ¶ added in v1.1.6
func (s *ArenaStateStore) Fork(ctx context.Context, sourceID, newID string) error
Fork creates a copy of the state with a new session ID This is a no-op for the arena state store as forking is handled at the pipeline level NOSONAR: Intentionally empty - forking is handled at the pipeline level
func (*ArenaStateStore) GetArenaState ¶
func (s *ArenaStateStore) GetArenaState(ctx context.Context, conversationID string) (*ArenaConversationState, error)
GetArenaState retrieves the full Arena state including telemetry
func (*ArenaStateStore) GetResult ¶
GetResult reconstructs a complete RunResult from stored state This replaces the need to return RunResult from executeRun
func (*ArenaStateStore) GetRunResult ¶
GetRunResult is deprecated: use GetResult instead Kept for backwards compatibility
func (*ArenaStateStore) ListRunIDs ¶
func (s *ArenaStateStore) ListRunIDs(ctx context.Context) ([]string, error)
ListRunIDs returns all stored run IDs (for batch operations)
func (*ArenaStateStore) Load ¶
func (s *ArenaStateStore) Load(ctx context.Context, conversationID string) (*runtimestore.ConversationState, error)
Load retrieves conversation state (implements Store interface)
func (*ArenaStateStore) Save ¶
func (s *ArenaStateStore) Save(ctx context.Context, state *runtimestore.ConversationState) error
Save stores conversation state (implements Store interface) For Arena, this extracts trace data from metadata if present
func (*ArenaStateStore) SaveMetadata ¶
func (s *ArenaStateStore) SaveMetadata(ctx context.Context, conversationID string, metadata *RunMetadata) error
SaveMetadata stores Arena-specific metadata for a run ConversationID should equal RunID for Arena executions
func (*ArenaStateStore) SaveRunMetadata ¶
func (s *ArenaStateStore) SaveRunMetadata(ctx context.Context, conversationID string, metadata *RunMetadata) error
SaveRunMetadata is deprecated: use SaveMetadata instead Kept for backwards compatibility
func (*ArenaStateStore) SaveWithTrace ¶
func (s *ArenaStateStore) SaveWithTrace( ctx context.Context, state *runtimestore.ConversationState, trace *pipeline.ExecutionTrace, ) error
SaveWithTrace stores conversation state with execution trace (Arena-specific method) This is called by ArenaStateStoreSaveMiddleware to directly pass the trace. LLM call traces (_llm_trace) are always attached to messages when trace data is available.
func (*ArenaStateStore) UpdateLastAssistantMessage ¶ added in v1.1.6
func (s *ArenaStateStore) UpdateLastAssistantMessage(msg *types.Message)
UpdateLastAssistantMessage updates the metadata of the last assistant message. This is used by duplex mode to attach assertion results to messages after evaluation.
type AssertionsSummary ¶ added in v1.1.3
type AssertionsSummary struct {
Failed int `json:"failed"`
Passed bool `json:"passed"`
Results []ConversationValidationResult `json:"results"`
Total int `json:"total"`
}
AssertionsSummary mirrors the turn-level assertions structure
type ConversationValidationResult ¶ added in v1.1.3
type ConversationValidationResult = assertions.ConversationValidationResult
ConversationValidationResult is an alias for assertions.ConversationValidationResult to avoid import cycles and maintain clean separation between statestore and assertions.
type Feedback ¶
type Feedback struct {
ConversationID string `json:"conversation_id"`
UserID string `json:"user_id"`
Rating int `json:"rating"`
Comments string `json:"comments"`
Categories map[string]interface{} `json:"categories"`
Timestamp time.Time `json:"timestamp"`
Tags []string `json:"tags"`
}
Feedback represents user feedback on conversation results This is a placeholder for future optimization features (v0.3.0)
type MediaOutput ¶ added in v1.1.0
type MediaOutput struct {
Type string `json:"Type"` // "image", "audio", "video"
MIMEType string `json:"MIMEType"` // e.g., "image/png", "audio/wav"
SizeBytes int64 `json:"SizeBytes"` // Size in bytes
Duration *int `json:"Duration"` // Duration in seconds for audio/video
Width *int `json:"Width"` // Width in pixels for images/video
Height *int `json:"Height"` // Height in pixels for images/video
FilePath string `json:"FilePath"` // Path to the media file if available
Thumbnail string `json:"Thumbnail"` // Base64-encoded thumbnail for images
MessageIdx int `json:"MessageIdx"` // Index of the message containing this media
PartIdx int `json:"PartIdx"` // Index of the part within the message
}
MediaOutput represents media content produced during a run
type RunMetadata ¶
type RunMetadata struct {
RunID string `json:"run_id"`
PromptPack string `json:"prompt_pack,omitempty"`
Region string `json:"region"`
ScenarioID string `json:"scenario_id"`
ProviderID string `json:"provider_id"`
Params map[string]interface{} `json:"params,omitempty"`
Commit map[string]interface{} `json:"commit,omitempty"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
// Self-play metadata
SelfPlay bool `json:"self_play,omitempty"`
PersonaID string `json:"persona_id,omitempty"`
AssistantRole *SelfPlayRoleInfo `json:"assistant_role,omitempty"`
UserRole *SelfPlayRoleInfo `json:"user_role,omitempty"`
// Optimizer/feedback metadata
UserFeedback *Feedback `json:"user_feedback,omitempty"`
SessionTags []string `json:"session_tags,omitempty"`
// Session recording path (if recording is enabled)
RecordingPath string `json:"recording_path,omitempty"`
// Conversation-level assertions (evaluated after conversation completes)
ConversationAssertionResults []ConversationValidationResult `json:"conv_assertions_results,omitempty"`
}
RunMetadata contains Arena-specific execution metadata
type RunResult ¶
type RunResult struct {
RunID string `json:"RunID"`
PromptPack string `json:"PromptPack"`
Region string `json:"Region"`
ScenarioID string `json:"ScenarioID"`
ProviderID string `json:"ProviderID"`
Params map[string]interface{} `json:"Params"`
Messages []types.Message `json:"Messages"`
Commit map[string]interface{} `json:"Commit"`
Cost types.CostInfo `json:"Cost"`
ToolStats *types.ToolStats `json:"ToolStats"`
Violations []types.ValidationError `json:"Violations"`
StartTime time.Time `json:"StartTime"`
EndTime time.Time `json:"EndTime"`
Duration time.Duration `json:"Duration"`
Error string `json:"Error"`
SelfPlay bool `json:"SelfPlay"`
PersonaID string `json:"PersonaID"`
MediaOutputs []MediaOutput `json:"MediaOutputs"` // Media produced during the run
UserFeedback *Feedback `json:"UserFeedback"`
SessionTags []string `json:"SessionTags"`
AssistantRole interface{} `json:"AssistantRole"` // Using interface{} to avoid circular import
UserRole interface{} `json:"UserRole"`
// Session recording path (if recording is enabled)
RecordingPath string `json:"RecordingPath,omitempty"`
// Conversation-level assertions evaluated after the conversation completes (summary format)
ConversationAssertions AssertionsSummary `json:"conversation_assertions,omitempty"`
}
RunResult represents the full result structure for JSON compatibility This type mirrors engine.RunResult to avoid circular dependencies
type SelfPlayRoleInfo ¶
type SelfPlayRoleInfo struct {
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Region string `json:"region,omitempty"`
}
SelfPlayRoleInfo contains provider information for self-play roles
type ValidationResult ¶
type ValidationResult struct {
TurnIndex int `json:"turn_index"`
Timestamp time.Time `json:"timestamp"`
ValidatorType string `json:"validator_type"`
Passed bool `json:"passed"`
Details map[string]interface{} `json:"details,omitempty"`
}
ValidationResult captures validation outcome for a turn