Documentation
¶
Index ¶
- Constants
- func LLMRubricT(e *EvalT, rubric, output string)
- func LLMRubricsT(e *EvalT, rubrics []string, output string)
- func NumEvalsOrSkip(t *testing.T) int
- func RecordScore(e *EvalT, result *EvalResult)
- func Run(t *testing.T, name string, f func(e *EvalT))
- type Eval
- type EvalLogLine
- type EvalResult
- type EvalT
- type RoleUsage
- type RubricResult
- type ThreadExport
- type TrialUsage
Constants ¶
const ( DefaultOpenAIModel = "gpt-6.1-terra" DefaultAnthropicModel = "claude-sonnet-5-5" // DefaultAzureModel is the deployment name in the CI Azure OpenAI resource. DefaultAzureModel = "gpt-6.1-sol" DefaultMistralModel = "mistral-large-latest" DefaultBedrockModel = "global.anthropic.claude-sonnet-5-5" DefaultCohereModel = "command-a-plus-05-2026" // DefaultGraderModel is pinned separately from DefaultOpenAIModel so that // bumping the model under test does not silently change the judge. DefaultGraderModel = "gpt-6-luna" )
Default models for each provider. Update these when bumping model versions.
Variables ¶
This section is empty.
Functions ¶
func LLMRubricT ¶
LLMRubricT grades output against a single rubric and records the result.
func LLMRubricsT ¶ added in v2.14.0
LLMRubricsT grades output against every rubric in one grader request and records a result for each rubric.
func NumEvalsOrSkip ¶
func RecordScore ¶
func RecordScore(e *EvalT, result *EvalResult)
RecordScore records the score of an eval in a JSONL file.
Types ¶
type Eval ¶
type Eval struct {
LLM llm.LanguageModel
GraderLLM llm.LanguageModel
Prompts *llm.Prompts
Provider string
Model string
GraderModel string
// contains filtered or unexported fields
}
func NewEvalWithProvider ¶
NewEvalWithProvider creates an Eval instance with a specific provider
func (*Eval) LLMRubric ¶
func (e *Eval) LLMRubric(rubric, output string) (*RubricResult, error)
LLMRubric grades output against a single rubric.
func (*Eval) LLMRubrics ¶ added in v2.14.0
func (e *Eval) LLMRubrics(rubrics []string, output string) ([]RubricResult, error)
LLMRubrics grades output against every rubric in a single grader request, so the output is sent once rather than once per rubric. Results are in the order of rubrics.
type EvalLogLine ¶
type EvalLogLine struct {
Name string `json:"name"`
Package string `json:"package,omitempty"`
Timestamp string `json:"timestamp"`
RunNumber int `json:"run_number"`
Rubric string `json:"rubric"`
Output string `json:"output"`
Reasoning string `json:"reasoning"`
Score float64 `json:"score"`
Pass bool `json:"pass"`
// Error is set when the run failed before any rubric could be graded,
// for example because the provider rejected the request.
Error string `json:"error,omitempty"`
// Usage is the token usage of the whole trial, set on its last line.
Usage *TrialUsage `json:"usage,omitempty"`
}
type EvalResult ¶
type RoleUsage ¶ added in v2.14.0
type RoleUsage struct {
Model string `json:"model,omitempty"`
Calls int `json:"calls"`
InputTokens int64 `json:"input_tokens"`
CachedReadTokens int64 `json:"cached_read_tokens,omitempty"`
CachedWriteTokens int64 `json:"cached_write_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens"`
ReasoningTokens int64 `json:"reasoning_tokens,omitempty"`
CostUSD float64 `json:"cost_usd,omitempty"`
}
RoleUsage is the token usage of one role (model under test or grader) in a trial, with its list-price cost when the model's price is known.
type RubricResult ¶
type ThreadExport ¶
type ThreadExport struct {
Posts map[string]*model.Post `json:"posts"`
Channel *model.Channel `json:"channel"`
Team *model.Team `json:"team"`
Users map[string]*model.User `json:"users"`
FileInfos map[string]*model.FileInfo `json:"file_infos"`
Files map[string][]byte `json:"files"`
// Helper fields not in the JSON
RootPost *model.Post `json:"-"`
PostList *model.PostList `json:"-"`
}
ThreadExport represents the format of exported thread data
func LoadThreadFromJSON ¶
func LoadThreadFromJSON(t *EvalT, path string) *ThreadExport
LoadThreadFromJSON loads post data from a JSON file containing exported Mattermost thread data and returns it as ThreadData containing Posts, RootPost, and PostList for testing
func (*ThreadExport) BotUser ¶ added in v2.11.0
func (t *ThreadExport) BotUser() *model.User
BotUser returns the first bot user in the export, or nil if there is none.
func (*ThreadExport) LatestPost ¶
func (t *ThreadExport) LatestPost() *model.Post
func (*ThreadExport) RequestingUser ¶
func (t *ThreadExport) RequestingUser() *model.User
func (*ThreadExport) String ¶
func (t *ThreadExport) String() string
type TrialUsage ¶ added in v2.14.0
TrialUsage is the token usage of one trial of an eval.