deepeval README

The project's README from github.com/confident-ai/deepeval. As one markdown file: README.md.

DeepEval.

The LLM Evaluation Framework

confident-ai%2Fdeepeval | Trendshift

discord-invite reddit-community

Documentation | Metrics and Features | Getting Started | Integrations | Confident AI

GitHub release Try Quickstart in Colab License Twitter Follow

Deutsch | Español | français | 日本語 | 한국어 | Português | Русский | 中文

DeepEval is a simple-to-use, open-source LLM evaluation framework, for evaluating large-language model systems. It is similar to Pytest but specialized for unit testing LLM apps. DeepEval incorporates the latest research to run evals via metrics such as G-Eval, task completion, answer relevancy, hallucination, etc., which use LLM-as-a-judge and other NLP models that run locally on your machine.

Whether you're building AI agents, RAG pipelines, or chatbots, implemented via LangChain or OpenAI, DeepEval has you covered. With it, you can easily evaluate:

Use these evaluations to determine the optimal models, prompts, and architecture to improve your AI quality, prevent prompt drifting, or even transition from OpenAI to Claude with confidence.

[!IMPORTANT] Want to compare iterations, share evaluation reports, and monitor your AI in production? Sign up for Confident AI, the enterprise AI evals and observability platform.

Demo GIF

Want to talk LLM evaluation, need help picking metrics, or just to say hi? Come join our discord.


🔥 Metrics and Features


🔌 Integrations

DeepEval plugs into any LLM framework — OpenAI Agents, LangChain, CrewAI, and more. For enterprise teams standardizing evals and observability across the organization, Confident AI provides a native DeepEval integration.

Frameworks

☁️ Platform + Ecosystem

Confident AI is the enterprise AI evals and observability platform. It gives organizations one consistent standard across product teams, integrates natively with DeepEval, and remains model- and framework-agnostic.

Confident AI MCP Architecture


🤖 Vibe-Coder QuickStart

Want your coding agent to add evals and fix failures for you? Install the DeepEval skill, point it at your agent, RAG pipeline, or chatbot, and ask it to generate a dataset, write the eval suite, run deepeval test run, and iterate on the failing metrics.

Start with the 5-minute vibe-coder guide.


🚀 Human QuickStart

Let's pretend your LLM application is a RAG based customer support chatbot; here's how DeepEval can help test what you've built.

Installation

Deepeval works with Python>=3.9+.

pip install -U deepeval

Using the deepeval platform will allow you to generate sharable testing reports on the cloud. It is free, takes no additional code to setup, and we highly recommend giving it a try.

To login, run:

deepeval login

Follow the instructions in the CLI to create an account, copy your API key, and paste it into the CLI. All test cases will automatically be logged (find more information on data privacy here).

Write your first test case

Create a test file:

touch test_chatbot.py

Open test_chatbot.py and write your first test case to run an end-to-end evaluation using DeepEval, which treats your LLM app as a black-box:

import pytest
from deepeval import assert_test
from deepeval.metrics import GEval
from deepeval.test_case import LLMTestCase, SingleTurnParams

def test_case():
    correctness_metric = GEval(
        name="Correctness",
        criteria="Determine if the 'actual output' is correct based on the 'expected output'.",
        evaluation_params=[SingleTurnParams.ACTUAL_OUTPUT, SingleTurnParams.EXPECTED_OUTPUT],
        threshold=0.5
    )
    test_case = LLMTestCase(
        input="What if these shoes don't fit?",
        # Replace this with the actual output from your LLM application
        actual_output="You have 30 days to get a full refund at no extra cost.",
        expected_output="We offer a 30-day full refund at no extra costs.",
        retrieval_context=["All customers are eligible for a 30 day full refund at no extra costs."]
    )
    assert_test(test_case, [correctness_metric])

Set your OPENAI_API_KEY as an environment variable (you can also evaluate using your own custom model, for more details visit this part of our docs):

export OPENAI_API_KEY="..."

And finally, run test_chatbot.py in the CLI:

deepeval test run test_chatbot.py

Congratulations! Your test case should have passed ✅ Let's break down what happened.

Read our documentation for more information!


Evals With Full Traceability

Use evals_iterator() to run the same dataset through your app, whether you instrument it manually or through one of DeepEval's framework integrations. Because tracing captures the ordered sequence of model decisions, tool calls, and intermediate steps, you can run trajectory-based evaluations over the complete path your agent takes.

Here's an example of manual instrumentation:

from deepeval.tracing import observe, update_current_span
from deepeval.test_case import LLMTestCase
from deepeval.metrics import TaskCompletionMetric

@observe()
def inner_component(input: str):
    output = "result"
    update_current_span(test_case=LLMTestCase(input=input, actual_output=output))
    return output

@observe()
def app(input: str):
    return inner_component(input)

# This metric evaluates the complete trajectory captured for this run.
for golden in dataset.evals_iterator(metrics=[TaskCompletionMetric()]):
    app(golden.input)
OpenAI
from deepeval.openai import OpenAI
from deepeval.tracing import trace
from deepeval.metrics import TaskCompletionMetric

client = OpenAI()

# This metric evaluates the complete trajectory captured for this run.
for golden in dataset.evals_iterator():
    with trace(metrics=[TaskCompletionMetric()]):
        client.chat.completions.create(
            model="gpt-4o",
            messages=[{"role": "user", "content": golden.input}],
        )
OpenAI Agents
from agents import Runner
from deepeval.metrics import TaskCompletionMetric

# This metric evaluates the complete trajectory captured for this run.
for golden in dataset.evals_iterator(metrics=[TaskCompletionMetric()]):
    Runner.run_sync(agent, golden.input)
AI SDK (TypeScript)
import { generateText } from "ai";
import { configureAiSdkTracing } from "deepeval/integrations/ai-sdk";
import { TaskCompletionMetric } from "deepeval/metrics";

const tracer = configureAiSdkTracing({ name: "my-agent" });

const ask = (input: string) =>
  generateText({
    model,
    prompt: input,
    experimental_telemetry: { isEnabled: true, tracer },
  });

// This metric evaluates the complete trajectory captured for this run.
for await (const golden of dataset.evalsIterator({
  metrics: [new TaskCompletionMetric()],
})) {
  await ask(golden.input);
}
`

deepeval (confident-ai/deepeval)

llm-evaluation
Searching Database…

18.9K ·GitHub
What is this?DeepEval is an open-source LLM evaluation framework: a simple-to-use way to evaluate large-language model systems with research-backed metrics like G-Eval, answer relevancy, and hallucination checks.
How is it different from just using pytest?It mirrors pytest's unit-testing style but is purpose-built for LLM apps — test cases are Python objects combining inputs, outputs, and eval metrics instead of generic asserts, and you run them with DeepEval's own CLI.
How do I get started testing my own app?pip install the package (Python 3.9+), write a test file with an input, your app's actual_output and a metric like GEval at a threshold, then run 'deepeval test run' in the CLI. Scores range 0-1 and the threshold decides pass or fail.
Do I need an OpenAI API key to run the evals?The quickstart sets an OPENAI_API_KEY environment variable, but you're not locked in: metrics can be powered by any LLM of your choice or by NLP models running locally, and you can evaluate with your own custom model.
Do I have to sign up for the Confident AI cloud?No — the framework is open-source and runs locally on its own. The Confident AI platform is an optional free signup that adds sharable cloud testing reports on top of your runs.
Who is it built for — agents, RAG apps, chatbots?Developers building AI agents, RAG pipelines, or chatbots — it evaluates apps end-to-end as black boxes or at component level, down to individual agent steps like tool calls, retrieval, and sub-agent handoffs.
Does it work on Windows, or is it Mac and Linux only?It's a pip-installable Python package with a CLI, so it runs anywhere Python 3.9+ does — Windows, macOS, and Linux.
Does it send my test data anywhere?Only if you opt in: once you log in to the Confident AI platform, all your test cases are automatically logged to the cloud, and data privacy is documented separately.
Can it generate evaluation datasets for me?Yes — it can generate both single-turn and multi-turn synthetic datasets, so you don't have to hand-write every test input.
What is G-Eval?A research-backed LLM-as-a-judge metric for scoring outputs on any custom criteria you define, with human-like accuracy — the quickstart uses it to check correctness against an expected answer.
Can it benchmark raw LLMs, not just my app?Yes — it can benchmark any LLM on popular benchmarks like MMLU, HellaSwag, DROP, BIG-Bench Hard, TruthfulQA, HumanEval, and GSM8K in under 10 lines of code.
Does it help improve my app, or only score it?It optimizes prompts automatically based on evaluation results, so beyond pass/fail verdicts it helps you iterate toward better outputs.
What are similar projects?promptfoo, jevals, mlflow, ragas, Tracely-ai, opik, phoenix, ParseBench
Size
211.3 MB
Stars
18.9K
Age
3y
Commits · 90 Days