feat: add You.com as a search backend#151
Open
ydc-oss-bot wants to merge 1 commit into
Open
Conversation
Add YouComSearch, a new SearchSource implementation that calls the You.com Search API (POST https://api.you.com/v1/agents/search) and maps results/images into MemFree's TextSource/ImageSource shapes. You.com is selectable via the existing (previously unused) `engines` option on SearchOptions: pass `engines: ['youcom']` to getSearchEngine to use it instead of the default Serper backend. Default behavior is unchanged. - Add YDC_API_KEY env var (lib/env.ts, env-example) - Register You.com in getSearchEngine (lib/search/search.ts) - Add YouComSearch class (lib/search/youcom.ts) - Add unit tests (lib/search/tests/youcom.test.ts) - Add moduleNameMapper for @/ alias to jest.config.js so path-aliased runtime imports resolve under jest
Contributor
|
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
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.
What
Adds You.com Search API as a selectable web search backend in MemFree, alongside the existing Serper (Google) and Exa backends.
Why
MemFree supports multiple search engines (Google, Exa, Vector) and CONTRIBUTING.md explicitly invites integrating additional search engines. You.com offers a free tier (100 searches/day, IP-based, no livecrawl) and returns web results + images, making it a natural drop-in alternative web backend.
How
YouComSearchclass (frontend/lib/search/youcom.ts) implementing the existingSearchSourceinterface. It callsPOST https://api.you.com/v1/agents/searchwith theX-API-Keyheader (fromYDC_API_KEY), then mapsresults→TextSource[]andimages→ImageSource[]. It reuses the existingfetchWithTimeouthelper andlogError, mirroringSerperSearch.getSearchEngine(frontend/lib/search/search.ts) via theenginesoption that was already declared onSearchOptionsbut unused. Passingengines: ['youcom']selects You.com; default behavior is unchanged (Serper remains the default for theALL/TWEETcategories, Exa forACADEMIC).YDC_API_KEYtofrontend/lib/env.tsandfrontend/env-example.moduleNameMapperfor the@/path alias tojest.config.jsso path-aliased runtime imports resolve under Jest (previously only type-only@/imports worked because they were erased during transform).frontend/lib/search/tests/youcom.test.ts) covering the request shape/response mapping and the error path.API key
Uses
YDC_API_KEY(the convention used across You.com's own docs and SDKs). Get a free key at https://api.you.com. Optional — if unset, the backend returns an empty result and logs the error, the same way Serper/Exa behave without keys.Testing
cd frontend npx jest lib/search/tests/youcom.test.tsBoth tests pass:
The pre-existing test suite (
local-history,local-limit) is unaffected; the one pre-existing failure inlocal-history.test.tspredates this change.Backward compatibility
No changes to default search behavior. You.com is opt-in via the
enginesoption, so existing users see no difference unless they explicitly select it.