fix(evaluation): Force tool choice for metrics - #1203
AkhileshNegi wants to merge 1 commit into
Conversation
Fast eval runs left tool_choice at auto. Models that decline to call file_search — gpt-4.1 in practice — return no chunks, so the knowledge_base metric is dropped on every row and "Adherence to Knowledge Base" comes back blank for the whole run. Force the tool wherever we already request file_search_call.results. The metric now measures groundedness given retrieval instead of the model's willingness to retrieve, so scores shift on every model. Co-Authored-By: Claude Opus 5 (1M context) <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 ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
Issue
Closes #PLEASE_TYPE_ISSUE_NUMBER
Summary
run_response_chunkrequestedfile_search_call.resultsbut lefttool_choiceat the model default, leading to emptyretrieved_chunksand dropping theknowledge_basemetric.Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
Single-line behavioural change plus the comment that documented the old choice. Worth a real gpt-4.1 run against a KB-backed config before merging, to confirm the chunks come back and the metric populates.
Original PR description
Issue
No issue filed — reported directly: "Adherence to Knowledge Base" comes back empty on every fast evaluation run using
gpt-4.1.Summary
run_response_chunkrequestedfile_search_call.resultsbut lefttool_choiceat the model default (auto). A model that declines to callfile_searchreturns no hits, soretrieved_chunksis empty,_applicable_metricsdrops theknowledge_basemetric for that row, and the trace records anN/Awith "Knowledge base not queried." gpt-4.1 declines in practice, so the whole run shows a blank KB score while ground-truth and prompt adherence score normally.The judge itself is fine — it runs on the shared
EVAL_JUDGE_MODEL, which is why the symptom could only originate on the response-generation side.This forces the tool in the same place we already request the results.
Behaviour change to be aware of: the metric now measures groundedness given retrieval rather than the model's willingness to retrieve. Scores will move on every model, not just gpt-4.1, and previously-blank rows will now carry a number.
Follow-up, deliberately not in this PR: with retrieval forced, empty chunks no longer mean "not queried" — they mean the store returned no hits. The
"Knowledge base not queried."reason string in the trace builder is now misleading and should be reworded separately.Checklist
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
Single-line behavioural change plus the comment that documented the old choice. Worth a real gpt-4.1 run against a KB-backed config before merging, to confirm the chunks come back and the metric populates.
🤖 Generated with Claude Code