benchmarks

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package benchmarks owns local dataset evaluations and their frozen reports.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid     = errors.New("benchmark_invalid")
	ErrUnavailable = errors.New("benchmark_unavailable")
	ErrRuntime     = errors.New("benchmark_runtime_unavailable")
	ErrBusy        = errors.New("benchmark_busy")
	ErrNotFound    = errors.New("benchmark_not_found")
	ErrFormat      = errors.New("benchmark_format_unsupported")
)

Functions

func Active

func Active(status string) bool

func PublicError

func PublicError(err error) string

func ValidateBaseURL

func ValidateBaseURL(value string) error

func ValidateConnection

func ValidateConnection(c Connection) error

Types

type Catalog

type Catalog struct {
	SchemaVersion int           `json:"schema_version"`
	Datasets      []Dataset     `json:"datasets"`
	Runtime       RuntimeStatus `json:"runtime"`
}

type Connection

type Connection struct {
	Protocol  domain.Protocol `json:"protocol"`
	Model     string          `json:"model"`
	ChannelID string          `json:"channel_id"`
	BaseURL   string          `json:"base_url"`
	APIKey    string          `json:"api_key"`
}

func (Connection) GoString

func (Connection) GoString() string

func (Connection) String

func (Connection) String() string

type Dataset

type Dataset struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Description      string `json:"description"`
	Category         string `json:"category"`
	SourceURL        string `json:"source_url"`
	DefaultMaxTokens int    `json:"default_max_tokens"`
}

type DatasetDownload

type DatasetDownload struct {
	State       string `json:"state"`
	Bytes       int64  `json:"bytes"`
	Files       int    `json:"files"`
	Samples     int    `json:"samples"`
	InputSHA256 string `json:"input_sha256"`
	CacheSHA256 string `json:"cache_sha256"`
	TaskVersion string `json:"task_version"`
	UpdatedAt   string `json:"updated_at"`
	VerifiedAt  string `json:"verified_at"`
	ErrorCode   string `json:"error_code"`
}

type DatasetInventory

type DatasetInventory struct {
	SchemaVersion int           `json:"schema_version"`
	Datasets      []DatasetItem `json:"datasets"`
	Runtime       RuntimeStatus `json:"runtime"`
}

type DatasetItem

type DatasetItem struct {
	Dataset  Dataset         `json:"dataset"`
	Download DatasetDownload `json:"download"`
}

type DatasetRun

type DatasetRun struct {
	ReportID   string      `json:"report_id"`
	Dataset    Dataset     `json:"dataset"`
	Status     string      `json:"status"`
	Stage      string      `json:"stage"`
	Total      int         `json:"total"`
	Completed  int         `json:"completed"`
	Failed     int         `json:"failed"`
	InFlight   int         `json:"in_flight"`
	Metrics    []Metric    `json:"metrics"`
	Provenance *Provenance `json:"provenance"`
	ErrorCode  string      `json:"error_code"`
	StartedAt  string      `json:"started_at"`
	FinishedAt string      `json:"finished_at"`
}

type DatasetRuntime

type DatasetRuntime interface {
	DatasetKey(string) string
	DownloadDataset(context.Context, string, string, func(DatasetTransfer) error) error
}

DatasetRuntime only prepares registered task data; it receives no model key.

type DatasetTransfer

type DatasetTransfer struct {
	SchemaVersion int    `json:"schema_version"`
	DatasetID     string `json:"dataset_id"`
	Kind          string `json:"kind"`
	Bytes         int64  `json:"bytes"`
	Files         int    `json:"files"`
	Samples       int    `json:"samples"`
	InputSHA256   string `json:"input_sha256"`
	TaskVersion   string `json:"task_version"`
}

type Dependencies

type Dependencies struct {
	Directory      string
	CacheDirectory string
	CatalogJSON    []byte
	Runtime        Runtime
	Resolve        Resolver
	Changed        func()
}

type Event

type Event struct {
	SchemaVersion int         `json:"schema_version"`
	RunID         string      `json:"run_id"`
	ReportID      string      `json:"report_id"`
	Sequence      int         `json:"sequence"`
	Kind          string      `json:"kind"`
	Total         int         `json:"total"`
	Completed     int         `json:"completed"`
	Failed        int         `json:"failed"`
	InFlight      int         `json:"in_flight"`
	Sample        *Sample     `json:"sample"`
	Status        string      `json:"status"`
	Metrics       []Metric    `json:"metrics"`
	Provenance    *Provenance `json:"provenance"`
	Code          string      `json:"code"`
}

type Metric

type Metric struct {
	Scorer string  `json:"scorer"`
	Name   string  `json:"name"`
	Value  float64 `json:"value"`
}

type Options

type Options struct {
	SampleLimit     int      `json:"sample_limit"`
	Epochs          int      `json:"epochs"`
	MaxTokens       int      `json:"max_tokens"`
	Concurrency     int      `json:"concurrency"`
	TimeoutSeconds  int      `json:"timeout_seconds"`
	Temperature     *float64 `json:"temperature"`
	Seed            int      `json:"seed"`
	Stream          bool     `json:"stream"`
	ReasoningEffort string   `json:"reasoning_effort"`
}

func (Options) Validate

func (o Options) Validate() error

type Page

type Page struct {
	SchemaVersion int    `json:"schema_version"`
	Runs          []Run  `json:"runs"`
	NextCursor    string `json:"next_cursor"`
}

type Provenance

type Provenance struct {
	InspectAI       string `json:"inspect_ai"`
	InspectEvals    string `json:"inspect_evals"`
	Task            string `json:"task"`
	TaskVersion     string `json:"task_version"`
	DatasetName     string `json:"dataset_name"`
	DatasetLocation string `json:"dataset_location"`
	InputSHA256     string `json:"input_sha256"`
}

type Report

type Report struct {
	SchemaVersion int        `json:"schema_version"`
	RunID         string     `json:"run_id"`
	Target        Target     `json:"target"`
	Options       Options    `json:"options"`
	Result        DatasetRun `json:"result"`
	Samples       []Sample   `json:"samples"`
	NextCursor    string     `json:"next_cursor"`
}

type ResolvedConnection

type ResolvedConnection struct {
	Target Target
	APIKey []byte
}

func DirectConnection

func DirectConnection(_ context.Context, connection Connection) (ResolvedConnection, error)

type Run

type Run struct {
	SchemaVersion int          `json:"schema_version"`
	ID            string       `json:"id"`
	Target        Target       `json:"target"`
	Options       Options      `json:"options"`
	Status        string       `json:"status"`
	CreatedAt     string       `json:"created_at"`
	FinishedAt    string       `json:"finished_at"`
	Datasets      []DatasetRun `json:"datasets"`
}

type Runtime

type Runtime interface {
	Ready() bool
	Prepare(context.Context) error
	Execute(context.Context, WorkerRequest, func(Event) error) error
}

type RuntimeStatus

type RuntimeStatus struct {
	State     string `json:"state"`
	ErrorCode string `json:"error_code"`
}

type Sample

type Sample struct {
	ID           string  `json:"id"`
	Epoch        int     `json:"epoch"`
	Status       string  `json:"status"`
	Scores       []Score `json:"scores"`
	Input        string  `json:"input"`
	Target       string  `json:"target"`
	Output       string  `json:"output"`
	InputTokens  int64   `json:"input_tokens"`
	OutputTokens int64   `json:"output_tokens"`
	DurationMS   int64   `json:"duration_ms"`
	ErrorCode    string  `json:"error_code"`
}

type Score

type Score struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Answer      string `json:"answer"`
	Explanation string `json:"explanation"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, deps Dependencies) (*Service, error)

func (*Service) Cancel

func (s *Service) Cancel(id string) error

func (*Service) Catalog

func (s *Service) Catalog() Catalog

func (*Service) Close

func (s *Service) Close() error

func (*Service) DatasetInventory

func (s *Service) DatasetInventory() (DatasetInventory, error)

func (*Service) Export

func (s *Service) Export(runID, reportID string) ([]byte, error)

func (*Service) FindReport

func (s *Service) FindReport(ctx context.Context, reportID string) (Run, error)

func (*Service) Get

func (s *Service) Get(id string) (Run, error)

func (*Service) ManageDataset

func (s *Service) ManageDataset(id, action string) (DatasetDownload, error)

func (*Service) Page

func (s *Service) Page(after string) (Page, error)

func (*Service) Prepare

func (s *Service) Prepare() error

func (*Service) Report

func (s *Service) Report(runID, reportID, after string) (Report, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context, command StartCommand) (Run, error)

type StartCommand

type StartCommand struct {
	DatasetIDs []string   `json:"dataset_ids"`
	Connection Connection `json:"connection"`
	Options    Options    `json:"options"`
}

func (StartCommand) GoString

func (StartCommand) GoString() string

func (StartCommand) String

func (StartCommand) String() string

type Target

type Target struct {
	Protocol    domain.Protocol `json:"protocol"`
	Model       string          `json:"model"`
	ChannelID   string          `json:"channel_id"`
	ChannelName string          `json:"channel_name"`
	BaseURL     string          `json:"base_url"`
}

type WorkerRequest

type WorkerRequest struct {
	SchemaVersion int             `json:"schema_version"`
	RunID         string          `json:"run_id"`
	ReportID      string          `json:"report_id"`
	DatasetID     string          `json:"dataset_id"`
	Protocol      domain.Protocol `json:"protocol"`
	Model         string          `json:"model"`
	BaseURL       string          `json:"base_url"`
	APIKey        string          `json:"api_key"`
	Options       Options         `json:"options"`
	LogDir        string          `json:"log_dir"`
	CacheDir      string          `json:"cache_dir,omitempty"`
}

func (WorkerRequest) GoString

func (WorkerRequest) GoString() string

func (WorkerRequest) String

func (WorkerRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL