judge

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package judge grades an answer with a second agent (LLM-as-judge) through the OpenAI-compatible /v1/chat/completions endpoint. The Run entry point and the verdict parser live in run.go.

Index

Constants

View Source
const DefaultMinScore = 0.7

DefaultMinScore is applied when expect.judge.min_score is unset.

Variables

View Source
var UserAgent = "docsgpt-cli-bench"

UserAgent is sent with judge requests; the CLI stamps its version.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseURL     string
	APIKey      string
	Timeout     time.Duration
	Model       string   // forwarded as the chat request model; "" = "docsgpt" placeholder (agent default)
	Temperature *float64 // forwarded when set (e.g. 0 for deterministic grading)
	RunTag      string   // bench run tag header (see target.BenchTagHeader)
}

Config identifies the judge agent.

type Verdict

type Verdict struct {
	Score     float64 `json:"score"` // 0..1
	Reasoning string  `json:"reasoning"`
}

Verdict is the judge's parsed grading.

func Run

func Run(ctx context.Context, cfg Config, question, answer, rubric string) (*Verdict, error)

Run asks the judge agent to grade answer against rubric for the original question and parses a {"score": ..., "reasoning": ...} JSON verdict from its reply, tolerating markdown fences and surrounding prose. The score is clamped to [0,1]. cfg.Timeout, when > 0, bounds the whole request; ctx cancellation is honored throughout.

Jump to

Keyboard shortcuts

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