Documentation
¶
Index ¶
- type CLITestCase
- type ContainerConfig
- type ContainerEngine
- type ContainerExecutor
- func (ce *ContainerExecutor) BuildImage(ctx context.Context, imageName string, baseImage string) error
- func (ce *ContainerExecutor) RunCLITest(ctx context.Context, config *ContainerConfig, execPath string, args []string, ...) (*TestResult, error)
- func (ce *ContainerExecutor) RunEval(ctx context.Context, config *ContainerConfig, prompt, modelID, provider string, ...) (*ContainerResult, error)
- type ContainerResult
- type Database
- func (d *Database) AddModel(model *EvalModel) error
- func (d *Database) ClearModelSelection() error
- func (d *Database) Close() error
- func (d *Database) CreateEvalResult(result *EvalResult) error
- func (d *Database) CreateEvalRun(evalID, modelID string) (*EvalRun, error)
- func (d *Database) DeleteModel(modelID string) error
- func (d *Database) GetConfig(key string) (string, error)
- func (d *Database) GetEvalConfig() (*EvalConfig, error)
- func (d *Database) GetEvalResults(runID int64) ([]EvalResult, error)
- func (d *Database) GetEvalRun(id int64) (*EvalRun, error)
- func (d *Database) GetEvalRuns(evalID string) ([]*EvalRun, error)
- func (d *Database) GetEvalStats(evalID string) ([]EvalStats, error)
- func (d *Database) GetModels() ([]*EvalModel, error)
- func (d *Database) GetSelectedModels() ([]*EvalModel, error)
- func (d *Database) SetConfig(key, value string) error
- func (d *Database) SetEvalConfig(config *EvalConfig) error
- func (d *Database) UpdateEvalRunAgentResult(id int64, output string, exitCode int) error
- func (d *Database) UpdateEvalRunStatus(id int64, status string) error
- func (d *Database) UpdateModelSelection(modelID string, selected bool) error
- type EvalConfig
- type EvalDefinition
- type EvalModel
- type EvalResult
- type EvalRun
- type EvalStats
- type Loader
- type Server
- type Service
- func (s *Service) ClearModelSelection() error
- func (s *Service) Close() error
- func (s *Service) DeselectModel(modelID string) error
- func (s *Service) GetConfig() (*EvalConfig, error)
- func (s *Service) GetEval(evalID string) (*EvalDefinition, error)
- func (s *Service) GetEvalResults(runID int64) ([]EvalResult, error)
- func (s *Service) GetEvalRuns(evalID string) ([]*EvalRun, error)
- func (s *Service) GetEvalStats(evalID string) ([]EvalStats, error)
- func (s *Service) GetEvals() (map[string]*EvalDefinition, error)
- func (s *Service) GetModels() ([]*EvalModel, error)
- func (s *Service) GetSelectedModels() ([]*EvalModel, error)
- func (s *Service) RefreshModels() ([]*EvalModel, error)
- func (s *Service) RunEval(evalID string) ([]*EvalRun, error)
- func (s *Service) SelectModel(modelID string) error
- func (s *Service) SetConfig(config *EvalConfig) error
- func (s *Service) SetLogAssistant(enabled bool)
- type TestResult
- type WorkspaceManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLITestCase ¶
type CLITestCase struct {
ID string `json:"id"`
Args []string `json:"args"`
Expected string `json:"expected"`
Description string `json:"description,omitempty"`
Timeout int `json:"timeout,omitempty"` // timeout in seconds, default 30
}
CLITestCase defines a CLI test case
type ContainerConfig ¶
type ContainerConfig struct {
Image string
WorkspaceDir string
Timeout time.Duration
Env map[string]string
}
ContainerConfig holds configuration for container execution
type ContainerEngine ¶
type ContainerEngine string
ContainerEngine represents the detected container runtime
const ( EngineDocker ContainerEngine = "docker" EnginePodman ContainerEngine = "podman" )
type ContainerExecutor ¶
type ContainerExecutor struct {
// contains filtered or unexported fields
}
ContainerExecutor handles Docker/Podman operations
func NewContainerExecutor ¶
func NewContainerExecutor() (*ContainerExecutor, error)
NewContainerExecutor auto-detects available container engine
func (*ContainerExecutor) BuildImage ¶
func (ce *ContainerExecutor) BuildImage(ctx context.Context, imageName string, baseImage string) error
BuildImage builds the scriptschnell image with multi-stage Dockerfile in a temp directory
func (*ContainerExecutor) RunCLITest ¶
func (ce *ContainerExecutor) RunCLITest(ctx context.Context, config *ContainerConfig, execPath string, args []string, timeout time.Duration) (*TestResult, error)
RunCLITest executes a single CLI test case in container
func (*ContainerExecutor) RunEval ¶
func (ce *ContainerExecutor) RunEval(ctx context.Context, config *ContainerConfig, prompt, modelID, provider string, runID int64) (*ContainerResult, error)
RunEval executes eval in container with LLM integration using environment variables
type ContainerResult ¶
ContainerResult holds result of container execution
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database handles SQLite operations for the eval system
func NewDatabase ¶
NewDatabase creates a new database connection
func (*Database) ClearModelSelection ¶
ClearModelSelection clears all model selections
func (*Database) CreateEvalResult ¶
func (d *Database) CreateEvalResult(result *EvalResult) error
CreateEvalResult creates a new eval result
func (*Database) CreateEvalRun ¶
CreateEvalRun creates a new eval run
func (*Database) DeleteModel ¶
DeleteModel removes a model from the database
func (*Database) GetEvalConfig ¶
func (d *Database) GetEvalConfig() (*EvalConfig, error)
GetEvalConfig gets the eval configuration
func (*Database) GetEvalResults ¶
func (d *Database) GetEvalResults(runID int64) ([]EvalResult, error)
GetEvalResults gets all results for a run
func (*Database) GetEvalRun ¶
GetEvalRun gets an eval run by ID
func (*Database) GetEvalRuns ¶
GetEvalRuns gets all eval runs, optionally filtered by eval_id
func (*Database) GetEvalStats ¶
GetEvalStats gets aggregated stats for eval runs
func (*Database) GetSelectedModels ¶
GetSelectedModels gets all selected models
func (*Database) SetEvalConfig ¶
func (d *Database) SetEvalConfig(config *EvalConfig) error
SetEvalConfig sets the eval configuration
func (*Database) UpdateEvalRunAgentResult ¶
UpdateEvalRunAgentResult updates the agent output and exit code
func (*Database) UpdateEvalRunStatus ¶
UpdateEvalRunStatus updates the status of an eval run
type EvalConfig ¶
type EvalConfig struct {
OpenRouterToken string `json:"openrouter_token" db:"openrouter_token"`
}
EvalConfig stores configuration
type EvalDefinition ¶
type EvalDefinition struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image"` // Docker/Podman base image
UserPrompt string `json:"user_prompt"`
ExpectedFiles map[string]string `json:"expected_files"` // path -> content
RunFile string `json:"run_file"` // which file to execute
CLITests []CLITestCase `json:"cli_tests"`
}
EvalDefinition defines an evaluation test case
func LoadEvalDefinition ¶
func LoadEvalDefinition(data []byte) (*EvalDefinition, error)
LoadEvalDefinition loads an eval definition from JSON data
func (*EvalDefinition) Validate ¶
func (e *EvalDefinition) Validate() error
Validate validates the eval definition
type EvalModel ¶
type EvalModel struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Provider string `json:"provider" db:"provider"`
Selected bool `json:"selected" db:"selected"`
Description string `json:"description,omitempty" db:"description"`
ContextWindow int `json:"context_window,omitempty" db:"context_window"`
}
EvalModel represents a model available for evaluation
type EvalResult ¶
type EvalResult struct {
ID int64 `json:"id" db:"id"`
RunID int64 `json:"run_id" db:"run_id"`
TestCaseID string `json:"test_case_id" db:"test_case_id"`
Passed bool `json:"passed" db:"passed"`
ActualOutput string `json:"actual_output" db:"actual_output"`
ExpectedOutput string `json:"expected_output" db:"expected_output"`
Error string `json:"error,omitempty" db:"error"`
InputTokens int `json:"input_tokens" db:"input_tokens"`
OutputTokens int `json:"output_tokens" db:"output_tokens"`
EstimateCost float64 `json:"estimate_cost" db:"estimate_cost"` // in USD
ResponseTime int `json:"response_time_ms" db:"response_time"` // in milliseconds
ExecutionTime int `json:"execution_time_ms" db:"execution_time"` // in milliseconds
ContainerName string `json:"container_name,omitempty" db:"container_name"`
RawOutput string `json:"raw_output,omitempty" db:"raw_output"`
Errors string `json:"errors,omitempty" db:"errors"`
DetailedExecutionInfo string `json:"detailed_execution_info,omitempty" db:"detailed_execution_info"`
}
EvalResult represents the result of a single test case within an eval run
type EvalRun ¶
type EvalRun struct {
ID int64 `json:"id" db:"id"`
EvalID string `json:"eval_id" db:"eval_id"`
ModelID string `json:"model_id" db:"model_id"`
Status string `json:"status" db:"status"` // pending, running, completed, failed
AgentOutput string `json:"agent_output,omitempty" db:"agent_output"`
AgentExitCode int `json:"agent_exit_code,omitempty" db:"agent_exit_code"`
StartedAt time.Time `json:"started_at" db:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty" db:"completed_at"`
}
EvalRun represents a single evaluation run
func (*EvalRun) GetStats ¶
func (r *EvalRun) GetStats(results []EvalResult) EvalStats
GetStats aggregates statistics for an eval run
type EvalStats ¶
type EvalStats struct {
RunID int64 `json:"run_id"`
EvalID string `json:"eval_id"`
ModelID string `json:"model_id"`
Status string `json:"status"`
TotalCount int `json:"total_count"`
PassedCount int `json:"passed_count"`
FailedCount int `json:"failed_count"`
PassRate float64 `json:"pass_rate"`
TotalTokens int `json:"total_tokens"`
TotalCost float64 `json:"total_cost"`
AvgResponseTime int `json:"avg_response_time_ms"`
AvgExecutionTime int `json:"avg_execution_time_ms"`
ResponseTime int `json:"response_time_ms"`
ExecutionTime int `json:"execution_time_ms"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
EvalStats provides aggregated statistics
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads evaluation definitions from JSON files
func (*Loader) ListAvailableEvals ¶
ListAvailableEvals returns a list of available eval IDs
func (*Loader) LoadAll ¶
func (l *Loader) LoadAll() (map[string]*EvalDefinition, error)
LoadAll loads all eval definitions from the eval directory
func (*Loader) LoadEval ¶
func (l *Loader) LoadEval(evalID string) (*EvalDefinition, error)
LoadEval loads a specific eval definition by ID
func (*Loader) ValidateDirectory ¶
ValidateDirectory checks if the eval directory exists and is readable
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides the HTTP interface for the eval web UI
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages the eval system
func NewService ¶
NewService creates a new eval service
func (*Service) ClearModelSelection ¶
ClearModelSelection clears all model selections
func (*Service) DeselectModel ¶
DeselectModel removes a model from selection
func (*Service) GetConfig ¶
func (s *Service) GetConfig() (*EvalConfig, error)
GetConfig gets the current configuration
func (*Service) GetEval ¶
func (s *Service) GetEval(evalID string) (*EvalDefinition, error)
GetEval gets a specific evaluation definition
func (*Service) GetEvalResults ¶
func (s *Service) GetEvalResults(runID int64) ([]EvalResult, error)
GetEvalResults gets results for a specific run
func (*Service) GetEvalRuns ¶
GetEvalRuns gets evaluation runs
func (*Service) GetEvalStats ¶
GetEvalStats gets aggregated statistics
func (*Service) GetEvals ¶
func (s *Service) GetEvals() (map[string]*EvalDefinition, error)
GetEvals gets all available evaluation definitions
func (*Service) GetSelectedModels ¶
GetSelectedModels gets models selected for evaluation
func (*Service) RefreshModels ¶
RefreshModels refreshes the model list from OpenRouter
func (*Service) SelectModel ¶
SelectModel sets a model as selected for evaluation
func (*Service) SetConfig ¶
func (s *Service) SetConfig(config *EvalConfig) error
SetConfig updates the configuration
func (*Service) SetLogAssistant ¶
SetLogAssistant sets whether to log assistant messages to console
type TestResult ¶
TestResult holds result of CLI test execution
type WorkspaceManager ¶
type WorkspaceManager struct {
// contains filtered or unexported fields
}
WorkspaceManager handles temporary workspace creation and cleanup
func NewWorkspaceManager ¶
func NewWorkspaceManager(baseDir string) (*WorkspaceManager, error)
NewWorkspaceManager creates a workspace manager
func (*WorkspaceManager) CleanupWorkspace ¶
func (wm *WorkspaceManager) CleanupWorkspace(workspaceDir string) error
CleanupWorkspace removes a workspace after eval completes
func (*WorkspaceManager) CreateWorkspace ¶
func (wm *WorkspaceManager) CreateWorkspace(runID int64) (string, error)
CreateWorkspace creates a temporary workspace for an eval run
func (*WorkspaceManager) WaitForSignal ¶
func (wm *WorkspaceManager) WaitForSignal(workspaceDir string, timeout time.Duration) error
WaitForSignal waits for .build_done or .build_failed signal file