Python SDK for Exa API.
Project description
Exa
Exa API in Python
Installation
pip install exa_py
Usage
Import the package and initialize the Exa client with your API key:
from exa_py import Exa
exa = Exa(api_key="your-api-key")
Search Request
response = exa.search("funny article about silicon valley tech culture",
num_results=5,
include_domains=["nytimes.com", "wsj.com"],
start_published_date="2023-06-12"
)
for result in response.results:
print(result.title, result.url)
Find Similar
response = exa.find_similar("https://waitbutwhy.com/2014/05/fermi-paradox.html", num_results=5)
for result in response.results:
print(result.title, result.url)
Retrieve Document Contents
ids = ["8U71IlQ5DUTdsZFherhhYA", "X3wd0PbJmAvhu_DQjDKA7A"]
response = exa.get_contents(ids)
for content in response.contents:
print(content.title, content.url)
Reference
exa.search()
This function performs a search on the Exa API.
Args
- query (str): The search query.
- options: Additional search options. Valid options are:
num_results(int): The number of search results to return.include_domains(list): A list of domains to include in the search.exclude_domains(list): A list of domains to exclude from the search.start_crawl_date(str): The start date for the crawl (in YYYY-MM-DD format).end_crawl_date(str): The end date for the crawl (in YYYY-MM-DD format).start_published_date(str): The start date for when the document was published (in YYYY-MM-DD format).end_published_date(str): The end date for when the document was published (in YYYY-MM-DD format).use_autoprompt(bool): Whether to use autoprompt for the search.type(str): The type of search, 'keyword' or 'neural'. Default: neural
Returns
SearchResponse: A dataclass containing the search results.
exa.find_similar()
Args:
- url (str): The base url to find similar links with.
- options: Additional search options. Valid options are:
num_results(int): The number of search results to return.include_domains(list): A list of domains to include in the search.exclude_domains(list): A list of domains to exclude from the search.start_crawl_date(str): The start date for the crawl (in YYYY-MM-DD format).end_crawl_date(str): The end date for the crawl (in YYYY-MM-DD format).start_published_date(str): The start date for when the document was published (in YYYY-MM-DD format).end_published_date(str): The end date for when the document was published (in YYYY-MM-DD format).
Returns
SearchResponse: A dataclass containing the search results.
Contribution
Contributions to exa-py are very welcome! Feel free to submit pull requests or raise issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exa_py-1.0.7.tar.gz.
File metadata
- Download URL: exa_py-1.0.7.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2fc8861b9f3abb38917716dfbe31422eb4b9afef33aec23c279b3439974a835
|
|
| MD5 |
ec2fd59622893a6d795ba92953998914
|
|
| BLAKE2b-256 |
f9afe194fd507c2303876bbf430cdd3f3b1b8995ac44d0f34be32795fa54da42
|
File details
Details for the file exa_py-1.0.7-py3-none-any.whl.
File metadata
- Download URL: exa_py-1.0.7-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d5a2a21f602a2c14dd1c919e6a79f06d4b10a5441f21be2e5bbb2d76a20596f
|
|
| MD5 |
d5295bd654434d06f105a03e4317999a
|
|
| BLAKE2b-256 |
4b5e01bbc7c5177dbeadab949e300a426677d620e6276e71f11c32c6dbc671f5
|