feat(exa): align Exa client with current API conventions#689
Open
tgonzalezc5 wants to merge 1 commit intothunderbird:mainfrom
Open
feat(exa): align Exa client with current API conventions#689tgonzalezc5 wants to merge 1 commit intothunderbird:mainfrom
tgonzalezc5 wants to merge 1 commit intothunderbird:mainfrom
Conversation
- Drop `useAutoprompt: true` from search options — no longer documented in the `/search` reference. `type: 'fast'` is preserved for low latency. - Add `maxAgeHours: 24` to `getContents` options — the documented successor to the deprecated `livecrawl` enum. Pages cached within the last 24 hours are served as-is; older pages trigger a live crawl bounded by the existing `livecrawlTimeout`. - Set `x-exa-integration: thunderbolt` on the Exa client so the Exa team can attribute API usage to this repository. Extract client construction into `createExaClient` so the header attachment is testable. Tests cover the new header, the absence of `useAutoprompt`, and the `maxAgeHours` parameter on all `getContents` call-site assertions.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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
Three small adjustments to
backend/src/pro/exa.tsto align with the current Exa API reference (https://exa.ai/docs/reference/search) and improve observability:useAutoprompt: truefrom/searchoptions. The parameter is no longer documented in the current Exa API reference;type: 'fast'is preserved so latency behavior is unchanged.maxAgeHours: 24togetContents.maxAgeHoursis the documented successor to the now-deprecatedlivecrawlenum and lets the API serve cached content under 24h old while still live-crawling older pages within the existinglivecrawlTimeout.x-exa-integration: thunderboltheader on the Exa client. This lets the Exa team attribute API usage to this repository, which helps with support and tracking integration health. No behavior change for end users.Code
Notes
exa-jsv1.10.2 does not yet typemaxAgeHours, so a narrowContentsOptions & { maxAgeHours?: number }type is used at the call site. The SDK spreads unknown options into the request body, so the field reaches the API unchanged.headersproperty on theExaclass is markedprivatein the SDK types but is a runtimeHeadersinstance. Theas unknown as { headers: Headers }cast is intentional and documented inline.Files changed
backend/src/pro/exa.ts— dropuseAutoprompt, addmaxAgeHours, extractcreateExaClienthelper that setsx-exa-integration.backend/src/pro/exa.test.ts— update existing assertions, add tests for the new header and for the absence ofuseAutoprompt.Test plan
bun test src/pro/exa.test.ts— 27/27 pass (up from 25, added 2 new tests).bun run type-check— no new errors introduced (pre-existing@types/reactresolution errors in unrelated files are unchanged).EXA_API_KEY— not run locally; verifying on a deployment would confirm the attribution header reaches Exa.Note
Low Risk
Low risk: small request-option tweaks and an extra attribution header, with coverage added/updated in tests. Main risk is subtle behavior change in Exa search/content freshness due to dropping
useAutopromptand introducing caching viamaxAgeHours.Overview
Aligns the Exa integration with the current API by removing the undocumented
useAutopromptflag from/searchrequests.Updates
/fetch-contentcalls to includemaxAgeHours: 24(typed via a narrowContentsOptionsextension) to prefer cached results while keeping the existinglivecrawlTimeout.Adds a
createExaClienthelper that setsx-exa-integration: thunderbolton the Exa client, and updates/extends tests to assert the new options/header behavior.Reviewed by Cursor Bugbot for commit b6abb57. Bugbot is set up for automated code reviews on this repo. Configure here.