Repository navigation
Route retrieval helper calls through the LLM backend and fix rerank scoring - #164
Merged
Merged
Conversation
…coring Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retrieval helpers (query planning, expansion, HyDE, reranking, verification) were not working for local, Anthropic or OpenAI chats, and reranking ordered results by raw scores of mixed scale. This PR fixes both and bumps the version to 4.0.1.
Helper calls
_call_fast_llmcalled LiteLLM directly. The cases below were observed live, or reproduced offline against LiteLLM 1.109.0rc1:Local models: A local Gemma 4 12B thinks by default. It spent the fixed 500-token budget reasoning and returned an empty reply (
finish_reason=length), so reranking never ran.Anthropic and OpenAI: LiteLLM rejected the fixed
temperature=0.3:Every helper silently fell back.
API keys: Keys were looked up under the environment-variable name (
ANTHROPIC_API_KEY), but the keystore is keyed by provider (anthropic).The helper now builds an
LLMRequestfor the configured backend. That request carries:default_max_tokens;least_reasoning_effortinmodel_parameters:nonefor local hybrid models (Ollamathink: false), and the lowest declared mode for cloud models.Offline validation against LiteLLM: Haiku, Luna, Flash-Lite and Gemma 4 12B all pass parameter validation.
Thinking
offfor local models: An explicitthinking_effort: offnow sendsreasoning_effort: none. Before, it sent nothing, which kept models that think by default thinking.LiteLLMBackendsetssuppress_debug_info. LiteLLM printed a "Provider List" banner on lookups it catches itself.Ranking
0.3 × raw score + 0.7 × LLM/10, but raw scores run from about 0.03 (RRF) to over 8 (full-text rank). In a live chat the reranker scored the one relevant chunk 10 and the rest 0, yet the relevant chunk finished eighth. Retrieval strength is now scaled to 0–1 by dividing by the largest score.rrf_score.Verification
rag.pyandcore.py, these fail: the five request tests intests/test_fast_llm.py, the three thinking-off tests intests/test_thinking.py, and 6 of the 7 tests intests/test_rerank_ranking.py.thinking_effort: offat a 256-token budget: It replies in 0.65 s. The default setting still raises the clear output-budget error.🤖 Generated with Claude Code