Skip to content

Commit 8d14405

Browse files
authored
docs: update Exa integration for v1.1.0 - new search types, parameters, and examples (#417)
1 parent 8ecbc4f commit 8d14405

1 file changed

Lines changed: 67 additions & 7 deletions

File tree

integrations/exa.md

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ pip install exa-haystack
2828

2929
### Components
3030

31-
- **ExaWebSearch**: AI-powered web search (auto, fast, deep modes)
31+
- **ExaWebSearch**: AI-powered web search with multiple speed/quality modes (`auto`, `instant`, `fast`, `deep`, `deep-reasoning`, `deep-max`, `neural`)
3232
- **ExaFindSimilar**: Find pages similar to a URL
33-
- **ExaContents**: Fetch full content for URLs
34-
- **ExaAnswer**: Get AI-powered answers with citations
35-
- **ExaStreamAnswer**: Streaming answers with SSE
33+
- **ExaContents**: Fetch full content for URLs with freshness control
34+
- **ExaAnswer**: Get AI-powered answers with citations and optional structured output
35+
- **ExaStreamAnswer**: Streaming answers with SSE and optional structured output
3636
- **ExaResearch**: Deep research with automatic source gathering
3737

3838
## Usage
@@ -42,8 +42,42 @@ pip install exa-haystack
4242
```python
4343
from haystack_integrations.components.websearch.exa import ExaWebSearch
4444

45-
search = ExaWebSearch(num_results=5)
45+
search = ExaWebSearch(num_results=5, type="auto", text=True)
4646
results = search.run(query="latest AI developments")
47+
48+
for doc in results["documents"]:
49+
print(doc.meta["title"], doc.meta["url"])
50+
```
51+
52+
Use `type="instant"` for sub-150ms searches, `type="deep"` or `type="deep-reasoning"` for higher-quality results, or `type="auto"` (default) to let Exa choose.
53+
54+
#### Category Filtering
55+
56+
```python
57+
search = ExaWebSearch(num_results=5, category="research paper")
58+
results = search.run(query="transformer architectures")
59+
```
60+
61+
Available categories: `company`, `research paper`, `news`, `pdf`, `tweet`, `personal site`, `financial report`, `people`.
62+
63+
#### Content Freshness
64+
65+
```python
66+
search = ExaWebSearch(num_results=5, max_age_hours=24, text=True)
67+
results = search.run(query="breaking news today")
68+
```
69+
70+
Use `max_age_hours` to control content freshness: `0` = always livecrawl, `-1` = cache only, positive integer = max cache age in hours.
71+
72+
#### Structured Deep Search Output
73+
74+
```python
75+
search = ExaWebSearch(
76+
type="deep",
77+
output_schema={"type": "object", "properties": {"summary": {"type": "string"}}},
78+
)
79+
results = search.run(query="AI in healthcare")
80+
print(results["deep_output"]) # Structured output from deep search
4781
```
4882

4983
### Find Similar Pages
@@ -60,8 +94,15 @@ results = similar.run(url="https://example.com/article")
6094
```python
6195
from haystack_integrations.components.websearch.exa import ExaContents
6296

63-
contents = ExaContents()
97+
contents = ExaContents(text=True, max_age_hours=0)
6498
results = contents.run(urls=["https://example.com/page1", "https://example.com/page2"])
99+
100+
for doc in results["documents"]:
101+
print(doc.meta["title"], len(doc.content), "chars")
102+
103+
# Per-URL status info
104+
for status in results["statuses"]:
105+
print(status["id"], status["status"])
65106
```
66107

67108
### AI-Powered Answers
@@ -72,6 +113,24 @@ from haystack_integrations.components.websearch.exa import ExaAnswer
72113
answer = ExaAnswer()
73114
result = answer.run(query="What is retrieval augmented generation?")
74115
print(result["answer"])
116+
117+
for citation in result["citations"]:
118+
print(citation.meta["title"], citation.meta["url"])
119+
```
120+
121+
#### Structured Answer Output
122+
123+
```python
124+
answer = ExaAnswer(
125+
output_schema={
126+
"type": "object",
127+
"properties": {
128+
"summary": {"type": "string"},
129+
"key_points": {"type": "array", "items": {"type": "string"}},
130+
},
131+
}
132+
)
133+
result = answer.run(query="What is RAG?")
75134
```
76135

77136
### Streaming Answers
@@ -80,7 +139,8 @@ print(result["answer"])
80139
from haystack_integrations.components.websearch.exa import ExaStreamAnswer
81140

82141
stream = ExaStreamAnswer()
83-
for chunk in stream.run(query="Explain quantum computing"):
142+
result = stream.run(query="Explain quantum computing")
143+
for chunk in result["stream"]:
84144
print(chunk, end="", flush=True)
85145
```
86146

0 commit comments

Comments
 (0)