deepeval
БесплатноБез исполняемых скриптовНе проверенDeepEval is an open-source Python framework that unit-tests LLM applications with pytest-style test cases and LLM-as-a-judge metrics. Use when a user asks to…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
DeepEval — LLM Testing & Evaluation Framework
Overview
DeepEval (4.3.1 as checked, October 2026) runs metrics over LLMTestCase objects, either under deepeval test run (a pytest wrapper) or through evaluate(). Most metrics call a judge LLM: OPENAI_API_KEY selects OpenAI by default, and deepeval set-ollama, set-gemini and similar commands switch the judge. Red teaming moved out into the separate DeepTeam package.
Instructions
Basic Test Cases
Write unit tests for LLM outputs using built-in metrics:
# tests/test_chatbot.py — Unit tests for a customer support chatbot
import pytest
from deepeval import assert_test
from deepeval.test_case import LLMTestCase
from deepeval.metrics import (
AnswerRelevancyMetric,
FaithfulnessMetric,
HallucinationMetric,
ToxicityMetric,
)
def test_answer_is_relevant():
"""Verify the chatbot answers the actual question asked."""
test_case = LLMTestCase(
input="How do I cancel my subscription?",
actual_output="To cancel your subscription, go to Settings > Billing > Cancel Plan. Your access continues until the end of the billing period.",
retrieval_context=[
"Cancellation Policy: Users can cancel anytime via Settings > Billing > Cancel Plan. Access remains active until the current billing period ends.",
"Refunds: Pro-rated refunds are available for annual plans within 14 days.",
],
)
metric = AnswerRelevancyMetric(
threshold=0.7, # Minimum score to pass (0.0 to 1.0)
model="gpt-4o", # Judge model for evaluation
)
assert_test(test_case, [metric])
def test_answer_is_faithful_to_context():
"""Ensure the chatbot doesn't hallucinate beyond retrieved documents."""
test_case = LLMTestCase(
input="What is the pricing for the enterprise plan?",
actual_output="The enterprise plan costs $499/month with unlimited users and priority support.",
retrieval_context=[
"Enterprise Plan: $499/month. Includes unlimited users, priority support, SSO, and custom integrations.",
],
context=[ # HallucinationMetric reads `context`, FaithfulnessMetric reads `retrieval_context`
"Enterprise Plan: $499/month. Includes unlimited users, priority support, SSO, and custom integrations.",
],
)
faithfulness = FaithfulnessMetric(threshold=0.8)
hallucination = HallucinationMetric(threshold=0.5) # v4: 1.0 = no hallucination; passes when score >= threshold
assert_test(test_case, [faithfulness, hallucination])
def test_response_is_not_toxic():
"""Guard against toxic or inappropriate responses."""
test_case = LLMTestCase(
input="Your product is terrible and I hate it",
actual_output="I'm sorry to hear about your frustration. Let me help resolve your issue. Could you describe what went wrong?",
)
toxicity = ToxicityMetric(threshold=0.5) # v4: 1.0 = clean; threshold is a minimum score, like every other metric
assert_test(test_case, [toxicity])
Conversational Testing
A multi-turn case is a list of Turn(role=..., content=...) objects (v4 replaced the old list of LLMTestCase turns; ConversationRelevancyMetric is now TurnRelevancyMetric):
# tests/test_conversation.py — Multi-turn conversation quality
from deepeval import assert_test
from deepeval.test_case import ConversationalTestCase, Turn
from deepeval.metrics import TurnRelevancyMetric, ConversationCompletenessMetric
def test_multi_turn_conversation():
"""Verify the assistant maintains context across turns."""
conversation = ConversationalTestCase(
turns=[
Turn(role="user", content="I want to upgrade to the Pro plan"),
Turn(role="assistant", content="Happy to help. Your current plan is Basic; Pro is $29/month with advanced analytics and priority support. Shall I proceed?"),
Turn(role="user", content="Yes, please proceed"),
Turn(role="assistant", content="Done, your account is now on Pro ($29/month). The new features are available immediately."),
Turn(role="user", content="What features did I just get?"),
Turn(role="assistant", content="Advanced analytics dashboards, priority email support (4hr SLA), API access, and team collaboration for up to 10 seats."),
],
)
assert_test(conversation, [TurnRelevancyMetric(threshold=0.7), ConversationCompletenessMetric(threshold=0.7)])
Custom Metrics
For a domain criterion judged by an LLM, use GEval instead of hand-parsing a score:
# metrics/brand_voice.py — Brand consistency as a G-Eval metric
from deepeval.metrics import GEval
from deepeval.test_case import SingleTurnParams
brand_voice = GEval(
name="Brand Voice",
criteria=(
"Judge whether the actual output follows our voice: friendly but professional, "
"uses 'we' not 'I', explains technical terms, and always off
Установить deepeval в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл deepeval?
DeepEval is an open-source Python framework that unit-tests LLM applications with pytest-style test cases and LLM-as-a-judge metrics. Use when a user asks to evaluate a RAG chatbot, test LLM answers for relevancy, faithfulness or hallucination, write a custom metric, or run LLM quality checks in CI.
Как установить скилл deepeval?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл deepeval запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic