Skip to content

feat: switch production answering to DeepSeek via OpenRouter - #49

Merged
crewcricle merged 2 commits into
mainfrom
fix/scorer-section-field-check
Aug 8, 2026
Merged

feat: switch production answering to DeepSeek via OpenRouter#49
crewcricle merged 2 commits into
mainfrom
fix/scorer-section-field-check

Conversation

@rprabhat

@rprabhat rprabhat commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Production answering path (haiku/sonnet tiers, and everything that aliases to them — draft/verify/rerank/classify) now defaults to openrouter/deepseek/deepseek-v4-flash instead of Anthropic Claude Haiku/Sonnet.
  • verify_strong (VerifyAgent's escalation tier for the most severely flagged draft answers) is kept as a deliberate exception on openrouter/openai/gpt-5.1 rather than following the alias cascade — an independent model family from the DeepSeek draft generator, stronger structured-output track record, still meaningfully cheaper than Anthropic Sonnet, and rarely invoked so the cost impact is minimal.
  • docs/model-routing.md rewritten to document the new default, the required Doppler secrets (LLM_API_KEY, LLM_API_BASE=https://openrouter.ai/api/v1), and a "switching back to Anthropic" recipe.

Why

This closes out the RAG-quality audit documented in docs/rag-quality-audit.md: DeepSeek + the retrieval-precision fixes shipped in the prior two PRs (#46, #47) scored comparably to — and on several individual benchmark questions better than — the previous Anthropic-only baseline, at a fraction of the per-token cost.

Verification

  • Full backend test suite: 838 passed (including the regression lock asserting verify_strong stays distinct from the cheap tier).
  • Confirmed resolve_model() returns the correct model string for every tier under the new default.
  • Ran real end-to-end generation calls through the actual ResearchAgent._generate code path (not an isolated litellm smoke test) against prd's OpenRouter credentials — both the DeepSeek (haiku/sonnet) and GPT-5.1 (verify_strong) tiers returned correct, well-cited answers with real token usage.
  • Full live retrieval (pgvector search) wasn't exercised in this session because the local dev DB tunnel wasn't reachable in the sandbox; retrieval-side tuning (Cohere rerank, section-title boost) was already validated separately via the 30-question benchmark in the prior PRs.

Reviewer notes

  • This is a config-only change (MODEL_TIER_MAP in config.py); no service code hardcodes a model. Takes effect only once LLM_API_KEY/LLM_API_BASE are set in Doppler for the target config — prd already has both set as of this PR.
  • To roll back to Anthropic, see the "Switching back to Anthropic" section in docs/model-routing.md.

🤖 Generated with Claude Code

crewcricle and others added 2 commits August 2, 2026 10:00
Comprehensive record of the ingestion + retrieval investigation this
session: what's been explored and shipped (hierarchical chunking,
jurisdiction/section-title boosts, diversity cap, Cohere rerank, scorer
literalism fixes, DeepEval pilot), what's built but not adopted (query
decomposition - both the destructive prompt regression and the
append-only redesign's still-inconclusive result are documented in
detail), and what's identified but not yet started (state legislation
ingestion gap, pure recall misses, supersession checking, evaluation
methodology).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…_strong to GPT-5.1

Cheap-tier answering (haiku/sonnet + everything aliased to them) now routes
through openrouter/deepseek-v4-flash instead of Anthropic Claude, validated
against the 30-question accuracy benchmark used throughout the RAG-quality
audit. verify_strong is kept as a deliberate exception on GPT-5.1 (also via
OpenRouter) rather than following the alias cascade, preserving a real
capability gap for VerifyAgent's escalation tier. Requires LLM_API_KEY/
LLM_API_BASE set to OpenRouter in Doppler to take effect.

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

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
taxflow-dashboard Ready Ready Preview Aug 2, 2026 10:10am

@crewcricle
crewcricle merged commit 51d5525 into main Aug 8, 2026
7 checks passed
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.

2 participants