Skip to content

feat(exa): add attribution header and expose full search surface#5

Merged
tao-hpu merged 1 commit into
fim-ai:masterfrom
tgonzalezc5:feat/exa-attribution-and-features
Apr 21, 2026
Merged

feat(exa): add attribution header and expose full search surface#5
tao-hpu merged 1 commit into
fim-ai:masterfrom
tgonzalezc5:feat/exa-attribution-and-features

Conversation

@tgonzalezc5

Copy link
Copy Markdown
Contributor

Summary

Enhances the existing Exa search backend (src/fim_one/core/web/search/exa.py) to close gaps against the current Exa Search API reference:

  • Sends x-exa-integration: fim-one on every request so API usage is attributed back to the FIM One integration in Exa's maintainer view (attribution only; no per-user data).
  • Supports all current search types (auto/neural/fast/deep-lite/deep/deep-reasoning/instant) via EXA_SEARCH_TYPE.
  • Requests highlights + text together (and optional summary), and cascades the result snippet through whichever fields the API populates, matching the Exa docs' multi-content semantics.
  • Exposes Exa's filtering surface: category, includeDomains, excludeDomains, startPublishedDate, endPublishedDate, and maxAgeHours — all configurable via constructor args or env vars so get_web_searcher() still selects Exa generically.
  • Validates search_type and category on construction (fail fast on typos).
  • Documents the new knobs in example.env.

Fully backwards-compatible: default behaviour (type: "auto", text + highlights, 800-char snippets) is a strict upgrade over the previous text-only mode, and ExaSearch(api_key=...) keeps working unchanged.

Example

from fim_one.core.web.search import ExaSearch

searcher = ExaSearch(
    search_type="neural",
    category="research paper",
    include_domains=["arxiv.org", "nature.com"],
    max_age_hours=24 * 30,
)
results = await searcher.search("superconductor breakthrough", num_results=10)
# results[i].snippet cascades: highlights -> text -> summary

Or entirely via env:

EXA_API_KEY=exa_...
EXA_SEARCH_TYPE=fast
EXA_CATEGORY=news
EXA_INCLUDE_DOMAINS=nytimes.com,reuters.com
EXA_MAX_AGE_HOURS=24

Files changed

  • src/fim_one/core/web/search/exa.py — payload builder, snippet cascade, env-driven config, attribution header
  • tests/test_web_providers.py — unit tests for snippet cascade, payload shape, env var resolution, attribution header on the wire
  • example.env — document new EXA_* variables

Test plan

  • uv run ruff check src/fim_one/core/web/search/exa.py tests/test_web_providers.py — passes
  • uv run mypy src/fim_one/core/web/search/exa.py — passes
  • uv run pytest tests/test_web_providers.py — 50 tests pass (18 new, all green)
  • uv run pytest tests/ --ignore=tests/test_sandbox_backend.py — 3060 tests pass, no regressions (Docker sandbox suite requires a local Docker daemon and was not run)
  • Manual smoke test against live Exa API with a real EXA_API_KEY (not run in this environment; recommend a maintainer verify)

…surface

Closes gaps against https://exa.ai/docs/reference/search:

- Send `x-exa-integration: fim-one` so API usage is attributed back to
  the FIM One integration in Exa's maintainer view.
- Support all current search types (auto/neural/fast/deep-lite/deep/
  deep-reasoning/instant) via EXA_SEARCH_TYPE.
- Request highlights + text together (and optional summary) and cascade
  the snippet through whichever fields the API populated.
- Expose category, include/exclude domains, published-date range, and
  maxAgeHours, all configurable via env vars.
- Document the new knobs in example.env.
- Add focused unit tests for snippet cascade, payload shape, env var
  resolution, and the attribution header on the wire.
@tao-hpu tao-hpu merged commit 78acc03 into fim-ai:master Apr 21, 2026
tao-hpu added a commit that referenced this pull request Apr 21, 2026
…butor

Credits PR #5 author (Exa integration expansion) in the all-contributors
wall with Code + Tests emoji. First Founding Contributor under the
Pioneer Program.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tao-hpu

tao-hpu commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution, @tgonzalezc5! Merged.

The integration attribution header and the full search-type surface (including deep-reasoning and instant) are both nice upgrades for our users — appreciate you closing the gap against the latest Exa Search API reference in one pass.

@tao-hpu

tao-hpu commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

@tgonzalezc5 — noticed DMs are closed on X. If there's an email or Slack channel for partnership-related follow-ups (OSS/startup credits, Featured Integration listing, co-marketing, etc.), happy to take it there. Otherwise no worries — the integration ships either way.

tao-hpu added a commit that referenced this pull request Apr 22, 2026
Add auto (Exa's recommended default) to the search-type list and split
recency into date ranges + max-age windows to match the actual filter
semantics. Prevents copy drift between the partner-facing email and the
public docs page.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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