Preserve user facts and constraints when rewriting search queries - #99
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Problem / Motivation
A request about Opus 5.5 was rewritten to a search for Opus 4.5. The classifier response passed structural validation, so discovery researched the wrong version. The final answer then treated that mismatched evidence as a reason to correct the user's request.
What changed
Make faithful search rewriting the primary classifier instruction. Preserve names, versions, dates, quantities, units, budgets, comparison subjects and exclusions. Remove filler without changing facts or inventing qualifiers. The prompt includes examples and requires comparing the proposed query with the request before submission. Validation for dotted numeric constraints remains a secondary safeguard. A changed, omitted or invented number triggers the existing repair attempt. If repair still fails, the run stops before searching the wrong subject.
Comparisons may retain versions supplied in earlier user messages. Requests without explicit dotted numbers keep their existing behavior. This check does not depend on a product release catalog.
Tests
The captured rewrite failed a regression test before the fix. The full platform and container suites passed, followed by 56 focused router tests and a final type check. Cases cover substitution, omission, added versions, valid refinements, version prefixes, punctuation and follow-up comparisons.
All 11 live classifier checks passed using the configured Fireworks GLM model. The four fact-preservation cases passed on their first attempt, covering Opus 5.5, model size and RAM with no GPU, meal time/calorie limits, and camera model/year/exclusions.
The reported 18.637-second transcript call was also inspected. Extraction and retry gaps took 13.170 seconds; surrounding application work took 5.467 seconds. The longest successful proxy attempt took 10.735 seconds. This PR does not change transcript transport or claim to fix that latency. No production deployment was performed.