How braintrustdata/autoevals works
Autoevals is a TypeScript and Python library for evaluating AI outputs. A caller supplies an output and optionally an expected answer and context; a selected scorer performs heuristic, statistical, embedding-based, LLM-judge, moderation, or RAG evaluation and returns a structured score with optional metadata. The implementations expose comparable scorer and client-configuration capabilities in both languages. OpenAI-compatible clients provide model and embedding requests; Braintrust logging is optional. Some connections below are documented capabilities because the relevant source was not excerpted.
Main entry points: index.ts TypeScript exports · __init__.py Python exports · llm.py LLM judges · llm.ts LLM judges
Components 23
TypeScript evaluators
- TypeScript exports
js/index.ts - LLM judges
js/llm.ts - RAG metrics
js/ragas.ts - Text scorers
js/string.ts - List scorers
js/list.ts - JSON scorers
js/json.ts - Moderation
js/moderation.ts - Judge prompts
js/templates.ts
Python evaluators
- Python exports
py/autoevals/__init__.py - LLM judges
py/autoevals/llm.py - RAG metrics
py/autoevals/ragas.py - Text scorers
py/autoevals/string.py - List scorers
py/autoevals/list.py - JSON scorers
py/autoevals/json.py - Moderation
py/autoevals/moderation.py
Model clients
- OpenAI adapter
js/oai.ts - OpenAI adapter
py/autoevals/oai.py
Scoring foundations
- Score contract
js/score.ts - Score contract
py/autoevals/score.py - Partial scorer helper
js/partial.ts - Partial scorer helper
py/autoevals/partial.py
Other components
- Library caller
- Braintrust logging
Connections 31
- Library caller → TypeScript exports: calls
- Library caller → Python exports: calls
- TypeScript exports → LLM judges: exports
js/index.ts - TypeScript exports → RAG metrics: exports
js/index.ts - TypeScript exports → Text scorers: exports
js/index.ts - TypeScript exports → List scorers: exports
js/index.ts - TypeScript exports → JSON scorers: exports
js/index.ts - TypeScript exports → Moderation: exports
js/index.ts - LLM judges → OpenAI adapter: requests completions
js/llm.ts - LLM judges → Judge prompts: renders prompts
js/llm.ts - LLM judges → Score contract: returns score
js/llm.ts - Text scorers → OpenAI adapter: requests embeddings
js/string.ts - RAG metrics → List scorers: uses list scorer
js/ragas.ts - RAG metrics → Text scorers: uses similarity
js/ragas.ts - RAG metrics → OpenAI adapter: gets model
js/ragas.ts - Python exports → LLM judges: exports
py/autoevals/__init__.py - Python exports → RAG metrics: exports
py/autoevals/__init__.py - Python exports → Text scorers: exports
py/autoevals/__init__.py - Python exports → List scorers: exports
py/autoevals/__init__.py - Python exports → JSON scorers: exports
py/autoevals/__init__.py - Python exports → Moderation: exports
py/autoevals/__init__.py - LLM judges → OpenAI adapter: requests completions
py/autoevals/llm.py - LLM judges → Score contract: returns score
py/autoevals/score.py - Text scorers → OpenAI adapter: requests embeddings
py/autoevals/string.py - RAG metrics → LLM judges: uses judge
py/autoevals/ragas.py - RAG metrics → Text scorers: uses similarity
py/autoevals/ragas.py - RAG metrics → List scorers: uses list scorer
py/autoevals/ragas.py - TypeScript exports → Partial scorer helper: exports
js/index.ts - LLM judges → Partial scorer helper: uses partial scorer
py/autoevals/llm.py - OpenAI adapter → Braintrust logging: optional logging
- OpenAI adapter → Braintrust logging: optional logging