Knowledge Base Regulation Tracker Standards & Frameworks OSS Directory AI Incident Database Research Paper Library Case Studies Society Articles News Jobs About Charter Sign inBecome a Member

DeepEval

Hallucination and groundedness checking

LLM evaluation framework with research-backed metrics (G-Eval, hallucination, faithfulness, answer relevancy, RAG and agent metrics) that runs like unit tests with pytest, in CI or against production traces. Confident AI offers a hosted platform on top.

evaluationhallucinationunit testsrag

DeepEval: A Research-Backed LLM Evaluation Framework

DeepEval is an open-source framework designed for evaluating large language model (LLM) systems, offering a structured approach akin to unit testing but specialized for LLM applications. Built on research-backed metrics, DeepEval integrates seamlessly into existing workflows, whether in continuous integration (CI) environments or against production traces. The framework supports a wide array of evaluation criteria, including hallucination detection, faithfulness to context, answer relevancy, and specialized metrics for RAG (Retrieval-Augmented Generation) and agentic systems. Confident AI provides a hosted platform extension for enterprise-grade evaluation and observability, enabling teams to standardize metrics across organizations.

The framework is designed to function as a pytest-like testing suite for LLM applications, allowing developers to evaluate end-to-end systems, individual agent steps, or specific components such as tool calls and retrieval processes. DeepEval’s flexibility extends to custom metrics, synthetic dataset generation, and integration with major LLM frameworks like LangChain, OpenAI, and Anthropic. Its compatibility with Python 3.9+ ensures broad accessibility for developers.

How It Works

DeepEval operates by defining evaluation metrics that can be applied to LLM outputs, agent trajectories, or RAG pipelines. These metrics are executed as test cases, similar to traditional unit tests, but tailored for LLM-specific evaluations.

At its core, DeepEval uses LLM-as-a-judge techniques, where a secondary LLM evaluates the primary model’s output against predefined criteria. This approach is grounded in research, particularly through metrics like G-Eval, which employs chain-of-thought (CoT) reasoning to assess outputs with human-like accuracy. DeepEval also introduces Jev, a System One model from TypeSafe AI, which replaces traditional LLM-based decision-making with calibrated probabilistic judgments. This reduces variability, cost, and latency in evaluations, making it feasible to run comprehensive tests in CI environments.

DeepEval’s integration with Confident AI’s hosted platform further enhances its utility by providing centralized observability, dataset management, and governance tools for enterprise teams.

Use Cases

DeepEval is tailored for a variety of LLM applications, including but not limited to:

  • Agentic Systems: Evaluate task completion, tool correctness, goal accuracy, and step efficiency in multi-agent workflows. DeepEval can trace entire agent trajectories, identifying inefficiencies or deviations from intended plans. Metrics such as Plan Adherence and Tool Use ensure agents operate as designed, while Goal Accuracy measures the effectiveness of their outputs.
  • RAG Pipelines: Assess the relevance, faithfulness, and contextual precision of retrieved information. Metrics like Answer Relevancy, Contextual Recall, and Faithfulness quantify how well the RAG system aligns with user queries and retrieved context.
  • Chatbots and Multi-Turn Conversations: Measure knowledge retention, turn relevancy, and role adherence across extended interactions. DeepEval’s Multi-Turn Metrics evaluate whether chatbots maintain consistency, professionalism, and factual grounding throughout conversations, addressing challenges like prompt drifting or context loss.
  • Prompt Optimization and Red Teaming: Identify biases, toxicity, or misalignments in LLM outputs. This capability is critical for pre-deployment testing and adversarial validation.
  • DeepEval’s integration with popular evaluation suites enables quick, reproducible comparisons across models and architectures.

The framework’s compatibility with frameworks like LangChain, CrewAI, and OpenAI Agents ensures broad applicability, while its CI/CD integration allows for automated testing in development pipelines. For enterprise teams, Confident AI’s platform provides additional layers of governance, observability, and collaboration, standardizing evaluation practices across departments.

Key Features & Capabilities

DeepEval’s feature set is designed to address the complexities of LLM evaluation, offering both granular and high-level assessments:

  • Research-Backed Metrics:
  • G-Eval: A versatile LLM-as-a-judge metric that evaluates outputs against custom criteria using chain-of-thought reasoning. It is particularly useful for subjective or domain-specific assessments, such as professionalism in customer support chatbots.
  • JevEval: Introduces Jev, a System One model that replaces traditional LLM-based decision-making with probabilistic judgments. Jev is integrated into metrics like FaithfulnessMetric and GEval, where it handles binary or multi-choice decisions while the primary LLM manages language tasks.
  • DAG (Directed Acyclic Graph) Metrics: Enables the construction of conditional, multi-step evaluation workflows. DAG metrics allow for objective scoring by breaking down evaluations into deterministic steps, such as validating tool calls or verifying retrieval accuracy.
  • RAG-Specific Metrics:
  • Answer Relevancy: Quantifies how closely the RAG output addresses the user’s query.
  • Contextual Recall/Precision: Measures the quality of retrieved documents, ensuring they are both relevant and comprehensive.
  • Multi-Turn and Conversational Metrics:
  • Knowledge Retention: Evaluates whether a chatbot maintains factual consistency across turns.
  • Turn Relevancy: Ensures each response remains pertinent to the ongoing conversation.
  • Role Adherence: Verifies that the chatbot adheres to its assigned persona or guidelines.
  • Multimodal Evaluations:
  • Synthetic Data Generation: DeepEval can generate synthetic test cases, including multi-turn conversations or golden datasets, to simulate real-world interactions without manual annotation.
  • CI/CD and Production Integration:
  • Runs as pytest-compatible test suites, enabling seamless integration into existing CI/CD pipelines.
  • Supports real-time evaluation of production traces, allowing for continuous monitoring of deployed models.
  • Custom Metric Development: Users can define and integrate custom metrics, extending DeepEval’s functionality to niche or proprietary evaluation criteria.
  • Framework Agnosticism: DeepEval integrates with major LLM frameworks, including LangChain, LlamaIndex, and OpenAI Agents, as well as enterprise tools like AWS AgentCore and Google ADK.
  • Enterprise Observability: Confident AI’s platform extends DeepEval’s capabilities by providing centralized evaluation dashboards, dataset management, and governance tools. This allows organizations to enforce quality standards, track model performance, and collaborate across teams.

Integration and Extensibility

DeepEval’s design emphasizes interoperability and extensibility.

  • LLM Frameworks: LangChain, LangGraph, CrewAI, Anthropic (Claude), OpenAI, LlamaIndex, and Mastra.
  • CI/CD Pipelines: DeepEval’s pytest-like syntax allows it to be executed as part of automated testing workflows, ensuring evaluations are triggered alongside other quality checks.
  • Confident AI Platform: Enterprise users can leverage Confident AI’s platform for advanced features such as trace analysis, prompt versioning, and human annotation workflows. The platform acts as a persistence layer, storing evaluation results and enabling cross-team collaboration.
  • Vibe-Coder Support: DeepEval includes tools for vibe coding, where coding agents (e.g., Cursor or Claude Code) can generate test cases, run evaluations, and iterate on failures automatically. This accelerates the development cycle by closing the loop between evaluation and code improvement.

Technical Implementation

Installation is straightforward via pip, and the framework includes comprehensive documentation for metrics, integrations, and use cases.

  • Metric Standardization: All metrics return scores between 0 and 1, with higher values indicating better performance. This consistency simplifies comparison across different evaluation criteria.
  • Traceability: DeepEval captures detailed execution traces, including timing, model inputs, and intermediate steps. These traces are visible in the terminal and can be exported for further analysis.
  • Synthetic Data Generation: The framework includes tools to generate synthetic datasets, such as simulated conversations or golden responses, reducing the need for manual annotation.
  • Jev Integration: The introduction of Jev in version 4.2.2 marks a shift toward probabilistic decision-making, reducing the variability inherent in traditional LLM-as-a-judge approaches. Jev’s calibrated outputs improve reliability and cost-efficiency, particularly in CI contexts.

DeepEval’s release history reflects ongoing improvements, including bug fixes, new integrations (e.g., Vertex AI support), and enhancements to existing metrics. For instance, version 4.2.4 introduced JevEval, while version 4.1.x focused on refining DAG metrics and adding support for MCP servers.

Getting Started

  • Installation: Users install DeepEval via pip, with optional login to Confident AI’s platform for cloud-based reporting.

pip install -U deepeval

  • Test Case Definition: Developers create test files (e.g., testchatbot.py) to define evaluation criteria. Test cases can evaluate end-to-end systems or individual components, such as LLM calls or tool usage.
  • For example, a G-Eval metric can be configured to assess factual correctness or professionalism.
  • Execution: Tests are run locally or in CI environments, with results displayed in the terminal or logged to Confident AI’s platform for enterprise users.

Example workflow for evaluating a RAG-based chatbot:

from deepeval import asserttest

correctness_metric = GEval(

criteria="Determine if the 'actual output' is correct based on the 'expected output'.",

evaluation_params=[SingleTurnParams.INPUT, SingleTurnParams.ACTUAL_OUTPUT, SingleTurnParams.EXPECTED_OUTPUT]

test_case = LLMTestCase(

input="What is the capital of France?",

actual_output="The capital of France is Paris.",

asserttest(test_case, [correctness_metric])

This example demonstrates how DeepEval can be used to validate a chatbot’s response against a known correct answer, with the G-Eval metric providing a scored assessment.

Advanced Features

  • DAG Metrics: Allow users to define conditional evaluation workflows, such as validating a sequence of tool calls or retrieval steps.
  • Rubric-Based Scoring: Users can define custom rubrics to constrain evaluation outputs, ensuring consistency in scoring. For example, a rubric for professionalism might map scores to specific behavioral outcomes (e.g., 0–2 for rude responses, 7–9 for minor informality).
  • Multi-Turn Evaluations: DeepEval supports conversational test cases, where metrics assess coherence, relevancy, and factual grounding across extended interactions. This is particularly useful for evaluating customer support chatbots or therapeutic AI systems.

Community and Governance

Key contributors include Penguine-IP, A-Vamshi, and Kritinv, who have driven significant enhancements to the framework.

The project’s permissive Apache 2.0 license ensures broad accessibility, while Confident AI’s enterprise platform provides additional tools for teams requiring centralized evaluation and observability.

Version History and Roadmap

  • Jev Integration (v4.2.2): Introduced probabilistic decision-making to reduce evaluation variability and latency.
  • DAG Metrics (v4.1.3): Revamped to support top-down construction of conditional evaluation workflows.
  • Bug Fixes and Stability: Iterative improvements to metrics, integrations, and CI/CD compatibility.

Sources

Contribute

Spot an error, or know a record we should add? Members can propose additions and submit corrections.