1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
21 small wins to finish your pathNext lesson →
Installation and setup
RAGAS installs from PyPI with a pinned LangChain version. Its metrics ask a judge model, and the judge can be a free Groq or Gemini model.
ragas 0.4.3 with langchain-community below 0.4
The pin matters. RAGAS 0.4.3 imports a class that langchain-community removed in its 0.4 release, so the newest of both together will not import at all. Lesson 17 says more about the version churn in this library.
RAGAS sends anonymous usage data, which RAGAS_DO_NOT_TRACK=true turns off.
pip install "ragas==0.4.3" "langchain-community<0.4"from importlib.metadata import version
print(version("ragas"))A hosted judge for lesson 18Optional
The course judges with PretendJudge, a stand-in from lesson 5, and lesson 18 swaps in a hosted judge built with llm_factory. It takes a client: the Gemini one from google-genai, or an OpenAI client pointed at any OpenAI-compatible URL.
import os
from google import genai
from ragas.llms import llm_factory
client = genai.Client(api_key=os.environ["GOOGLE_API_KEY"])
judge = llm_factory("gemini-2.5-flash", provider="google", client=client)| Provider | Key | Variable | Client for llm_factory |
|---|---|---|---|
| Gemini | Free, aistudio.google.com/apikey | GOOGLE_API_KEY | genai.Client(...) with provider="google" |
| Groq | Free, console.groq.com/keys | GROQ_API_KEY | OpenAI(base_url="https://api.groq.com/openai/v1") |
| OpenRouter | Free models end in :free, openrouter.ai/keys | OPENROUTER_API_KEY | OpenAI(base_url="https://openrouter.ai/api/v1") |
| OpenAI | Paid, platform.openai.com/api-keys | OPENAI_API_KEY | OpenAI() with no base_url |
pip install google-genai "instructor[google-genai]"export GOOGLE_API_KEY=AIza...Try it yourself
- Run
pip show ragas langchain-communityand check both versions.
Little by little, you're building something great.