exa-research
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExa Research & Answer API
Exa Research & Answer API
Quick Reference
快速参考
| Topic | When to Use | Reference |
|---|---|---|
| Answer API | Q&A with citations, grounded responses | answer-api.md |
| Deep Search | Smart query expansion, high-quality summaries | deep-search.md |
| Citations | Source attribution, verification | citations.md |
| 主题 | 适用场景 | 参考文档 |
|---|---|---|
| Answer API | 带引用的问答、有依据的回复 | answer-api.md |
| 深度搜索 | 智能查询扩展、高质量摘要 | deep-search.md |
| 引用 | 来源归因、验证 | citations.md |
Essential Patterns
核心使用模式
Answer API (Python)
Answer API (Python)
python
from exa_py import Exa
exa = Exa()
response = exa.answer(
"What are the key features of Python 3.12?",
text=True
)
print(response.answer)
for citation in response.citations:
print(f"Source: {citation.url}")python
from exa_py import Exa
exa = Exa()
response = exa.answer(
"What are the key features of Python 3.12?",
text=True
)
print(response.answer)
for citation in response.citations:
print(f"Source: {citation.url}")Streaming Answers
流式回答
python
stream = exa.answer(
"Explain the benefits of microservices architecture",
stream=True
)
for chunk in stream:
print(chunk.text, end="", flush=True)python
stream = exa.answer(
"Explain the benefits of microservices architecture",
stream=True
)
for chunk in stream:
print(chunk.text, end="", flush=True)Access citations after streaming
Access citations after streaming
print("\nSources:", stream.citations)
undefinedprint("\nSources:", stream.citations)
undefinedDeep Search with Summaries
带摘要的深度搜索
python
results = exa.search_and_contents(
"latest developments in quantum computing",
type="neural",
num_results=10,
summary=True,
use_autoprompt=True # Smart query expansion
)
for result in results.results:
print(f"{result.title}")
print(f"Summary: {result.summary}")python
results = exa.search_and_contents(
"latest developments in quantum computing",
type="neural",
num_results=10,
summary=True,
use_autoprompt=True # Smart query expansion
)
for result in results.results:
print(f"{result.title}")
print(f"Summary: {result.summary}")When to Use
适用场景
| Feature | Use Case | Output |
|---|---|---|
| Answer API | Direct Q&A needing citations | Answer + source URLs |
| Deep Search | Query expansion + summaries | Enhanced search results |
| Exa Research | Long-form async reports | Structured JSON/Markdown |
| 功能 | 使用案例 | 输出结果 |
|---|---|---|
| Answer API | 需要引用的直接问答 | 答案 + 来源URL |
| 深度搜索 | 查询扩展 + 摘要 | 增强版搜索结果 |
| Exa Research | 长文本异步报告 | 结构化JSON/Markdown |
Common Mistakes
常见错误
- Not using streaming for long answers - Use for better UX on complex questions
stream=True - Ignoring citations - Always include for verifiable responses
response.citations - Missing - Answer API needs content access; include
text=Truetext=True - Over-complex queries - Answer API works best with clear, focused questions
- Not validating citations - Check exists before displaying to users
citation.url
- 长答案未使用流式传输 - 针对复杂问题使用以获得更好的用户体验
stream=True - 忽略引用 - 务必包含以提供可验证的回复
response.citations - 遗漏参数 - Answer API需要内容访问权限,需包含
text=Truetext=True - 查询过于复杂 - Answer API最适合清晰、聚焦的问题
- 未验证引用有效性 - 向用户展示前需检查是否存在
citation.url