exa-py 1.8.9__tar.gz → 1.9.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.
Potentially problematic release.
This version of exa-py might be problematic. Click here for more details.
- {exa_py-1.8.9 → exa_py-1.9.0}/PKG-INFO +11 -13
- {exa_py-1.8.9 → exa_py-1.9.0}/exa_py/api.py +31 -2
- {exa_py-1.8.9 → exa_py-1.9.0}/pyproject.toml +1 -1
- exa_py-1.8.9/exa_py.egg-info/PKG-INFO +0 -108
- exa_py-1.8.9/exa_py.egg-info/SOURCES.txt +0 -12
- exa_py-1.8.9/exa_py.egg-info/dependency_links.txt +0 -1
- exa_py-1.8.9/exa_py.egg-info/requires.txt +0 -3
- exa_py-1.8.9/exa_py.egg-info/top_level.txt +0 -1
- exa_py-1.8.9/setup.cfg +0 -4
- exa_py-1.8.9/setup.py +0 -26
- {exa_py-1.8.9 → exa_py-1.9.0}/README.md +0 -0
- {exa_py-1.8.9 → exa_py-1.9.0}/exa_py/__init__.py +0 -0
- {exa_py-1.8.9 → exa_py-1.9.0}/exa_py/py.typed +0 -0
- {exa_py-1.8.9 → exa_py-1.9.0}/exa_py/utils.py +0 -0
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 1.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: exa-py
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Python SDK for Exa API.
|
|
5
|
-
|
|
6
|
-
Author: Exa
|
|
5
|
+
Author: Exa AI
|
|
7
6
|
Author-email: hello@exa.ai
|
|
8
|
-
|
|
9
|
-
Classifier:
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Typing :: Typed
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
7
|
+
Requires-Python: >=3.9,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: openai (>=1.48,<2.0)
|
|
15
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
16
|
+
Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: requests
|
|
19
|
-
Requires-Dist: typing-extensions
|
|
20
|
-
Requires-Dist: openai>=1.10.0
|
|
21
18
|
|
|
22
19
|
# Exa
|
|
23
20
|
|
|
@@ -106,3 +103,4 @@ exa = Exa(api_key="your-api-key")
|
|
|
106
103
|
|
|
107
104
|
```
|
|
108
105
|
|
|
106
|
+
|
|
@@ -47,6 +47,12 @@ def snake_to_camel(snake_str: str) -> str:
|
|
|
47
47
|
Returns:
|
|
48
48
|
str: The string converted to camelCase format.
|
|
49
49
|
"""
|
|
50
|
+
# Handle special cases where the field should start with non-alphanumeric characters
|
|
51
|
+
if snake_str == "schema_":
|
|
52
|
+
return "$schema"
|
|
53
|
+
if snake_str == "not_":
|
|
54
|
+
return "not"
|
|
55
|
+
|
|
50
56
|
components = snake_str.split("_")
|
|
51
57
|
return components[0] + "".join(x.title() for x in components[1:])
|
|
52
58
|
|
|
@@ -247,15 +253,38 @@ class HighlightsContentsOptions(TypedDict, total=False):
|
|
|
247
253
|
highlights_per_url: int
|
|
248
254
|
|
|
249
255
|
|
|
256
|
+
class JSONSchema(TypedDict, total=False):
|
|
257
|
+
"""Represents a JSON Schema definition used for structured summary output.
|
|
258
|
+
To learn more visit https://json-schema.org/overview/what-is-jsonschema.
|
|
259
|
+
"""
|
|
260
|
+
schema_: str # This will be converted to "$schema" in JSON
|
|
261
|
+
title: str
|
|
262
|
+
description: str
|
|
263
|
+
type: Literal["object", "array", "string", "number", "boolean", "null", "integer"]
|
|
264
|
+
properties: Dict[str, JSONSchema]
|
|
265
|
+
items: Union[JSONSchema, List[JSONSchema]]
|
|
266
|
+
required: List[str]
|
|
267
|
+
enum: List
|
|
268
|
+
additionalProperties: Union[bool, JSONSchema]
|
|
269
|
+
definitions: Dict[str, JSONSchema]
|
|
270
|
+
patternProperties: Dict[str, JSONSchema]
|
|
271
|
+
allOf: List[JSONSchema]
|
|
272
|
+
anyOf: List[JSONSchema]
|
|
273
|
+
oneOf: List[JSONSchema]
|
|
274
|
+
not_: JSONSchema # This will be converted to "not" in JSON
|
|
275
|
+
|
|
276
|
+
|
|
250
277
|
class SummaryContentsOptions(TypedDict, total=False):
|
|
251
278
|
"""A class representing the options that you can specify when requesting summary
|
|
252
279
|
|
|
253
280
|
Attributes:
|
|
254
281
|
query (str): The query string for the summary. Summary will bias towards answering the query.
|
|
282
|
+
schema (JSONSchema): JSON schema for structured output from summary.
|
|
255
283
|
"""
|
|
256
284
|
|
|
257
285
|
query: str
|
|
258
|
-
|
|
286
|
+
schema: JSONSchema
|
|
287
|
+
|
|
259
288
|
|
|
260
289
|
class ExtrasOptions(TypedDict, total=False):
|
|
261
290
|
"""A class representing additional extraction fields (e.g. links, images)"""
|
|
@@ -759,7 +788,7 @@ class Exa:
|
|
|
759
788
|
self,
|
|
760
789
|
api_key: Optional[str],
|
|
761
790
|
base_url: str = "https://api.exa.ai",
|
|
762
|
-
user_agent: str = "exa-py 1.
|
|
791
|
+
user_agent: str = "exa-py 1.9.0",
|
|
763
792
|
):
|
|
764
793
|
"""Initialize the Exa client with the provided API key and optional base URL and user agent.
|
|
765
794
|
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: exa_py
|
|
3
|
-
Version: 1.8.9
|
|
4
|
-
Summary: Python SDK for Exa API.
|
|
5
|
-
Home-page: https://github.com/exa-labs/exa-py
|
|
6
|
-
Author: Exa
|
|
7
|
-
Author-email: hello@exa.ai
|
|
8
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Typing :: Typed
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
Requires-Dist: requests
|
|
19
|
-
Requires-Dist: typing-extensions
|
|
20
|
-
Requires-Dist: openai>=1.10.0
|
|
21
|
-
|
|
22
|
-
# Exa
|
|
23
|
-
|
|
24
|
-
Exa (formerly Metaphor) API in Python
|
|
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
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pip install exa_py
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
Import the package and initialize the Exa client with your API key:
|
|
38
|
-
|
|
39
|
-
```python
|
|
40
|
-
from exa_py import Exa
|
|
41
|
-
|
|
42
|
-
exa = Exa(api_key="your-api-key")
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Common requests
|
|
46
|
-
```python
|
|
47
|
-
|
|
48
|
-
# basic search
|
|
49
|
-
results = exa.search("This is a Exa query:")
|
|
50
|
-
|
|
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
|
-
# search with date filters
|
|
58
|
-
results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")
|
|
59
|
-
|
|
60
|
-
# search with domain filters
|
|
61
|
-
results = exa.search("This is a Exa query:", include_domains=["www.cnn.com", "www.nytimes.com"])
|
|
62
|
-
|
|
63
|
-
# search and get text contents
|
|
64
|
-
results = exa.search_and_contents("This is a Exa query:")
|
|
65
|
-
|
|
66
|
-
# search and get highlights
|
|
67
|
-
results = exa.search_and_contents("This is a Exa query:", highlights=True)
|
|
68
|
-
|
|
69
|
-
# 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
|
-
highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
|
|
73
|
-
|
|
74
|
-
# find similar documents
|
|
75
|
-
results = exa.find_similar("https://example.com")
|
|
76
|
-
|
|
77
|
-
# find similar excluding source domain
|
|
78
|
-
results = exa.find_similar("https://example.com", exclude_source_domain=True)
|
|
79
|
-
|
|
80
|
-
# find similar with contents
|
|
81
|
-
results = exa.find_similar_and_contents("https://example.com", text=True, highlights=True)
|
|
82
|
-
|
|
83
|
-
# get text contents
|
|
84
|
-
results = exa.get_contents(["urls"])
|
|
85
|
-
|
|
86
|
-
# get highlights
|
|
87
|
-
results = exa.get_contents(["urls"], highlights=True)
|
|
88
|
-
|
|
89
|
-
# get contents with contents options
|
|
90
|
-
results = exa.get_contents(["urls"],
|
|
91
|
-
text={"include_html_tags": True, "max_characters": 1000},
|
|
92
|
-
highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
|
|
93
|
-
|
|
94
|
-
# basic answer
|
|
95
|
-
response = exa.answer("This is a query to answer a question")
|
|
96
|
-
|
|
97
|
-
# answer with full text, using the exa-pro model (sends 2 expanded quries to exa search)
|
|
98
|
-
response = exa.answer("This is a query to answer a question", text=True, model="exa-pro")
|
|
99
|
-
|
|
100
|
-
# answer with streaming
|
|
101
|
-
response = exa.stream_answer("This is a query to answer:")
|
|
102
|
-
|
|
103
|
-
# Print each chunk as it arrives when using the stream_answer method
|
|
104
|
-
for chunk in response:
|
|
105
|
-
print(chunk, end='', flush=True)
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
README.md
|
|
2
|
-
pyproject.toml
|
|
3
|
-
setup.py
|
|
4
|
-
exa_py/__init__.py
|
|
5
|
-
exa_py/api.py
|
|
6
|
-
exa_py/py.typed
|
|
7
|
-
exa_py/utils.py
|
|
8
|
-
exa_py.egg-info/PKG-INFO
|
|
9
|
-
exa_py.egg-info/SOURCES.txt
|
|
10
|
-
exa_py.egg-info/dependency_links.txt
|
|
11
|
-
exa_py.egg-info/requires.txt
|
|
12
|
-
exa_py.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exa_py
|
exa_py-1.8.9/setup.cfg
DELETED
exa_py-1.8.9/setup.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from setuptools import find_packages, setup
|
|
2
|
-
|
|
3
|
-
setup(
|
|
4
|
-
name="exa_py",
|
|
5
|
-
version="1.8.9",
|
|
6
|
-
description="Python SDK for Exa API.",
|
|
7
|
-
long_description_content_type="text/markdown",
|
|
8
|
-
long_description=open("README.md").read(),
|
|
9
|
-
author="Exa",
|
|
10
|
-
author_email="hello@exa.ai",
|
|
11
|
-
package_data={"exa_py": ["py.typed"]},
|
|
12
|
-
url="https://github.com/exa-labs/exa-py",
|
|
13
|
-
packages=find_packages(),
|
|
14
|
-
install_requires=["requests", "typing-extensions", "openai>=1.10.0"],
|
|
15
|
-
classifiers=[
|
|
16
|
-
"Development Status :: 5 - Production/Stable",
|
|
17
|
-
"Intended Audience :: Developers",
|
|
18
|
-
"License :: OSI Approved :: MIT License",
|
|
19
|
-
"Typing :: Typed",
|
|
20
|
-
"Programming Language :: Python :: 3.8",
|
|
21
|
-
"Programming Language :: Python :: 3.9",
|
|
22
|
-
"Programming Language :: Python :: 3.10",
|
|
23
|
-
"Programming Language :: Python :: 3.11",
|
|
24
|
-
"Programming Language :: Python :: 3.12",
|
|
25
|
-
],
|
|
26
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|