exa-research

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Exa Research & Answer API

Exa Research & Answer API

Quick Reference

快速参考

TopicWhen to UseReference
Answer APIQ&A with citations, grounded responsesanswer-api.md
Deep SearchSmart query expansion, high-quality summariesdeep-search.md
CitationsSource attribution, verificationcitations.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)
undefined
print("\nSources:", stream.citations)
undefined

Deep 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

适用场景

FeatureUse CaseOutput
Answer APIDirect Q&A needing citationsAnswer + source URLs
Deep SearchQuery expansion + summariesEnhanced search results
Exa ResearchLong-form async reportsStructured JSON/Markdown
功能使用案例输出结果
Answer API需要引用的直接问答答案 + 来源URL
深度搜索查询扩展 + 摘要增强版搜索结果
Exa Research长文本异步报告结构化JSON/Markdown

Common Mistakes

常见错误

  1. Not using streaming for long answers - Use
    stream=True
    for better UX on complex questions
  2. Ignoring citations - Always include
    response.citations
    for verifiable responses
  3. Missing
    text=True
    - Answer API needs content access; include
    text=True
  4. Over-complex queries - Answer API works best with clear, focused questions
  5. Not validating citations - Check
    citation.url
    exists before displaying to users
  1. 长答案未使用流式传输 - 针对复杂问题使用
    stream=True
    以获得更好的用户体验
  2. 忽略引用 - 务必包含
    response.citations
    以提供可验证的回复
  3. 遗漏
    text=True
    参数
    - Answer API需要内容访问权限,需包含
    text=True
  4. 查询过于复杂 - Answer API最适合清晰、聚焦的问题
  5. 未验证引用有效性 - 向用户展示前需检查
    citation.url
    是否存在