-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
[ ] I checked the documentation and related resources and couldn't find an answer to my question.
Your Question
Hi,
Iβm migrating my RAGAS evaluation pipeline from an older gpt-3.5-turbo setup to a new gpt-o4-mini deployment hosted on Azure OpenAI.
Previously, I used LangchainLLMWrapper with a langchain_openai.AzureChatOpenAI client as the LLM judge. After upgrading, Iβm seeing both:
- A deprecation warning suggesting I should use
llm_factoryinstead ofLangchainLLMWrapper:
DeprecationWarning: LangchainLLMWrapper is deprecated and will be removed in a future version. Use llm_factory instead: from openai import OpenAI; from ragas.llms import llm_factory; llm = llm_factory('gpt-4o-mini', client=OpenAI(api_key='...'))
- A runtime error related to the
temperatureparameter when using my Azure deployment:
BadRequestError(Error code: 400 - {'error': {'message': "Unsupported value: 'temperature' does not support 0.01 with this model. Only the default (1) value is supported.", 'type': 'invalid_request_error', 'param': 'temperature', 'code': 'unsupported_value'}})
It looks like LangchainLLMWrapper (or the RAGAS internals using it) is setting a non-default temperature for the judge LLM, but on Azure the gpt-4o-mini deployment only supports the default temperature = 1. This leads to the unsupported_value error.
My questions are:
-
What is the recommended way to configure RAGAS to use an existing
AzureChatOpenAIclient as the LLM judge?
The deprecation warning suggests usingllm_factory, but the example only shows the standardOpenAIclient and not an Azure OpenAI client. -
If Azure OpenAI does not yet work with
llm_factory, is there a recommended workaround to avoid the temperature issue (e.g. a way to force RAGAS not to override the temperature), or is support for Azure OpenAI planned in a future release?
Code Examples
from langchain_openai import AzureChatOpenAI
from ragas.llms import LangchainLLMWrapper
from app.configs.config import (
AZURE_OPENAI_API_VERSION,
AZURE_OPENAI_DEPLOYMENT,
EMBEDDING_MODEL,
)
azure_llm = AzureChatOpenAI(
azure_deployment='o4-mini',
openai_api_version='2024-12-01-preview',
temperature=1,
model_kwargs={"max_completion_tokens": 4096},
)
wrapped_llm = LangchainLLMWrapper(azure_llm)
result = evaluate(
dataset=ragas_dataset,
metrics=metrics,
llm=wrapped_llm ,
embeddings=embeddings,
)