@reaatech/llm-judge-types
Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.
Canonical TypeScript types, Zod schemas, and error classes for LLM Judge Toolkit. This package is the single source of truth for all type definitions used throughout the ecosystem.
Installation
npm install @reaatech/llm-judge-types
# or
pnpm add @reaatech/llm-judge-types
Feature Overview
70+ exported types/schemas
11 type files covering judgment/cost/provider/cache/events/types
6 typed error classes
Zero runtime deps beyond zod
Dual ESM/CJS
Quick Start
import {
Judgment,
EvaluationCriteriaSchema,
JudgeError,
LLMProvider,
} from '@reaatech/llm-judge-types' ;
const criteria = EvaluationCriteriaSchema.enum.faithfulness;
function validateScore (score : unknown ) : number {
if ( typeof score !== 'number' || score < 0 || score > 1 ) {
throw new JudgeError ( 'Score must be 0–1' , 'VALIDATION_ERROR' );
}
return score;
}
API Reference
Core Types
Export Description JudgmentFull judgment result (id, score, reasoning, confidence, cost, metadata) JudgmentMetadataPer-judgment metadata (provider, model, duration, retries) ConsensusJudgmentConsensus aggregate across multiple judges ConsensusMethodUnion of consensus methods (majority, mean, weighted, etc.) CostBreakdownToken-level cost breakdown (input/output/total, currency) BudgetBudget configuration for cost tracking
Provider System
Export Description LLMProviderInterface for provider implementations CompletionRequestLLM completion request shape CompletionResponseLLM completion response shape TokenUsageToken usage counts for a completion ModelInfoModel metadata (name, version, capabilities) HealthStatusProvider health check result
Configuration
Export Description ProviderConfigProvider configuration shape EngineConfigEngine configuration (model, temperature, maxTokens, retries) JudgeConfigJudge configuration shape CacheConfigCache configuration shape CriteriaConfigEvaluation criteria configuration
Interfaces
Export Description ConsensusStrategyInterface for consensus aggregation strategies CacheBackendInterface for cache backend implementations EventBusInterface for typed event emission and subscription
Infrastructure Types
Export Description ConfusionMatrixBinary classification confusion matrix CalibrationReportCalibration metrics output PositionBiasScorePer-position bias scoring result PositionBiasReportFull position-bias analysis result JudgmentEventDiscriminated union of judgment lifecycle events
Error Classes
Export Description JudgeErrorBase error class for all judge-related errors ProviderErrorProvider-specific errors (auth, rate limit, timeout, server) ValidationErrorZod validation failures BudgetExceededErrorBudget threshold exceeded TemplateErrorPrompt template build/failure errors CacheErrorCache read/write failures
Related Packages
License
MIT