feat: add Exa AI-powered search tool#255
Open
tgonzalezc5 wants to merge 1 commit intoAlibaba-NLP:mainfrom
Open
feat: add Exa AI-powered search tool#255tgonzalezc5 wants to merge 1 commit intoAlibaba-NLP:mainfrom
tgonzalezc5 wants to merge 1 commit intoAlibaba-NLP:mainfrom
Conversation
Adds Exa as an additional option for web search and Google Scholar search in inference/, alongside the existing Serper backend. Behavior is selected at runtime via the SEARCH_PROVIDER environment variable and defaults to "serper" so existing deployments are unaffected. - inference/tool_exa.py: Exa client wrapper, typed ExaResult dataclass, shared snippet/result formatting helpers used by both tool_search and tool_scholar - inference/tool_search.py: route to Exa when SEARCH_PROVIDER=exa - inference/tool_scholar.py: route to Exa (research-paper category) when SEARCH_PROVIDER=exa - requirements.txt: add exa-py>=2.0.0 - .env.example: document SEARCH_PROVIDER and EXA_API_KEY - inference/tests/test_tool_exa.py: unit tests for response parsing, snippet fallback, integration header, and missing-key behavior
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.
Summary
Adds Exa as an additional option for web search and Google Scholar search in
inference/, alongside the existing Serper backend. Selection is runtime via theSEARCH_PROVIDERenvironment variable and defaults toserper, so existing deployments are unaffected.inference/tool_exa.pywith a typedExaResultdataclass and shared snippet/result formattingtool_search.pyandtool_scholar.pyroute to Exa whenSEARCH_PROVIDER=exaresearch papercategoryhighlights->summary-> truncatedtextso any combination of returned content fields produces a usable snippetrequirements.txt: addsexa-py>=2.0.0.env.example: documentsSEARCH_PROVIDERandEXA_API_KEYinference/tests/test_tool_exa.pycovering response parsing, snippet fallback, thex-exa-integrationattribution header, and the missing-key disabled stateUsage
# .env SEARCH_PROVIDER=exa EXA_API_KEY=your_exa_keyWhen
SEARCH_PROVIDERis unset or set toserper, the existing Serper code path is used unchanged.Files changed
inference/tool_exa.py(new)inference/tool_search.py(route bySEARCH_PROVIDER)inference/tool_scholar.py(route bySEARCH_PROVIDER)inference/tests/test_tool_exa.py(new)inference/tests/__init__.py(new)requirements.txt(addexa-py>=2.0.0).env.example(addSEARCH_PROVIDER,EXA_API_KEY)Test plan
python -m unittest inference.tests.test_tool_exapasses locally (5 tests)python -m py_compile)SEARCH_PROVIDERvalue preserves existing Serper behaviorEXA_API_KEY)