DeepEvaldeepeval 4.2 · Python 3.9+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
24 small wins to finish your pathNext lesson

Installation and setup

DeepEval installs from PyPI. Its metrics grade with a judge model, OpenAI's by default, and a free Gemini or Groq key can do the judging instead.

pip install deepeval 4.2.3

The version is pinned so your output matches the lessons. DeepEval sends usage telemetry unless DEEPEVAL_TELEMETRY_OPT_OUT=1 is set, and deepeval login connects the Confident AI platform, which this course does not use.

pip install "deepeval==4.2.3"
Example
from importlib.metadata import version

print(version("deepeval"))

A judge model for lesson 22Optional

Lessons up to 21 grade with PretendJudge, a stand-in you write in lesson 9. Lesson 22 hands grading to a hosted model. Every metric takes that model as model=, so the paid OpenAI default can be swapped for a free one.

python
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.models import GeminiModel

judge = GeminiModel(model="gemini-2.5-flash")
metric = AnswerRelevancyMetric(model=judge)
ProviderKeyVariableDeepEval model
GeminiFree, aistudio.google.com/apikeyGOOGLE_API_KEYGeminiModel(model="gemini-2.5-flash"), needs google-genai
GroqFree, console.groq.com/keysGROQ_API_KEYLiteLLMModel(model="groq/openai/gpt-oss-120b"), needs litellm
OpenRouterFree models end in :free, openrouter.ai/keysOPENROUTER_API_KEYOpenRouterModel(model="google/gemma-4-31b-it:free")
OpenAIPaid, platform.openai.com/api-keysOPENAI_API_KEYThe default, nothing to pass
pip install google-genai
export GOOGLE_API_KEY=AIza...
Try it yourself
  • Run deepeval --help and find the test and set-gemini commands.

Little by little, you're building something great.