- **AI sort-intent no longer fires on a hard sort word buried in a conversational/descriptive query (`src/Http/AiEndpointHandler.php`, `appendSortableFieldsInstruction()`).** Regression (terra-collecta, 2026-06-17): the query *"I am looking for a gift for my friend who likes the cheapest handmade items"* returned `sort_hint: {field: "price", direction: "asc"}` — but "cheapest" there describes the items the friend likes, not a request to order results by price; the user wants gift ideas, not a price-sorted list. The `SORT INTENT` prompt block already carried the buried-phrase/unsorted-list litmus guidance, but its only negative gift example used the **soft** qualifier "affordable", so the model let STEP 4's hard-word mapping (`cheapest` → price asc) override the conversational frame. The prompt now adds an explicit **hard-word** buried negative example (the exact failing gift query) plus two STEP 3 descriptive-frame bullets, and states that a hard sort word (`cheapest`, `most expensive`, `newest`, `oldest`, `longest`, …) embedded in a conversational/descriptive frame is STILL NOT primary sort intent — the framing **overrides** the STEP 4 word→field mapping. STEP 4 fires only when ordering results is the query's whole point. This is an **LLM-adherence** fix: it tightens the prompt without changing the parser. The prompt-construction tests assert the new guidance strings are present; a committed `tests/fixtures/sort-intent-eval.json` battery tracks the failing query, 3 buried-conversational variants (`expectSort: null`), and the true-positive controls (`most expensive stone`→price desc, `cheapest crystals`→price asc, bare `cheapest`→price asc, `pierres les moins chères`→price asc, `newest posts`/`latest news`→date desc, `oldest articles`→date asc) — final verification is the browser regression re-run against the live model, since CI cannot drive the LLM deterministically.
0 commit comments