Repository navigation
chore(llm): switch default LLM from gpt-4o/gpt-4o-mini to gpt-5.6-sol - #172
Conversation
- Point ANSWER_RELEVANCE_LLM_MODEL and DEFAULT_LLM_CALLABLE at gpt-5.6-sol, update the JSON-capable model allowlist and the issue-formatter workflow. - answer_relevance_custom_llm: raise the completion budget from 10 to 512 tokens and send reasoning_effort="low" for reasoning models, so hidden reasoning tokens don't starve the YES/NO answer; treat empty content as an unexpected response instead of erroring. - Add supports_reasoning() helper to llm_utils. - Update tests (forwarding tests use openai/gpt-5.6-sol to stay distinct from the default) and docs; fix evaluation README's stale DEFAULT_CONFIG reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
Reasoning models such as gpt-5.6-sol (default after #172) can return content=None; strip() on it raised and surfaced as "LLM call failed" instead of an unparseable-response failure. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| return False | ||
|
|
||
|
|
||
| def supports_reasoning(model: str) -> bool: |
There was a problem hiding this comment.
can we use this in topic_relevance_llm.py:52since similar function is used there and use utils for that
There was a problem hiding this comment.
Done in 2b7509a. topic_relevance_llm now imports supports_reasoning from llm_utils, and its local copy plus the direct litellm import are removed.
| # Room for a one-word YES/NO plus the hidden reasoning tokens that reasoning | ||
| # models (e.g. gpt-5.6-sol) count against the same completion budget. | ||
| _MAX_TOKENS = 512 | ||
| _REASONING_EFFORT = "low" |
There was a problem hiding this comment.
can we update this to "medium"
There was a problem hiding this comment.
Done in 2b7509a. _REASONING_EFFORT is now "medium", the same as topic_relevance_llm. The 512-token budget should still leave room for the one-word YES/NO.
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Completion budget / reasoning effort | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
There was a problem hiding this comment.
Removed the budget and effort tests in 2b7509a, since they only restated the constants. I kept test_empty_content_returns_unexpected_response_fail: an empty reply (e.g. when reasoning uses up the budget) used to raise on .strip() and get reported as "LLM call failed". It now returns the unexpected-response failure, and this test covers that. Happy to drop it too if you prefer.
| }, | ||
| body: JSON.stringify({ | ||
| model: 'gpt-4o-mini', | ||
| model: 'gpt-5.6-luna', |
There was a problem hiding this comment.
do we need this change?
There was a problem hiding this comment.
gpt-4o-mini is going to be deprecated in January 2027. So we could make this toggle now instead of doing it closer to the deprecation date.
…effort - topic_relevance_llm imports supports_reasoning from llm_utils instead of keeping its own copy. - answer_relevance_custom_llm uses reasoning_effort="medium", matching topic_relevance_llm. - Drop the budget/effort tests that only restated constants; keep the empty-reply test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing models #173 dropped the cap because a 300-token limit shared with hidden reasoning tokens produced empty replies, leaving no ceiling on cost or latency. Restore it at 1024 (2048 with fallback_message), about 4x the highest gpt-5.6-sol usage seen in a 300-call live eval, so it only stops runaway calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Live eval: gpt-5.6-sol vs gpt-4o-miniAbout 100 examples per validator, run against the live OpenAI API on this branch ( Result: no breakage. Across 600 answer_relevance_custom_llm100 query/answer pairs (healthcare and education, English and Hinglish): 50 with the correct answer (expect YES) and 50 with another question's answer (expect NO).
topic_relevance_llm100 rows sampled from the education and healthcare datasets (50 each, 32 out of scope), prompt schema v2.
Latency
Run with a one-off script outside the repo; the 100 answer-relevance pairs were written for this eval, and nothing was added to the repo's datasets. |
- answer_relevance_custom_llm: add an Evaluation Results section (100 query/answer pairs, gpt-5.6-sol vs gpt-4o-mini) and fix stale facts: max_tokens=10 -> 512, reasoning_effort, empty-reply handling, speed. - topic_relevance_llm (validators README 6b): document the token cap and reasoning effort, and add results on 100 education/healthcare rows. - DEVELOPER_GUIDE 3.11: correct max_tokens and speed, link to results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Target issue is #171
Moves every LLM-backed validator
gpt-4o/gpt-4o-minitogpt-5.6-sol.Move issue formatter model in github/workflows/issue-formatter.yml` are updated to match.
What changed
ANSWER_RELEVANCE_LLM_MODELandDEFAULT_LLM_CALLABLEdefault togpt-5.6-sol; the JSON-capable model allowlist inllm_utils.pyand `.answer_relevance_custom_llmfix:gpt-5.6-solis a reasoning model. LiteLLM sendsmax_tokens=10asmax_completion_tokens=10, which also has to cover hidden reasoning tokens, so the YES/NO answer would usually come back empty. The budget is now 512 tokens, andreasoning_effort="medium"is sent when the model supports reasoning (matchingtopic_relevance_llm). The check uses a sharedsupports_reasoning()helper inllm_utils.py, so non-reasoning models likegpt-4odon't receive an unsupported param;topic_relevance_llmnow imports this helper instead of keeping its own copy from fix(topic_relevance_llm): label topic config in prompt, support reasoning models #173. An empty reply now returns the "unexpected response" failure instead of being reported as a failed LLM call.topic_relevance_llmtoken ceiling: fix(topic_relevance_llm): label topic config in prompt, support reasoning models #173 removedmax_tokensbecause a 300-token cap shared with hidden reasoning produced empty replies, which left no ceiling on cost or latency. It's restored at 1024 tokens (2048 with a fallback message), about 4x the highest usage seen in the live eval, so it only stops runaway calls.DEFAULT_CONFIGthat doesn't exist.Checklist
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
app/tests/test_llm_validators.pyandapp/tests/validators/, run with--noconftestbecause the test Postgres wasn't available locally. No calls were made against the live OpenAI API.openai/gpt-5.6-sol. Using plaingpt-5.6-solwould equal the new default, so they'd pass even if forwarding broke.test_no_max_tokens_cap_is_sent(from fix(topic_relevance_llm): label topic config in prompt, support reasoning models #173) is replaced by tests for the 1024 and 2048 caps.gpt-5.6-solis more accurate on both validators but about 2x slower per call; this is accepted. The cap and lower reasoning effort don't change that.ANSWER_RELEVANCE_LLM_MODELandDEFAULT_LLM_CALLABLEnow hold the same value and could be merged.nsfw_textdocs give the default model astextdetox/xlmr-large-toxicity-classifier, but the code default ismichellejieli/NSFW_text_classifier.Live eval results
About 100 examples per validator against the live OpenAI API. No breakage: across 600
gpt-5.6-solcalls there were no empty replies, cut-off replies, errors or parse failures.gpt-5.6-solis more accurate on both validators but about 2x slower per call; the slower speed is accepted.answer_relevance_custom_llm
100 query/answer pairs (healthcare and education, English and Hinglish): 50 with the correct answer (expect YES) and 50 with another question's answer (expect NO).
max_tokens=10would have cut off manygpt-5.6-solreplies; the highest use was 179 tokens.topic_relevance_llm
100 rows sampled from the education and healthcare datasets (50 each, 32 out of scope), prompt schema v2.
gpt-5.6-solcatches more out-of-scope inputs (about 26 vs 21 of 32) but also blocks some in-scope ones, e.g. "where can I get my baby's vaccination near my village?". Expect a few new false blocks on borderline in-scope questions.Latency
reasoning_effort="none"), a trivial YES/NO call still took about 1.1s, so that's roughly this model's floor. (minimalisn't supported by this model.)gpt-4o-mini. The guardrails code sets no timeouts, but callers with tight timeouts may need to raise them.🤖 Generated with Claude Code