Skip to content

bench: pass Exa search highlights through as snippets - #61

Closed
kesku wants to merge 1 commit into
hazeydata:mainfrom
kesku:exa-search-highlights
Closed

kesku wants to merge 1 commit into
hazeydata:mainfrom
kesku:exa-search-highlights

Conversation

@kesku

@kesku kesku commented Nov 23, 2026

Copy link
Copy Markdown

Disclosure: I work at Exa.

Part 1 of #60.

_exa_search set snippet: None for every result. That means the 43 snippet_contains rows in search_evergreen could only match Exa result titles, while the Tavily adapter passes up to 300 characters of content.

This change:

  • adds contents: {"highlights": true} to the /search request.
  • maps the joined highlights to snippet, cut to 300 characters to match the Tavily adapter's content[:300].
  • keeps snippet: None when a result has no highlights, which is the current behaviour.

billed_units stays at 1, because highlights on /search are part of the search base price. I sent live /search calls with highlights for the 43 snippet_contains queries. Each reported costDollars.total 0.007, the same as without highlights, which is the Auto search price for up to 10 results on exa.ai/pricing. The per-page Contents charge on that page applies to the /contents endpoint. bench/pricing.yaml is unchanged.

Tests

The new ExaSearchHighlights class has two tests, both using a mocked urlopen:

  • the exact request body, URL, method, key header and timeout.
  • the snippet mapping: joined highlights, the 300-character cut, empty or missing highlights giving None, and a snippet_contains match through checks.search_check.

./run_tests.sh locally (macOS, Python 3.12): 545 passed, 5 failed. The same 5 tests fail on unmodified main in the same environment:

  • RunTestsTmpGuard::test_planted_awi_bd_dir_fails
  • RunTestsTmpGuard::test_planted_awi_test_dir_fails
  • TavilyPhase0::test_latest_json_tavily_rows_match_pricing_yaml
  • TinyFishAdapters::test_tinyfish_rows_in_latest_json
  • NewsfetchFix001::test_ac5_plain_fetch_rejects_non_http_and_latest_legacy_does_not_open

I haven't rerun the benchmark, so the effect on published scores will show up in the next scheduled run.

The Exa adapter set snippet to None, so snippet_contains checks could only
match result titles. Request contents.highlights on /search and map the
joined highlights to a 300-character snippet, the same budget the Tavily
adapter uses for content. Results without highlights keep snippet None.

Refs hazeydata#60

Copy link
Copy Markdown
Contributor

Thanks, Kes, for this PR. #63 makes the same Exa highlights fix and applies it to every provider, so we're closing this in favor of it. The credit and full details are on #60.

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