Repository navigation
Conversation
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
Contributor
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.
Disclosure: I work at Exa.
Part 1 of #60.
_exa_searchsetsnippet: Nonefor every result. That means the 43snippet_containsrows insearch_evergreencould only match Exa result titles, while the Tavily adapter passes up to 300 characters ofcontent.This change:
contents: {"highlights": true}to the/searchrequest.snippet, cut to 300 characters to match the Tavily adapter'scontent[:300].snippet: Nonewhen a result has no highlights, which is the current behaviour.billed_unitsstays at 1, because highlights on/searchare part of the search base price. I sent live/searchcalls with highlights for the 43snippet_containsqueries. Each reportedcostDollars.total0.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/contentsendpoint.bench/pricing.yamlis unchanged.Tests
The new
ExaSearchHighlightsclass has two tests, both using a mockedurlopen:None, and asnippet_containsmatch throughchecks.search_check../run_tests.shlocally (macOS, Python 3.12): 545 passed, 5 failed. The same 5 tests fail on unmodifiedmainin the same environment:RunTestsTmpGuard::test_planted_awi_bd_dir_failsRunTestsTmpGuard::test_planted_awi_test_dir_failsTavilyPhase0::test_latest_json_tavily_rows_match_pricing_yamlTinyFishAdapters::test_tinyfish_rows_in_latest_jsonNewsfetchFix001::test_ac5_plain_fetch_rejects_non_http_and_latest_legacy_does_not_openI haven't rerun the benchmark, so the effect on published scores will show up in the next scheduled run.