Skip to content

fix(python): do not send a default temperature from AnswerRelevancy - #254

Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
braintrustdata:mainfrom
pcbeingused333:fix/answer-relevancy-default-temperature
Open

alexcastgonz (pcbeingused333) wants to merge 1 commit into
braintrustdata:mainfrom
pcbeingused333:fix/answer-relevancy-default-temperature

Conversation

@pcbeingused333

Copy link
Copy Markdown

AnswerRelevancy defaulted temperature to 0.5 and always sent it on the question-generation request. A judge model that rejects a non-default temperature, such as Claude 4.7 and later (including the 5.x models), then fails with a 400 unless the caller knows to pass a value it accepts. The other scorers in llm.py document "If not specified, uses the model's default" and only send a temperature that was given, and js/ragas.ts already behaves that way.

temperature now defaults to None and is sent only when the caller passes it; the docstring says so. This changes the default for every model: a call that relied on 0.5 now uses the model's own default. The score metadata reports None for temperature in that case. If you would rather keep 0.5 for models that accept it, I can instead skip the temperature only for the models that reject it; I went for the simpler convention used in llm.py.

Test: test_answer_relevancy_does_not_send_a_default_temperature in py/autoevals/test_ragas.py builds the question-generation request for a Claude model name and checks it has no temperature, and that an explicit temperature=0.2 is still sent. On main the new test fails (the default request carries temperature) and it passes with this change. In py/autoevals/test_ragas.py the other nine tests (the test_ragas_retrieval cases and the custom-embedding test) fail in my sandbox both on main and here, because they need an OpenAI key/network; I did not call a live model.

This change was made with Claude Code.

AnswerRelevancy defaulted temperature to 0.5 and always sent it, so a judge
model that rejects a non-default temperature (Claude 4.7+ and 5.x) failed with
a 400 unless the caller knew to pass one it accepts. Default it to None and send
it only when given, as the other scorers in llm.py do ("If not specified, uses
the model's default").

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant