Skip to content

feat(llm): switch default LLM to gpt-6-luna - #196

Merged
AkhileshNegi merged 7 commits into
mainfrom
feat/default-llm-switch
Dec 4, 2026
Merged

AkhileshNegi merged 7 commits into
mainfrom
feat/default-llm-switch

Conversation

@Prajna1999

@Prajna1999 Prajna1999 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #189

Glific moves to the 6-series on 1 Dec and kaapi-backend already defaults to gpt-6-luna. This aligns guardrails.

  • DEFAULT_LLM_CALLABLE and ANSWER_RELEVANCE_LLM_MODEL → gpt-6-luna. Both can be set as env vars and are now listed in .env.example / .env.test.example. Added gpt-6-luna to _KNOWN_JSON_CAPABLE_MODELS; gpt-5.6-sol stays in the list.
  • LiteLLM fix (needed for the switch): LiteLLM 1.81.13 doesn't map the gpt-6 family. guardrails-ai caps upgrades at 1.82.5, which doesn't map it either. As a result, OpenAI rejected max_tokens ("use max_completion_tokens") and LiteLLM dropped reasoning_effort as unsupported. traced_completion, which all three LLM validators use, now sends max_completion_tokens and passes allowed_openai_params=["reasoning_effort"]. Verified live against gpt-6-luna, gpt-5.6-sol and gpt-4o-mini.
  • Token budgets: unchanged. Answer relevance stays at 512 (gpt-6-luna peaked at 428) and topic relevance at 1024 (peak 496).
  • Updated comments, tests and docs. README and docs eval tables now show the November run.

Eval results (November 2026, same rows for every model)

Topic relevance (100 rows, 32 out of scope, schema v2, threshold 2): gpt-6-luna scored 0.88–0.90 accuracy and 0.79–0.83 F1, close to gpt-5.6-sol (0.90 / 0.82). It's about 1.4x slower.

Answer relevance (100 pairs): gpt-6-luna scored 0.81–0.82 accuracy against 0.89 for gpt-5.6-sol. It's stricter: it rejected 18–19 of 50 correct answers, against 11 for gpt-5.6-sol. No model passed a wrong answer. The October pairs weren't committed, so this is a new, reproducible set built from the topic-relevance datasets. Its correct answers were written by gpt-4o-mini.

Heads-up

  • Stored validator_config rows with an explicit llm_callable: gpt-5.6-sol won't follow the new default. They need updating separately if they should move.
  • gpt-6-luna's stricter answer-relevance judging may raise false rejects for answer_relevance users who use the default prompt.

Test plan

  • pytest app/tests: 371 passed, 14 skipped, including the live gpt-6-luna topic-relevance tests
  • New unit test for the traced_completion parameter mapping

🤖 Generated with Claude Code

- DEFAULT_LLM_CALLABLE / ANSWER_RELEVANCE_LLM_MODEL -> gpt-6-luna; add it to
  _KNOWN_JSON_CAPABLE_MODELS (gpt-5.6-sol kept for stored configs).
- traced_completion: send max_completion_tokens instead of max_tokens and pass
  allowed_openai_params for reasoning_effort. litellm 1.81/1.82 (capped by
  guardrails-ai) doesn't map the gpt-6 family, so OpenAI rejected max_tokens
  and litellm dropped reasoning_effort.
- answer_relevance_custom_llm: max_tokens 512 -> 1024 (gpt-6-luna peaked at
  428). topic_relevance_llm stays at 1024 (peak 496).
- Re-ran topic-relevance and answer-relevance evals; updated README/docs
  tables and all gpt-5.6-sol references.

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

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

OPENAI_API_KEY: str | None = None
ANSWER_RELEVANCE_LLM_MODEL: str = "gpt-5.6-sol"
DEFAULT_LLM_CALLABLE: str = "gpt-5.6-sol"
ANSWER_RELEVANCE_LLM_MODEL: str = "gpt-6-luna"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Users of answer_relevance with default settings will see far more correct answers rejected, because the default judge now false-rejects 18–19 of 50 correct answers instead of 11. The cause is ANSWER_RELEVANCE_LLM_MODEL switching to gpt-6-luna at config.py:40. The PR's own November eval shows accuracy dropping from 0.89 to 0.81–0.82. Fix: keep ANSWER_RELEVANCE_LLM_MODEL on gpt-5.6-sol until the default prompt is tuned for gpt-6-luna. That setting is separate from DEFAULT_LLM_CALLABLE, so topic relevance can still move.

Why this was flagged

AnswerRelevanceCustomLLMSafetyValidatorConfig.llm_callable defaults to settings.ANSWER_RELEVANCE_LLM_MODEL (answer_relevance_custom_llm_safety_validator_config.py:14), and so does AnswerRelevanceCustomLLM.__init__ (answer_relevance_custom_llm.py:48). So every guardrail request that uses answer_relevance without an explicit llm_callable now goes to gpt-6-luna. Per the updated README (backend/app/core/validators/README.md, answer relevance notes), gpt-6-luna rejected 18–19 of 50 correct answers, against 11 for gpt-5.6-sol. That means about 36–38% of good answers fail the check instead of 22%, and nothing is gained because no model passed a wrong answer. The README also shows the slowest 5% of calls at 4.7–7.8s. The PR description calls the extra false rejects a known heads-up. In fact they hit every default-config tenant on every call, and the two settings are already separate, so the cost is avoidable.

Verification: Trigger: any answer_relevance guardrail request that doesn't set llm_callable explicitly. config.py:40 now reads ANSWER_RELEVANCE_LLM_MODEL: str = "gpt-6-luna" (it was "gpt-5.6-sol"). So every default request now goes to gpt-6-luna. With unchanged prompts, correct answers are rejected about 1.7x as often as on the base branch, and the PR makes no prompt change to offset it.

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

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no new issues

No new issues were found in this update; 1 finding from earlier reviews is still open above.

Still open from earlier reviews (1):

  • 🔴 backend/app/core/config.py:40 — Users of answer_relevance with default settings will see far more correct answers rejected, because the default judge n…

If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.

Prajna1999 and others added 3 commits December 4, 2026 10:27
- Drop ANSWER_RELEVANCE_LLM_MODEL; answer relevance uses DEFAULT_LLM_CALLABLE
  like the other LLM validators. Document it in .env.example and the
  developer guide's env var table.
- Remove gpt-6-luna from _KNOWN_JSON_CAPABLE_MODELS (litellm already
  reports response_format support for it).
- Drop model names and eval dates from code comments so model switches
  don't need to touch them.
- Docs: point llm_callable defaults at DEFAULT_LLM_CALLABLE, drop optional
  llm_callable lines that only restated the default (kept for llm_critic,
  where it's required), remove "use the default model" advice, and shorten
  the eval write-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep this PR to the gpt-5.6-sol -> gpt-6-luna switch. List both
DEFAULT_LLM_CALLABLE and ANSWER_RELEVANCE_LLM_MODEL in the .env examples so
the models can be changed from the environment.

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

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no new issues

No new issues were found in this update; 1 finding from earlier reviews is still open above.

Still open from earlier reviews (1):

  • Unresolved: 1 blocking on lines changed since (possibly already fixed).

If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no new issues

No new issues were found in this update; 1 finding from earlier reviews is still open above.

1 optional suggestion (a nit or a note on pre-existing code) was found and not posted.

Still open from earlier reviews (1):

  • Unresolved: 1 blocking on lines changed since (possibly already fixed).

If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.

This review covers commit a586c00, which is no longer the latest commit on this pull request; later commits are not covered by it.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no new issues

No new issues were found in this update; 1 finding from earlier reviews is still open above.

Still open from earlier reviews (1):

  • Unresolved: 1 blocking on lines changed since (possibly already fixed).

If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.

@AkhileshNegi
AkhileshNegi merged commit b5dc4d6 into main Dec 4, 2026
3 checks passed
@AkhileshNegi
AkhileshNegi deleted the feat/default-llm-switch branch December 4, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model Update: Change default to gpt-6-luna

2 participants