Choose evaluator llm
Install the OpenAI SDK:
Set your API key:
Build the evaluator LLM with llm_factory:
Set your API key:
No Anthropic SDK is needed: the call goes through LiteLLM.
For Vertex AI, use llm_factory("vertex_ai/gemini-3.6-flash") with your
Google Cloud credentials (Application Default Credentials, or
vertex_project= / vertex_location=). No Google SDK is needed.
Install the OpenAI SDK, which ships the Azure client:
from openai import AzureOpenAI
from ragas.llms import llm_factory
client = AzureOpenAI(
api_version="2024-02-01",
azure_endpoint="https://<your-resource>.openai.azure.com",
)
evaluator_llm = llm_factory("gpt-6-luna", client=client)
gpt-6-luna here is your deployment name, which need not match the model name.
Bedrock is reached through LiteLLM:
Credentials come from the usual AWS chain — environment, profile or instance role:
LiteLLM reaches 100+ providers — Ollama, vLLM, Groq, Mistral, Cohere, Together, Vertex AI and more — behind one interface, so ragas is not tied to any single vendor's SDK.
from ragas.llms import llm_factory
# any model string LiteLLM understands; credentials come from the environment
evaluator_llm = llm_factory("ollama/llama3")
See the LiteLLM provider list for the model string to use. Credentials are read from the environment variables each provider expects.
Migrating from LangchainLLMWrapper
ragas no longer depends on LangChain, and LangchainLLMWrapper has been
removed. Replace LangchainLLMWrapper(ChatOpenAI(model="gpt-6-luna")) with
llm_factory("gpt-6-luna", client=OpenAI()) as above. See the
Migrating off LangChain guide under How-to Guides > Migrations.