Name | exa-py JSON |
Version |
1.15.6
JSON |
| download |
home_page | None |
Summary | Python SDK for Exa API. |
upload_time | 2025-09-10 01:36:01 |
maintainer | None |
docs_url | None |
author | Exa AI |
requires_python | >=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Exa
Exa API in Python
## Installation
```bash
pip install exa_py
```
## Usage
Import the package and initialize the Exa client with your API key:
```python
from exa_py import Exa
exa = Exa(api_key="your-api-key")
```
## Common requests
```python
# basic search
results = exa.search("This is a Exa query:")
# keyword search (non-neural)
results = exa.search("Google-style query", type="keyword")
# search with date filters
results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")
# search with domain filters
results = exa.search("This is a Exa query:", include_domains=["www.cnn.com", "www.nytimes.com"])
# search and get text contents
results = exa.search_and_contents("This is a Exa query:")
# search and get contents with contents options
results = exa.search_and_contents("This is a Exa query:",
text={"include_html_tags": True, "max_characters": 1000})
# find similar documents
results = exa.find_similar("https://example.com")
# find similar excluding source domain
results = exa.find_similar("https://example.com", exclude_source_domain=True)
# find similar with contents
results = exa.find_similar_and_contents("https://example.com", text=True)
# get text contents
results = exa.get_contents(["tesla.com"])
# get contents with contents options
results = exa.get_contents(["urls"],
text={"include_html_tags": True, "max_characters": 1000})
# basic answer
response = exa.answer("This is a query to answer a question")
# answer with full text
response = exa.answer("This is a query to answer a question", text=True)
# answer with streaming
response = exa.stream_answer("This is a query to answer:")
# Print each chunk as it arrives when using the stream_answer method
for chunk in response:
print(chunk, end='', flush=True)
# research task example – answer a question with citations
# Example prompt & schema inspired by the TypeScript example.
QUESTION = (
"Summarize the history of San Francisco highlighting one or two major events "
"for each decade from 1850 to 1950"
)
OUTPUT_SCHEMA: Dict[str, Any] = {
"type": "object",
"required": ["timeline"],
"properties": {
"timeline": {
"type": "array",
"items": {
"type": "object",
"required": ["decade", "notableEvents"],
"properties": {
"decade": {
"type": "string",
"description": 'Decade label e.g. "1850s"',
},
"notableEvents": {
"type": "string",
"description": "A summary of notable events.",
},
},
},
},
},
}
resp = exa.research.create_task(
instructions=QUESTION,
model="exa-research",
output_schema=OUTPUT_SCHEMA,
)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "exa-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Exa AI",
"author_email": "hello@exa.ai",
"download_url": "https://files.pythonhosted.org/packages/91/4c/3eb7c6d80a5b6beb38752210f5c940c70f65464140db33ae261b2a4825bc/exa_py-1.15.6.tar.gz",
"platform": null,
"description": "# Exa\n\nExa API in Python\n\n## Installation\n\n```bash\npip install exa_py\n```\n\n## Usage\n\nImport the package and initialize the Exa client with your API key:\n\n```python\nfrom exa_py import Exa\n\nexa = Exa(api_key=\"your-api-key\")\n```\n\n## Common requests\n\n```python\n\n # basic search\n results = exa.search(\"This is a Exa query:\")\n\n # keyword search (non-neural)\n results = exa.search(\"Google-style query\", type=\"keyword\")\n\n # search with date filters\n results = exa.search(\"This is a Exa query:\", start_published_date=\"2019-01-01\", end_published_date=\"2019-01-31\")\n\n # search with domain filters\n results = exa.search(\"This is a Exa query:\", include_domains=[\"www.cnn.com\", \"www.nytimes.com\"])\n\n # search and get text contents\n results = exa.search_and_contents(\"This is a Exa query:\")\n\n # search and get contents with contents options\n results = exa.search_and_contents(\"This is a Exa query:\",\n text={\"include_html_tags\": True, \"max_characters\": 1000})\n\n # find similar documents\n results = exa.find_similar(\"https://example.com\")\n\n # find similar excluding source domain\n results = exa.find_similar(\"https://example.com\", exclude_source_domain=True)\n\n # find similar with contents\n results = exa.find_similar_and_contents(\"https://example.com\", text=True)\n\n # get text contents\n results = exa.get_contents([\"tesla.com\"])\n\n # get contents with contents options\n results = exa.get_contents([\"urls\"],\n text={\"include_html_tags\": True, \"max_characters\": 1000})\n\n # basic answer\n response = exa.answer(\"This is a query to answer a question\")\n\n # answer with full text\n response = exa.answer(\"This is a query to answer a question\", text=True)\n\n # answer with streaming\n response = exa.stream_answer(\"This is a query to answer:\")\n\n # Print each chunk as it arrives when using the stream_answer method\n for chunk in response:\n print(chunk, end='', flush=True)\n\n # research task example \u2013 answer a question with citations\n # Example prompt & schema inspired by the TypeScript example.\n QUESTION = (\n \"Summarize the history of San Francisco highlighting one or two major events \"\n \"for each decade from 1850 to 1950\"\n )\n OUTPUT_SCHEMA: Dict[str, Any] = {\n \"type\": \"object\",\n \"required\": [\"timeline\"],\n \"properties\": {\n \"timeline\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"decade\", \"notableEvents\"],\n \"properties\": {\n \"decade\": {\n \"type\": \"string\",\n \"description\": 'Decade label e.g. \"1850s\"',\n },\n \"notableEvents\": {\n \"type\": \"string\",\n \"description\": \"A summary of notable events.\",\n },\n },\n },\n },\n },\n }\n resp = exa.research.create_task(\n instructions=QUESTION,\n model=\"exa-research\",\n output_schema=OUTPUT_SCHEMA,\n )\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for Exa API.",
"version": "1.15.6",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "929c41f032ef35a44262dfe59eeaa4ee6448c9a86fd3b59dbb7448eec9953858",
"md5": "f86e309f6d9039bcfc5fde6a60822c2a",
"sha256": "8bdbe8d9548408f37b895eed7497046bed3e19a84b5f06bf23a540d4e26b636c"
},
"downloads": -1,
"filename": "exa_py-1.15.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f86e309f6d9039bcfc5fde6a60822c2a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 56456,
"upload_time": "2025-09-10T01:36:00",
"upload_time_iso_8601": "2025-09-10T01:36:00.097650Z",
"url": "https://files.pythonhosted.org/packages/92/9c/41f032ef35a44262dfe59eeaa4ee6448c9a86fd3b59dbb7448eec9953858/exa_py-1.15.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "914c3eb7c6d80a5b6beb38752210f5c940c70f65464140db33ae261b2a4825bc",
"md5": "2fac808cb11be12ae6b6b1e2c2b3fdfe",
"sha256": "67bb1c0902956b0e23325cc1f9ee990d21277d77b962a40c8902f5eda2407fff"
},
"downloads": -1,
"filename": "exa_py-1.15.6.tar.gz",
"has_sig": false,
"md5_digest": "2fac808cb11be12ae6b6b1e2c2b3fdfe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 41185,
"upload_time": "2025-09-10T01:36:01",
"upload_time_iso_8601": "2025-09-10T01:36:01.679285Z",
"url": "https://files.pythonhosted.org/packages/91/4c/3eb7c6d80a5b6beb38752210f5c940c70f65464140db33ae261b2a4825bc/exa_py-1.15.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-10 01:36:01",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "exa-py"
}