|
1 | 1 | # Exa Search Tool |
2 | 2 |
|
3 | | -AI-powered web search, content extraction, and research using the Exa API. |
| 3 | +AI-powered web search and content extraction using the Exa (formerly Metaphor) API. |
4 | 4 |
|
5 | 5 | ## Description |
6 | 6 |
|
7 | | -Provides four tools for interacting with web content: |
8 | | - |
9 | | -- **`exa_search`** — Neural/keyword web search with domain and date filters |
10 | | -- **`exa_find_similar`** — Find pages similar to a given URL |
11 | | -- **`exa_get_contents`** — Extract full text from URLs |
12 | | -- **`exa_answer`** — Get citation-backed answers to questions |
13 | | - |
14 | | -## Arguments |
15 | | - |
16 | | -### `exa_search` |
17 | | - |
18 | | -| Argument | Type | Required | Default | Description | |
19 | | -| ---------------------- | --------- | -------- | ------- | ----------------------------------------------- | |
20 | | -| `query` | str | Yes | - | The search query (1-500 chars) | |
21 | | -| `num_results` | int | No | `10` | Number of results (1-20) | |
22 | | -| `search_type` | str | No | `auto` | Search mode: "auto", "neural", or "keyword" | |
23 | | -| `include_domains` | list[str] | No | `None` | Only include results from these domains | |
24 | | -| `exclude_domains` | list[str] | No | `None` | Exclude results from these domains | |
25 | | -| `start_published_date` | str | No | `None` | Filter by publish date (ISO 8601) | |
26 | | -| `end_published_date` | str | No | `None` | Filter by publish date (ISO 8601) | |
27 | | -| `include_text` | bool | No | `True` | Include full page text | |
28 | | -| `include_highlights` | bool | No | `False` | Include relevant text highlights | |
29 | | -| `category` | str | No | `None` | Category filter (e.g. "research paper", "news") | |
30 | | - |
31 | | -### `exa_find_similar` |
32 | | - |
33 | | -| Argument | Type | Required | Default | Description | |
34 | | -| ----------------- | --------- | -------- | ------- | --------------------------------------- | |
35 | | -| `url` | str | Yes | - | Source URL to find similar pages for | |
36 | | -| `num_results` | int | No | `10` | Number of results (1-20) | |
37 | | -| `include_domains` | list[str] | No | `None` | Only include results from these domains | |
38 | | -| `exclude_domains` | list[str] | No | `None` | Exclude results from these domains | |
39 | | -| `include_text` | bool | No | `True` | Include full page text | |
40 | | - |
41 | | -### `exa_get_contents` |
42 | | - |
43 | | -| Argument | Type | Required | Default | Description | |
44 | | -| -------------------- | --------- | -------- | ------- | ----------------------------------- | |
45 | | -| `urls` | list[str] | Yes | - | URLs to extract content from (1-10) | |
46 | | -| `include_text` | bool | No | `True` | Include full page text | |
47 | | -| `include_highlights` | bool | No | `False` | Include relevant highlights | |
48 | | - |
49 | | -### `exa_answer` |
50 | | - |
51 | | -| Argument | Type | Required | Default | Description | |
52 | | -| ------------------- | ---- | -------- | ------- | ------------------------------------ | |
53 | | -| `query` | str | Yes | - | The question to answer (1-500 chars) | |
54 | | -| `include_citations` | bool | No | `True` | Include source citations | |
| 7 | +Exa is a neural search engine that understands semantic meaning rather than just keywords. Use this tool for high-quality research, finding similar pages, extracting clean page content, and getting citation-backed answers. |
| 8 | + |
| 9 | +## Tools |
| 10 | + |
| 11 | +### exa_search |
| 12 | +Search the web using Exa's AI-powered neural or keyword search. |
| 13 | + |
| 14 | +| Argument | Type | Required | Default | Description | |
| 15 | +|----------|------|----------|---------|-------------| |
| 16 | +| `query` | str | Yes | - | The search query (1-500 chars) | |
| 17 | +| `num_results` | int | No | `10` | Number of results (1-20) | |
| 18 | +| `search_type` | str | No | `"auto"` | Mode: "auto", "neural" (semantic), or "keyword" | |
| 19 | +| `include_domains` | list | No | `None` | Only include results from these domains | |
| 20 | +| `exclude_domains` | list | No | `None` | Exclude results from these domains | |
| 21 | +| `start_published_date`| str | No | `None` | Filter by publish date start (ISO 8601, e.g. "2024-01-01") | |
| 22 | +| `end_published_date` | str | No | `None` | Filter results published before this date (ISO 8601) | |
| 23 | +| `include_text` | bool | No | `True` | Include full page text in results | |
| 24 | +| `include_highlights` | bool | No | `False` | Include relevant text highlights | |
| 25 | +| `category` | str | No | `None` | Category filter (e.g. "research paper", "news", "company") | |
| 26 | + |
| 27 | +### exa_find_similar |
| 28 | +Find web pages semantically similar to a given URL. |
| 29 | + |
| 30 | +| Argument | Type | Required | Default | Description | |
| 31 | +|----------|------|----------|---------|-------------| |
| 32 | +| `url` | str | Yes | - | The source URL to find similar pages for | |
| 33 | +| `num_results` | int | No | `10` | Number of similar results (1-20) | |
| 34 | +| `include_domains` | list | No | `None` | Only include results from these domains | |
| 35 | +| `exclude_domains` | list | No | `None` | Exclude results from these domains | |
| 36 | +| `include_text` | bool | No | `True` | Include full page text in results | |
| 37 | + |
| 38 | +### exa_get_contents |
| 39 | +Extract clean content (text and highlights) from one or more URLs. |
| 40 | + |
| 41 | +| Argument | Type | Required | Default | Description | |
| 42 | +|----------|------|----------|---------|-------------| |
| 43 | +| `urls` | list | Yes | - | List of URLs to extract content from (1-10 URLs) | |
| 44 | +| `include_text` | bool | No | `True` | Include full page text | |
| 45 | +| `include_highlights` | bool | No | `False` | Include relevant text highlights | |
| 46 | + |
| 47 | +### exa_answer |
| 48 | +Get a direct answer to a question with citations from web sources. |
| 49 | + |
| 50 | +| Argument | Type | Required | Default | Description | |
| 51 | +|----------|------|----------|---------|-------------| |
| 52 | +| `query` | str | Yes | - | The question to answer (1-500 chars) | |
| 53 | +| `include_citations` | bool | No | `True` | Include source citations in the response | |
| 54 | + |
| 55 | +### Specialized Search Wrappers |
| 56 | + |
| 57 | +The toolkit also includes convenience wrappers for specific content types: |
| 58 | +- **exa_search_news**: Pre-configured for recent news with `days_back` filter. |
| 59 | +- **exa_search_papers**: Pre-configured for research papers with `year_start` filter. |
| 60 | +- **exa_search_companies**: Pre-configured for company and startup discovery. |
55 | 61 |
|
56 | 62 | ## Environment Variables |
57 | 63 |
|
58 | | -| Variable | Required | Description | |
59 | | -| ------------- | -------- | --------------------------------------------------------------- | |
60 | | -| `EXA_API_KEY` | Yes | API key from [Exa Dashboard](https://dashboard.exa.ai/api-keys) | |
| 64 | +| Variable | Required | Description | |
| 65 | +|----------|----------|-------------| |
| 66 | +| `EXA_API_KEY` | Yes | API key from [Exa Dashboard](https://dashboard.exa.ai/) | |
61 | 67 |
|
62 | 68 | ## Example Usage |
63 | 69 |
|
64 | 70 | ```python |
65 | | -# Neural web search |
66 | | -result = exa_search(query="latest advances in quantum computing") |
67 | | - |
68 | | -# Search with filters |
69 | | -result = exa_search( |
70 | | - query="AI safety research", |
71 | | - search_type="neural", |
72 | | - include_domains=["arxiv.org", "openai.com"], |
73 | | - start_published_date="2024-01-01", |
74 | | - num_results=5, |
75 | | -) |
76 | | - |
77 | | -# Find pages similar to a URL |
78 | | -result = exa_find_similar(url="https://example.com/article") |
79 | | - |
80 | | -# Extract content from URLs |
81 | | -result = exa_get_contents(urls=["https://example.com/page1", "https://example.com/page2"]) |
82 | | - |
83 | | -# Get a citation-backed answer |
84 | | -result = exa_answer(query="What are the main causes of climate change?") |
| 71 | +# Semantic search for specific topics |
| 72 | +result = exa_search(query="latest breakthroughs in battery technology", category="research paper") |
| 73 | + |
| 74 | +# Find similar content |
| 75 | +result = exa_find_similar(url="https://example.com/blog-post") |
| 76 | + |
| 77 | +# Get an answer with citations |
| 78 | +result = exa_answer(query="What are the current top 3 AI companies in Japan?") |
| 79 | + |
| 80 | +# Search recent news |
| 81 | +result = exa_search_news(query="Nvidia stock", days_back=2) |
85 | 82 | ``` |
86 | 83 |
|
87 | 84 | ## Error Handling |
88 | 85 |
|
89 | 86 | Returns error dicts for common issues: |
90 | | - |
91 | | -- `Exa credentials not configured` - EXA_API_KEY not set |
92 | | -- `Query must be 1-500 characters` - Empty or too long query |
93 | | -- `URL is required` - Missing URL for find_similar |
94 | | -- `At least one URL is required` - Empty URL list for get_contents |
95 | | -- `Maximum 10 URLs per request` - Too many URLs for get_contents |
| 87 | +- `Exa credentials not configured` - Missing `EXA_API_KEY` |
96 | 88 | - `Invalid Exa API key` - API key rejected (401) |
97 | 89 | - `Exa rate limit exceeded` - Too many requests (429) |
98 | | -- `Exa search request timed out` - Request exceeded 30s timeout |
| 90 | +- `Query must be 1-500 characters` - Invalid query length |
| 91 | +- `Maximum 10 URLs per request` - URL list too long for `exa_get_contents` |
| 92 | +- `Exa search request timed out` - Request timed out (30s) |
0 commit comments