Documentation
¶
Overview ¶
Package inspect provides the data types, collection logic, and text renderer for the PromptArena configuration inspector. It is shared between the cmd/promptarena CLI and the TUI hub pages.
Index ¶
- func RenderText(data *InspectionData, opts RenderOptions) string
- type CacheInfo
- type CacheStatsData
- type DefaultsInspectData
- type InspectionData
- type JudgeInspectData
- type PersonaInspectData
- type PromptInspectData
- type ProviderInspectData
- type RenderOptions
- type ScenarioInspectData
- type SectionVisibility
- type SelfPlayRoleData
- type ToolInspectData
- type ValidationCheckData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderText ¶
func RenderText(data *InspectionData, opts RenderOptions) string
RenderText renders all inspection sections to a string. opts controls which sections and detail levels are included. It captures stdout so that the lipgloss Print calls are collected into the returned string.
Types ¶
type CacheInfo ¶
type CacheInfo struct {
Size int `json:"size"`
Entries []string `json:"entries,omitempty"`
Hits int `json:"hits,omitempty"`
Misses int `json:"misses,omitempty"`
HitRate float64 `json:"hit_rate,omitempty"`
}
CacheInfo contains information about a specific cache
type CacheStatsData ¶
type CacheStatsData struct {
PromptCache CacheInfo `json:"prompt_cache"`
FragmentCache CacheInfo `json:"fragment_cache"`
SelfPlayCache CacheInfo `json:"self_play_cache,omitempty"`
}
CacheStatsData contains cache statistics
func CollectCacheStats ¶
func CollectCacheStats(cfg *config.Config, verbose bool) *CacheStatsData
CollectCacheStats collects cache statistics from a loaded config. When verbose is true, the Entries fields are populated with individual entry names; otherwise only the Size counts are set.
type DefaultsInspectData ¶
type DefaultsInspectData struct {
Temperature float32 `json:"temperature,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Seed int `json:"seed,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
OutputDir string `json:"output_dir,omitempty"`
OutputFormats []string `json:"output_formats,omitempty"`
}
DefaultsInspectData contains arena defaults
type InspectionData ¶
type InspectionData struct {
ConfigFile string `json:"config_file"`
ArenaName string `json:"arena_name,omitempty"`
PromptConfigs []PromptInspectData `json:"prompt_configs"`
Providers []ProviderInspectData `json:"providers"`
Scenarios []ScenarioInspectData `json:"scenarios"`
Tools []ToolInspectData `json:"tools,omitempty"`
Personas []PersonaInspectData `json:"personas,omitempty"`
Judges []JudgeInspectData `json:"judges,omitempty"`
SelfPlayRoles []SelfPlayRoleData `json:"self_play_roles,omitempty"`
SelfPlayEnabled bool `json:"self_play_enabled"`
AvailableTaskTypes []string `json:"available_task_types"`
Defaults *DefaultsInspectData `json:"defaults,omitempty"`
ValidationPassed bool `json:"validation_passed"`
ValidationError string `json:"validation_error,omitempty"`
ValidationErrors []string `json:"validation_errors,omitempty"`
ValidationWarnings int `json:"validation_warnings"`
ValidationWarningDetails []string `json:"validation_warning_details,omitempty"`
ValidationChecks []ValidationCheckData `json:"validation_checks,omitempty"`
CacheStats *CacheStatsData `json:"cache_stats,omitempty"`
}
InspectionData contains all collected configuration inspection data
func CollectInspectionData ¶
func CollectInspectionData(cfg *config.Config, configFile string) *InspectionData
CollectInspectionData collects all inspection data from a loaded config. It does not collect cache stats; callers that want cache stats should call CollectCacheStats separately and assign the result to data.CacheStats.
type JudgeInspectData ¶
type JudgeInspectData struct {
Name string `json:"name"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
}
JudgeInspectData contains detailed judge configuration info
type PersonaInspectData ¶
type PersonaInspectData struct {
ID string `json:"id"`
File string `json:"file"`
Description string `json:"description,omitempty"`
Goals []string `json:"goals,omitempty"`
RoleID string `json:"role_id,omitempty"` // Self-play role ID using this persona
Provider string `json:"provider,omitempty"` // Provider assigned to this role
}
PersonaInspectData contains detailed persona configuration info
type PromptInspectData ¶
type PromptInspectData struct {
ID string `json:"id"`
File string `json:"file"`
TaskType string `json:"task_type,omitempty"`
Version string `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Variables []string `json:"variables,omitempty"`
VariableValues map[string]string `json:"variable_values,omitempty"`
AllowedTools []string `json:"allowed_tools,omitempty"`
Validators []string `json:"validators,omitempty"`
HasMedia bool `json:"has_media,omitempty"`
}
PromptInspectData contains detailed prompt configuration info
type ProviderInspectData ¶
type ProviderInspectData struct {
ID string `json:"id"`
File string `json:"file"`
Type string `json:"type,omitempty"`
Model string `json:"model,omitempty"`
Group string `json:"group,omitempty"`
Temperature float32 `json:"temperature,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
UsedBy []string `json:"used_by,omitempty"` // What uses this provider (e.g., "judge:quality", "role:user")
}
ProviderInspectData contains detailed provider configuration info
type RenderOptions ¶
type RenderOptions struct {
// Verbose enables per-item detail lines (file contents, variables, etc.)
// that are suppressed in the default non-verbose view.
Verbose bool
// Section restricts output to a single named section (e.g. "providers").
// An empty string means all sections.
Section string
// Stats includes the cache statistics section when CacheStats is non-nil.
Stats bool
}
RenderOptions controls which details are shown in text output. It mirrors the CLI flags --verbose, --section, and --stats.
type ScenarioInspectData ¶
type ScenarioInspectData struct {
ID string `json:"id"`
File string `json:"file"`
TaskType string `json:"task_type,omitempty"`
Description string `json:"description,omitempty"`
Mode string `json:"mode,omitempty"`
TurnCount int `json:"turn_count"`
HasSelfPlay bool `json:"has_self_play,omitempty"`
AssertionCount int `json:"assertion_count,omitempty"`
ConvAssertionCount int `json:"conv_assertion_count,omitempty"`
Providers []string `json:"providers,omitempty"`
Streaming bool `json:"streaming,omitempty"`
}
ScenarioInspectData contains detailed scenario configuration info
type SectionVisibility ¶
type SectionVisibility struct {
All bool
Prompts bool
Providers bool
Scenarios bool
Tools bool
Selfplay bool
Judges bool
Defaults bool
Validation bool
}
SectionVisibility tracks which sections should be displayed
type SelfPlayRoleData ¶
type SelfPlayRoleData struct {
ID string `json:"id"`
Provider string `json:"provider"`
Persona string `json:"persona,omitempty"` // Persona used by this role (from scenarios)
}
SelfPlayRoleData contains detailed self-play role configuration info
type ToolInspectData ¶
type ToolInspectData struct {
Name string `json:"name"`
File string `json:"file"`
Description string `json:"description,omitempty"`
Mode string `json:"mode,omitempty"`
TimeoutMs int `json:"timeout_ms,omitempty"`
InputParams []string `json:"input_params,omitempty"`
HasMockData bool `json:"has_mock_data,omitempty"`
HasHTTPConfig bool `json:"has_http_config,omitempty"`
}
ToolInspectData contains detailed tool configuration info
type ValidationCheckData ¶
type ValidationCheckData struct {
Name string `json:"name"`
Passed bool `json:"passed"`
Warning bool `json:"warning,omitempty"`
Issues []string `json:"issues,omitempty"`
}
ValidationCheckData represents a single validation check result for display
func CollectConnectivityChecks ¶
func CollectConnectivityChecks(data *InspectionData) []ValidationCheckData
CollectConnectivityChecks validates that components are properly connected. This adds additional checks beyond what the validator already provides.