Skip to content

Search overview: read the top 20, list up to 10 picks, suggest where to start - #749

Merged
neuromechanist merged 5 commits into
developfrom
feature/issue-748-overview-top-picks
Nov 13, 2026
Merged

neuromechanist merged 5 commits into
developfrom
feature/issue-748-overview-top-picks

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Closes #748

A NEMAR maintainer asked for the AI overview of AI Mode search to read more results, put the list of promising datasets first, and talk like a person: say what the search seems to focus on, list the ones that look promising with how each relates, and suggest where to start.

Changes

  • POST /{community}/overview accepts up to 20 results (MAX_RESULTS, was 10).
  • picks holds up to 10 (MAX_PICKS, was 3), each saying how it relates to the search.
  • summary is a short lead-in (asked for in 45 words, held to 60) and may name no result.
  • New suggestion field: where to start, as segments under the same citation filter as the summary, empty when none survives.
  • A reply is an overview when its summary has words and the summary, picks and suggestion together name a result. A cut-off reply is a 502 with its own reason, and a first sentence over twice the cap is dropped.
  • The prompt asks for a warm, conversational voice; it does not state a pick count, and asks for the closest picks when nothing fits.
  • OVERVIEW_MAX_TOKENS goes from 1500 to 3000.
  • Docs: docs/search-overview.md, .context/api-structure.md section 5, CHANGELOG, and the Home design mockup's placeholder ("in natural language").

Compatibility and rollout

Testing

  • tests/test_api/test_overview_unit.py and tests/test_api/test_search_overview.py: 182 pass (new: suggestion parsing, filtering and caps, validity rule incl. foreign-id-only and cut-off replies, cache replay of the suggestion, prompt limits).
  • tests/test_api: 1902 pass.
  • Real-model test (tests/test_integration/test_search_overview_llm.py) not run locally (no key); will check a real overview on the dev server after merge.

Review (round 1, two Sonnet reviewers)

Fixed:

  • The prompt's "if nothing fits" branch led to replies with no picks, a 502; it now asks for the closest picks.
  • The lead-in's example committed to a count ("these six", "top 20") that could disagree with the shown picks; no count now.
  • An id-free injected first sentence was bounded only by the token limit; now dropped over twice the cap.
  • A cut-off reply and a filtered one shared an error reason; now distinct.
  • Filter drops of picks and the suggestion are logged at info.
  • picks has max_length=MAX_PICKS on the response model.
  • Stale max_tokens=1500 in .context/api-structure.md; two stale docstrings.
  • Tests: foreign-id-only reply, cut-off reply, prompt limits, long first sentence of the suggestion, cache replay, real-model word caps loosened to the first-sentence rule and cited_ids asserted; the hardcoded <= 4_000 removed.

Rejected:

  • A validator tying cited_ids to the other fields, and a discriminated Segment union: the server is the only builder of the response, in one function.
  • Narrowing the link filter (word.org drops a sentence): intentionally conservative; a dropped pick is safer than a planted link, and drops are now logged.
  • Moving the shared GOOD reply to the new shape: a summary that cites is still valid, and the new shape has its own tests.
  • Extending the real-model fixture past 6 rows: the dev-server check after merge exercises 20 real rows.
  • Updating the Discover and handoff design mockups: they record the reviewed design at the time.

No round 2: no Critical, fixes under 150 non-test lines, no further contract change.

…s where to start

The prompt now asks for a conversational lead-in, up to 10 picks with how
each relates to the search, and a suggestion field under the same citation
filter. A reply is valid when its summary has words and any part names a
result. Unit and route tests updated (175 pass).
…k count, cut-off reason

The prompt no longer asks for a pick count or names the top 20, and asks
for the closest picks when nothing fits (a reply without picks was a 502).
A first sentence over twice the cap is dropped, a cut-off reply raises
with its own reason, filter drops are logged, and picks carry max_length.
Tests added for each (182 pass).
@neuromechanist
neuromechanist merged commit cb726fc into develop Nov 13, 2026
9 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-748-overview-top-picks branch November 13, 2026 19:08
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.

1 participant