exa-py 1.7.0__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exa_py-1.7.0 → exa_py-2.1.0}/PKG-INFO +61 -29
- exa_py-2.1.0/README.md +104 -0
- exa_py-2.1.0/exa_py/__init__.py +2 -0
- exa_py-2.1.0/exa_py/api.py +2701 -0
- exa_py-2.1.0/exa_py/research/__init__.py +39 -0
- exa_py-2.1.0/exa_py/research/async_client.py +312 -0
- exa_py-2.1.0/exa_py/research/base.py +165 -0
- exa_py-2.1.0/exa_py/research/models.py +337 -0
- exa_py-2.1.0/exa_py/research/sync_client.py +309 -0
- exa_py-2.1.0/exa_py/research/utils.py +222 -0
- exa_py-2.1.0/exa_py/utils.py +191 -0
- exa_py-2.1.0/exa_py/websets/__init__.py +10 -0
- exa_py-2.1.0/exa_py/websets/async_client.py +153 -0
- exa_py-2.1.0/exa_py/websets/client.py +296 -0
- exa_py-2.1.0/exa_py/websets/core/__init__.py +11 -0
- exa_py-2.1.0/exa_py/websets/core/async_base.py +107 -0
- exa_py-2.1.0/exa_py/websets/core/base.py +130 -0
- exa_py-2.1.0/exa_py/websets/enrichments/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/enrichments/client.py +156 -0
- exa_py-2.1.0/exa_py/websets/events/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/events/client.py +209 -0
- exa_py-2.1.0/exa_py/websets/imports/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/imports/client.py +347 -0
- exa_py-2.1.0/exa_py/websets/items/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/items/client.py +153 -0
- exa_py-2.1.0/exa_py/websets/monitors/__init__.py +4 -0
- exa_py-2.1.0/exa_py/websets/monitors/client.py +132 -0
- exa_py-2.1.0/exa_py/websets/monitors/runs/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/monitors/runs/client.py +56 -0
- exa_py-2.1.0/exa_py/websets/searches/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/searches/client.py +108 -0
- exa_py-2.1.0/exa_py/websets/types.py +2049 -0
- exa_py-2.1.0/exa_py/websets/webhooks/__init__.py +3 -0
- exa_py-2.1.0/exa_py/websets/webhooks/client.py +183 -0
- exa_py-2.1.0/exa_py.egg-info/PKG-INFO +126 -0
- exa_py-2.1.0/exa_py.egg-info/SOURCES.txt +41 -0
- exa_py-2.1.0/pyproject.toml +49 -0
- {exa_py-1.7.0 → exa_py-2.1.0}/setup.py +3 -7
- exa_py-1.7.0/README.md +0 -73
- exa_py-1.7.0/exa_py/__init__.py +0 -1
- exa_py-1.7.0/exa_py/api.py +0 -1385
- exa_py-1.7.0/exa_py/utils.py +0 -78
- exa_py-1.7.0/exa_py.egg-info/PKG-INFO +0 -94
- exa_py-1.7.0/exa_py.egg-info/SOURCES.txt +0 -12
- exa_py-1.7.0/pyproject.toml +0 -25
- {exa_py-1.7.0 → exa_py-2.1.0}/exa_py/py.typed +0 -0
- {exa_py-1.7.0 → exa_py-2.1.0}/exa_py.egg-info/dependency_links.txt +0 -0
- {exa_py-1.7.0 → exa_py-2.1.0}/exa_py.egg-info/requires.txt +0 -0
- {exa_py-1.7.0 → exa_py-2.1.0}/exa_py.egg-info/top_level.txt +0 -0
- {exa_py-1.7.0 → exa_py-2.1.0}/setup.cfg +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: exa_py
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Python SDK for Exa API.
|
|
5
5
|
Home-page: https://github.com/exa-labs/exa-py
|
|
6
6
|
Author: Exa
|
|
7
7
|
Author-email: hello@exa.ai
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
8
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
9
11
|
Classifier: Intended Audience :: Developers
|
|
10
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -15,16 +17,10 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: requests
|
|
19
|
-
Requires-Dist: typing-extensions
|
|
20
|
-
Requires-Dist: openai>=1.10.0
|
|
21
20
|
|
|
22
21
|
# Exa
|
|
23
22
|
|
|
24
|
-
Exa
|
|
25
|
-
|
|
26
|
-
Note: This API is basically the same as `metaphor-python` but reflects new
|
|
27
|
-
features associated with Metaphor's rename to Exa. New site is https://exa.ai
|
|
23
|
+
Exa API in Python
|
|
28
24
|
|
|
29
25
|
## Installation
|
|
30
26
|
|
|
@@ -43,17 +39,12 @@ exa = Exa(api_key="your-api-key")
|
|
|
43
39
|
```
|
|
44
40
|
|
|
45
41
|
## Common requests
|
|
42
|
+
|
|
46
43
|
```python
|
|
47
44
|
|
|
48
45
|
# basic search
|
|
49
46
|
results = exa.search("This is a Exa query:")
|
|
50
47
|
|
|
51
|
-
# autoprompted search
|
|
52
|
-
results = exa.search("autopromptable query", use_autoprompt=True)
|
|
53
|
-
|
|
54
|
-
# keyword search (non-neural)
|
|
55
|
-
results = exa.search("Google-style query", type="keyword")
|
|
56
|
-
|
|
57
48
|
# search with date filters
|
|
58
49
|
results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")
|
|
59
50
|
|
|
@@ -63,14 +54,10 @@ exa = Exa(api_key="your-api-key")
|
|
|
63
54
|
# search and get text contents
|
|
64
55
|
results = exa.search_and_contents("This is a Exa query:")
|
|
65
56
|
|
|
66
|
-
# search and get highlights
|
|
67
|
-
results = exa.search_and_contents("This is a Exa query:", highlights=True)
|
|
68
|
-
|
|
69
57
|
# search and get contents with contents options
|
|
70
|
-
results = exa.search_and_contents("This is a Exa query:",
|
|
71
|
-
text={"include_html_tags": True, "max_characters": 1000}
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
results = exa.search_and_contents("This is a Exa query:",
|
|
59
|
+
text={"include_html_tags": True, "max_characters": 1000})
|
|
60
|
+
|
|
74
61
|
# find similar documents
|
|
75
62
|
results = exa.find_similar("https://example.com")
|
|
76
63
|
|
|
@@ -78,17 +65,62 @@ exa = Exa(api_key="your-api-key")
|
|
|
78
65
|
results = exa.find_similar("https://example.com", exclude_source_domain=True)
|
|
79
66
|
|
|
80
67
|
# find similar with contents
|
|
81
|
-
results = exa.find_similar_and_contents("https://example.com", text=True
|
|
68
|
+
results = exa.find_similar_and_contents("https://example.com", text=True)
|
|
82
69
|
|
|
83
70
|
# get text contents
|
|
84
|
-
results = exa.get_contents(["
|
|
85
|
-
|
|
86
|
-
# get highlights
|
|
87
|
-
results = exa.get_contents(["ids"], highlights=True)
|
|
71
|
+
results = exa.get_contents(["tesla.com"])
|
|
88
72
|
|
|
89
73
|
# get contents with contents options
|
|
90
|
-
results = exa.get_contents(["
|
|
91
|
-
text={"include_html_tags": True, "max_characters": 1000}
|
|
92
|
-
|
|
74
|
+
results = exa.get_contents(["urls"],
|
|
75
|
+
text={"include_html_tags": True, "max_characters": 1000})
|
|
76
|
+
|
|
77
|
+
# basic answer
|
|
78
|
+
response = exa.answer("This is a query to answer a question")
|
|
79
|
+
|
|
80
|
+
# answer with full text
|
|
81
|
+
response = exa.answer("This is a query to answer a question", text=True)
|
|
82
|
+
|
|
83
|
+
# answer with streaming
|
|
84
|
+
response = exa.stream_answer("This is a query to answer:")
|
|
85
|
+
|
|
86
|
+
# Print each chunk as it arrives when using the stream_answer method
|
|
87
|
+
for chunk in response:
|
|
88
|
+
print(chunk, end='', flush=True)
|
|
89
|
+
|
|
90
|
+
# research task example – answer a question with citations
|
|
91
|
+
# Example prompt & schema inspired by the TypeScript example.
|
|
92
|
+
QUESTION = (
|
|
93
|
+
"Summarize the history of San Francisco highlighting one or two major events "
|
|
94
|
+
"for each decade from 1850 to 1950"
|
|
95
|
+
)
|
|
96
|
+
OUTPUT_SCHEMA: Dict[str, Any] = {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"required": ["timeline"],
|
|
99
|
+
"properties": {
|
|
100
|
+
"timeline": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"items": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"required": ["decade", "notableEvents"],
|
|
105
|
+
"properties": {
|
|
106
|
+
"decade": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": 'Decade label e.g. "1850s"',
|
|
109
|
+
},
|
|
110
|
+
"notableEvents": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"description": "A summary of notable events.",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
resp = exa.research.create_task(
|
|
120
|
+
instructions=QUESTION,
|
|
121
|
+
model="exa-research",
|
|
122
|
+
output_schema=OUTPUT_SCHEMA,
|
|
123
|
+
)
|
|
93
124
|
```
|
|
94
125
|
|
|
126
|
+
|
exa_py-2.1.0/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Exa
|
|
2
|
+
|
|
3
|
+
Exa API in Python
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install exa_py
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Import the package and initialize the Exa client with your API key:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from exa_py import Exa
|
|
17
|
+
|
|
18
|
+
exa = Exa(api_key="your-api-key")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Common requests
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
|
|
25
|
+
# basic search
|
|
26
|
+
results = exa.search("This is a Exa query:")
|
|
27
|
+
|
|
28
|
+
# search with date filters
|
|
29
|
+
results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")
|
|
30
|
+
|
|
31
|
+
# search with domain filters
|
|
32
|
+
results = exa.search("This is a Exa query:", include_domains=["www.cnn.com", "www.nytimes.com"])
|
|
33
|
+
|
|
34
|
+
# search and get text contents
|
|
35
|
+
results = exa.search_and_contents("This is a Exa query:")
|
|
36
|
+
|
|
37
|
+
# search and get contents with contents options
|
|
38
|
+
results = exa.search_and_contents("This is a Exa query:",
|
|
39
|
+
text={"include_html_tags": True, "max_characters": 1000})
|
|
40
|
+
|
|
41
|
+
# find similar documents
|
|
42
|
+
results = exa.find_similar("https://example.com")
|
|
43
|
+
|
|
44
|
+
# find similar excluding source domain
|
|
45
|
+
results = exa.find_similar("https://example.com", exclude_source_domain=True)
|
|
46
|
+
|
|
47
|
+
# find similar with contents
|
|
48
|
+
results = exa.find_similar_and_contents("https://example.com", text=True)
|
|
49
|
+
|
|
50
|
+
# get text contents
|
|
51
|
+
results = exa.get_contents(["tesla.com"])
|
|
52
|
+
|
|
53
|
+
# get contents with contents options
|
|
54
|
+
results = exa.get_contents(["urls"],
|
|
55
|
+
text={"include_html_tags": True, "max_characters": 1000})
|
|
56
|
+
|
|
57
|
+
# basic answer
|
|
58
|
+
response = exa.answer("This is a query to answer a question")
|
|
59
|
+
|
|
60
|
+
# answer with full text
|
|
61
|
+
response = exa.answer("This is a query to answer a question", text=True)
|
|
62
|
+
|
|
63
|
+
# answer with streaming
|
|
64
|
+
response = exa.stream_answer("This is a query to answer:")
|
|
65
|
+
|
|
66
|
+
# Print each chunk as it arrives when using the stream_answer method
|
|
67
|
+
for chunk in response:
|
|
68
|
+
print(chunk, end='', flush=True)
|
|
69
|
+
|
|
70
|
+
# research task example – answer a question with citations
|
|
71
|
+
# Example prompt & schema inspired by the TypeScript example.
|
|
72
|
+
QUESTION = (
|
|
73
|
+
"Summarize the history of San Francisco highlighting one or two major events "
|
|
74
|
+
"for each decade from 1850 to 1950"
|
|
75
|
+
)
|
|
76
|
+
OUTPUT_SCHEMA: Dict[str, Any] = {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["timeline"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"timeline": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": ["decade", "notableEvents"],
|
|
85
|
+
"properties": {
|
|
86
|
+
"decade": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": 'Decade label e.g. "1850s"',
|
|
89
|
+
},
|
|
90
|
+
"notableEvents": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "A summary of notable events.",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
resp = exa.research.create_task(
|
|
100
|
+
instructions=QUESTION,
|
|
101
|
+
model="exa-research",
|
|
102
|
+
output_schema=OUTPUT_SCHEMA,
|
|
103
|
+
)
|
|
104
|
+
```
|