exa-py 1.1.6__tar.gz → 1.1.8__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.1.6 → exa_py-1.1.8}/PKG-INFO +4 -5
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py/api.py +15 -31
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py.egg-info/PKG-INFO +5 -6
- {exa_py-1.1.6 → exa_py-1.1.8}/pyproject.toml +2 -2
- {exa_py-1.1.6 → exa_py-1.1.8}/setup.py +1 -1
- {exa_py-1.1.6 → exa_py-1.1.8}/README.md +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py/__init__.py +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py/py.typed +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py/utils.py +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py.egg-info/SOURCES.txt +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py.egg-info/dependency_links.txt +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py.egg-info/requires.txt +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/exa_py.egg-info/top_level.txt +0 -0
- {exa_py-1.1.6 → exa_py-1.1.8}/setup.cfg +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: exa_py
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.8
|
|
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
|
|
10
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
9
|
Classifier: Intended Audience :: Developers
|
|
12
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -17,6 +15,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
17
|
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: typing-extensions
|
|
20
|
+
Requires-Dist: openai>=1.10.0
|
|
20
21
|
|
|
21
22
|
# Exa
|
|
22
23
|
|
|
@@ -91,5 +92,3 @@ exa = Exa(api_key="your-api-key")
|
|
|
91
92
|
highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
@@ -15,6 +15,8 @@ from typing import (
|
|
|
15
15
|
overload,
|
|
16
16
|
Union,
|
|
17
17
|
Literal,
|
|
18
|
+
get_origin,
|
|
19
|
+
get_args
|
|
18
20
|
)
|
|
19
21
|
from typing_extensions import TypedDict
|
|
20
22
|
|
|
@@ -144,11 +146,9 @@ CONTENTS_OPTIONS_TYPES = {
|
|
|
144
146
|
"filter_empty_results": [bool],
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
149
|
# FOR BETA OPTIONS
|
|
150
150
|
# if is_beta:
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
|
|
153
153
|
def validate_search_options(
|
|
154
154
|
options: Dict[str, Optional[object]], expected: dict
|
|
@@ -165,30 +165,20 @@ def validate_search_options(
|
|
|
165
165
|
for key, value in options.items():
|
|
166
166
|
if key not in expected:
|
|
167
167
|
raise ValueError(f"Invalid option: '{key}'")
|
|
168
|
-
if
|
|
168
|
+
if value is None:
|
|
169
|
+
continue
|
|
170
|
+
expected_types = expected[key]
|
|
171
|
+
if not any(is_valid_type(value, t) for t in expected_types):
|
|
169
172
|
raise ValueError(
|
|
170
|
-
f"Invalid
|
|
173
|
+
f"Invalid value for option '{key}': {value}. Expected one of {expected_types}"
|
|
171
174
|
)
|
|
172
175
|
|
|
173
|
-
def
|
|
174
|
-
if
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if get_origin(class_or_tuple) is not None:
|
|
181
|
-
# Handle subscripted generics
|
|
182
|
-
origin = get_origin(class_or_tuple)
|
|
183
|
-
args = get_args(class_or_tuple)
|
|
184
|
-
|
|
185
|
-
if origin is list:
|
|
186
|
-
return isinstance(obj, list) and all(isinstance(item, args[0]) for item in obj)
|
|
187
|
-
elif origin is dict:
|
|
188
|
-
return isinstance(obj, dict) and all(isinstance(k, args[0]) and isinstance(v, args[1]) for k, v in obj.items())
|
|
189
|
-
# Add more cases for other generic types as needed
|
|
190
|
-
|
|
191
|
-
return isinstance(obj, class_or_tuple)
|
|
176
|
+
def is_valid_type(value, expected_type):
|
|
177
|
+
if get_origin(expected_type) is Literal:
|
|
178
|
+
return value in get_args(expected_type)
|
|
179
|
+
if isinstance(expected_type, type):
|
|
180
|
+
return isinstance(value, expected_type)
|
|
181
|
+
return False # For any other case
|
|
192
182
|
|
|
193
183
|
class TextContentsOptions(TypedDict, total=False):
|
|
194
184
|
"""A class representing the options that you can specify when requesting text
|
|
@@ -476,7 +466,7 @@ class Exa:
|
|
|
476
466
|
self,
|
|
477
467
|
api_key: Optional[str],
|
|
478
468
|
base_url: str = "https://api.exa.ai",
|
|
479
|
-
user_agent: str = "exa-py 1.
|
|
469
|
+
user_agent: str = "exa-py 1.1.8",
|
|
480
470
|
):
|
|
481
471
|
"""Initialize the Exa client with the provided API key and optional base URL and user agent.
|
|
482
472
|
|
|
@@ -1181,10 +1171,6 @@ class Exa:
|
|
|
1181
1171
|
**openai_kwargs,
|
|
1182
1172
|
}
|
|
1183
1173
|
|
|
1184
|
-
if use_exa != "none":
|
|
1185
|
-
assert "tools" not in create_kwargs, "Tool use is not supported with Exa"
|
|
1186
|
-
create_kwargs["tool_choice"] = use_exa
|
|
1187
|
-
|
|
1188
1174
|
return self._create_with_tool(
|
|
1189
1175
|
create_fn=func,
|
|
1190
1176
|
messages=list(messages),
|
|
@@ -1238,8 +1224,6 @@ class Exa:
|
|
|
1238
1224
|
exa_result = self.search_and_contents(query, **exa_kwargs)
|
|
1239
1225
|
exa_str = format_exa_result(exa_result, max_len=max_len)
|
|
1240
1226
|
new_messages = add_message_to_messages(completion, messages, exa_str)
|
|
1241
|
-
# For now, don't allow recursive tool calls
|
|
1242
|
-
create_kwargs["tool_choice"] = "none"
|
|
1243
1227
|
completion = create_fn(messages=new_messages, **create_kwargs)
|
|
1244
1228
|
|
|
1245
1229
|
exa_completion = ExaOpenAICompletion.from_completion(
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 1.1.
|
|
2
|
+
Name: exa_py
|
|
3
|
+
Version: 1.1.8
|
|
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
|
|
10
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
9
|
Classifier: Intended Audience :: Developers
|
|
12
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -17,6 +15,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
17
|
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: typing-extensions
|
|
20
|
+
Requires-Dist: openai>=1.10.0
|
|
20
21
|
|
|
21
22
|
# Exa
|
|
22
23
|
|
|
@@ -91,5 +92,3 @@ exa = Exa(api_key="your-api-key")
|
|
|
91
92
|
highlights={"highlights_per_url": 2, "num_sentences": 1, "query": "This is the highlight query:"})
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
@@ -9,7 +9,7 @@ readme = "README.md"
|
|
|
9
9
|
python = "^3.9"
|
|
10
10
|
requests = "^2.32.3"
|
|
11
11
|
typing-extensions = "^4.12.2"
|
|
12
|
-
openai = "^1.
|
|
12
|
+
openai = "^1.48"
|
|
13
13
|
|
|
14
14
|
[tool.poetry.group.dev.dependencies]
|
|
15
15
|
python-dotenv = "^1.0.1"
|
|
@@ -22,4 +22,4 @@ requires = ["poetry-core"]
|
|
|
22
22
|
build-backend = "poetry.core.masonry.api"
|
|
23
23
|
|
|
24
24
|
[virtualenvs]
|
|
25
|
-
in-project = true
|
|
25
|
+
in-project = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|