Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
HumanLabel string // "pass", "review", "fail" — empty = not provided
HumanScore *float64 // 0.0–1.0 — nil = not provided
HumanReason string // free-text explanation from annotator — empty = not provided
}
Annotation holds human-provided ground truth for a single conversation.
type ConfusionMatrixResult ¶
type ConfusionMatrixResult struct {
Labels []string `json:"labels"`
Matrix [][]int `json:"matrix"` // [true][predicted]
}
ConfusionMatrixResult is a 3-class confusion matrix for fail/review/pass.
type ConversationExecutor ¶
type ConversationExecutor interface {
Execute(ctx context.Context, req models.ConversationEvaluationRequest) models.ConversationEvaluationResult
}
ConversationExecutor runs conversation-level evaluation.
type ConversationInputRecord ¶
type ConversationInputRecord struct {
LineNumber int
Request models.ConversationEvaluationRequest
HumanLabel string // optional: "pass", "review", "fail"
HumanScore *float64 // optional: 0.0–1.0
HumanReason string // optional: free-text explanation from annotator
Error error
}
ConversationInputRecord is a single conversation record read from a JSONL input file.
type ConversationProcessor ¶
type ConversationProcessor struct {
// contains filtered or unexported fields
}
ConversationProcessor processes conversation records concurrently.
func NewConversationProcessor ¶
func NewConversationProcessor(exec ConversationExecutor, workers int, logger *zerolog.Logger) *ConversationProcessor
func (*ConversationProcessor) Process ¶
func (p *ConversationProcessor) Process(ctx context.Context, records []ConversationInputRecord) <-chan models.ConversationEvaluationResult
type ConversationReader ¶
type ConversationReader struct {
// contains filtered or unexported fields
}
ConversationReader reads conversation evaluation records from a JSONL file.
func NewConversationReader ¶
func NewConversationReader(file io.Reader, logger *zerolog.Logger) *ConversationReader
func (*ConversationReader) ReadAll ¶
func (r *ConversationReader) ReadAll(ctx context.Context) <-chan ConversationInputRecord
type ConversationSummaryStats ¶
type ConversationSummaryStats struct {
Total int `json:"total"`
VerdictCounts map[string]int `json:"verdict_counts"`
CorrelationReport *CorrelationReport `json:"correlation_report,omitempty"`
}
ConversationSummaryStats holds aggregate statistics for a batch of conversation evaluations.
type ConversationSummaryWriter ¶
type ConversationSummaryWriter struct {
// contains filtered or unexported fields
}
ConversationSummaryWriter accumulates conversation evaluation results and writes aggregate stats.
func NewConversationSummaryWriter ¶
func NewConversationSummaryWriter(output io.Writer, logger *zerolog.Logger) *ConversationSummaryWriter
func (*ConversationSummaryWriter) Close ¶
func (w *ConversationSummaryWriter) Close() error
func (*ConversationSummaryWriter) SetCorrelationReport ¶
func (w *ConversationSummaryWriter) SetCorrelationReport(r *CorrelationReport)
SetCorrelationReport attaches a pre-computed correlation report to be included in the summary output.
func (*ConversationSummaryWriter) Write ¶
func (w *ConversationSummaryWriter) Write(result models.ConversationEvaluationResult) error
type CorrelationReport ¶
type CorrelationReport struct {
AnnotatedCount int `json:"annotated_count"`
KendallTau *float64 `json:"kendall_tau,omitempty"`
WeightedKappa *float64 `json:"weighted_kappa,omitempty"`
ConfusionMatrix *ConfusionMatrixResult `json:"confusion_matrix,omitempty"`
Disagreements []DisagreementEntry `json:"disagreements,omitempty"`
}
CorrelationReport holds all computed correlation metrics.
func ComputeCorrelationReport ¶
func ComputeCorrelationReport(results []models.ConversationEvaluationResult, annotations map[string]Annotation) CorrelationReport
ComputeCorrelationReport joins results with annotations by ConversationID and computes correlation metrics between Themis scores/verdicts and human-provided ground truth.
type DisagreementEntry ¶
type DisagreementEntry struct {
ConversationID string `json:"conversation_id"`
HumanLabel string `json:"human_label"`
ThemisLabel string `json:"themis_label"`
HumanScore *float64 `json:"human_score,omitempty"`
ThemisScore float64 `json:"themis_score"`
}
DisagreementEntry records a single per-conversation label mismatch between the human annotator and Themis.