exa-py 1.15.5__tar.gz → 1.15.6__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.15.5 → exa_py-1.15.6}/PKG-INFO +1 -1
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/api.py +25 -11
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/client.py +11 -4
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/core/async_base.py +32 -2
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/core/base.py +32 -2
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/searches/client.py +12 -5
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/types.py +15 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/pyproject.toml +1 -1
- {exa_py-1.15.5 → exa_py-1.15.6}/README.md +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/py.typed +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/async_client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/base.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/models.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/sync_client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/research/utils.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/utils.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/_generator/pydantic/BaseModel.jinja2 +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/async_client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/core/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/enrichments/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/enrichments/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/events/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/events/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/imports/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/imports/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/items/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/items/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/monitors/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/monitors/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/monitors/runs/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/monitors/runs/client.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/searches/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/webhooks/__init__.py +0 -0
- {exa_py-1.15.5 → exa_py-1.15.6}/exa_py/websets/webhooks/client.py +0 -0
|
@@ -1164,6 +1164,7 @@ class Exa:
|
|
|
1164
1164
|
data: Optional[Union[Dict[str, Any], str]] = None,
|
|
1165
1165
|
method: str = "POST",
|
|
1166
1166
|
params: Optional[Dict[str, Any]] = None,
|
|
1167
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1167
1168
|
) -> Union[Dict[str, Any], requests.Response]:
|
|
1168
1169
|
"""Send a request to the Exa API, optionally streaming if data['stream'] is True.
|
|
1169
1170
|
|
|
@@ -1172,6 +1173,7 @@ class Exa:
|
|
|
1172
1173
|
data (dict, optional): The JSON payload to send. Defaults to None.
|
|
1173
1174
|
method (str, optional): The HTTP method to use. Defaults to "POST".
|
|
1174
1175
|
params (Dict[str, Any], optional): Query parameters to include. Defaults to None.
|
|
1176
|
+
headers (Dict[str, str], optional): Additional headers to include in the request. Defaults to None.
|
|
1175
1177
|
|
|
1176
1178
|
Returns:
|
|
1177
1179
|
Union[dict, requests.Response]: If streaming, returns the Response object.
|
|
@@ -1193,38 +1195,43 @@ class Exa:
|
|
|
1193
1195
|
params and params.get("stream") == "true"
|
|
1194
1196
|
)
|
|
1195
1197
|
|
|
1198
|
+
# Merge additional headers with existing headers
|
|
1199
|
+
request_headers = {**self.headers}
|
|
1200
|
+
if headers:
|
|
1201
|
+
request_headers.update(headers)
|
|
1202
|
+
|
|
1196
1203
|
if method.upper() == "GET":
|
|
1197
1204
|
if needs_streaming:
|
|
1198
1205
|
res = requests.get(
|
|
1199
1206
|
self.base_url + endpoint,
|
|
1200
|
-
headers=
|
|
1207
|
+
headers=request_headers,
|
|
1201
1208
|
params=params,
|
|
1202
1209
|
stream=True,
|
|
1203
1210
|
)
|
|
1204
1211
|
return res
|
|
1205
1212
|
else:
|
|
1206
1213
|
res = requests.get(
|
|
1207
|
-
self.base_url + endpoint, headers=
|
|
1214
|
+
self.base_url + endpoint, headers=request_headers, params=params
|
|
1208
1215
|
)
|
|
1209
1216
|
elif method.upper() == "POST":
|
|
1210
1217
|
if needs_streaming:
|
|
1211
1218
|
res = requests.post(
|
|
1212
1219
|
self.base_url + endpoint,
|
|
1213
1220
|
data=json_data,
|
|
1214
|
-
headers=
|
|
1221
|
+
headers=request_headers,
|
|
1215
1222
|
stream=True,
|
|
1216
1223
|
)
|
|
1217
1224
|
return res
|
|
1218
1225
|
else:
|
|
1219
1226
|
res = requests.post(
|
|
1220
|
-
self.base_url + endpoint, data=json_data, headers=
|
|
1227
|
+
self.base_url + endpoint, data=json_data, headers=request_headers
|
|
1221
1228
|
)
|
|
1222
1229
|
elif method.upper() == "PATCH":
|
|
1223
1230
|
res = requests.patch(
|
|
1224
|
-
self.base_url + endpoint, data=json_data, headers=
|
|
1231
|
+
self.base_url + endpoint, data=json_data, headers=request_headers
|
|
1225
1232
|
)
|
|
1226
1233
|
elif method.upper() == "DELETE":
|
|
1227
|
-
res = requests.delete(self.base_url + endpoint, headers=
|
|
1234
|
+
res = requests.delete(self.base_url + endpoint, headers=request_headers)
|
|
1228
1235
|
else:
|
|
1229
1236
|
raise ValueError(f"Unsupported HTTP method: {method}")
|
|
1230
1237
|
|
|
@@ -2431,7 +2438,8 @@ class AsyncExa(Exa):
|
|
|
2431
2438
|
return self._client
|
|
2432
2439
|
|
|
2433
2440
|
async def async_request(
|
|
2434
|
-
self, endpoint: str, data=None, method: str = "POST", params=None
|
|
2441
|
+
self, endpoint: str, data=None, method: str = "POST", params=None,
|
|
2442
|
+
headers: Optional[Dict[str, str]] = None
|
|
2435
2443
|
):
|
|
2436
2444
|
"""Send a request to the Exa API, optionally streaming if data['stream'] is True.
|
|
2437
2445
|
|
|
@@ -2440,6 +2448,7 @@ class AsyncExa(Exa):
|
|
|
2440
2448
|
data (dict, optional): The JSON payload to send.
|
|
2441
2449
|
method (str, optional): The HTTP method to use. Defaults to "POST".
|
|
2442
2450
|
params (dict, optional): Query parameters.
|
|
2451
|
+
headers (Dict[str, str], optional): Additional headers to include in the request. Defaults to None.
|
|
2443
2452
|
|
|
2444
2453
|
Returns:
|
|
2445
2454
|
Union[dict, httpx.Response]: If streaming, returns the Response object.
|
|
@@ -2453,27 +2462,32 @@ class AsyncExa(Exa):
|
|
|
2453
2462
|
params and params.get("stream") == "true"
|
|
2454
2463
|
)
|
|
2455
2464
|
|
|
2465
|
+
# Merge additional headers with existing headers
|
|
2466
|
+
request_headers = {**self.headers}
|
|
2467
|
+
if headers:
|
|
2468
|
+
request_headers.update(headers)
|
|
2469
|
+
|
|
2456
2470
|
if method.upper() == "GET":
|
|
2457
2471
|
if needs_streaming:
|
|
2458
2472
|
request = httpx.Request(
|
|
2459
|
-
"GET", self.base_url + endpoint, params=params, headers=
|
|
2473
|
+
"GET", self.base_url + endpoint, params=params, headers=request_headers
|
|
2460
2474
|
)
|
|
2461
2475
|
res = await self.client.send(request, stream=True)
|
|
2462
2476
|
return res
|
|
2463
2477
|
else:
|
|
2464
2478
|
res = await self.client.get(
|
|
2465
|
-
self.base_url + endpoint, params=params, headers=
|
|
2479
|
+
self.base_url + endpoint, params=params, headers=request_headers
|
|
2466
2480
|
)
|
|
2467
2481
|
elif method.upper() == "POST":
|
|
2468
2482
|
if needs_streaming:
|
|
2469
2483
|
request = httpx.Request(
|
|
2470
|
-
"POST", self.base_url + endpoint, json=data, headers=
|
|
2484
|
+
"POST", self.base_url + endpoint, json=data, headers=request_headers
|
|
2471
2485
|
)
|
|
2472
2486
|
res = await self.client.send(request, stream=True)
|
|
2473
2487
|
return res
|
|
2474
2488
|
else:
|
|
2475
2489
|
res = await self.client.post(
|
|
2476
|
-
self.base_url + endpoint, json=data, headers=
|
|
2490
|
+
self.base_url + endpoint, json=data, headers=request_headers
|
|
2477
2491
|
)
|
|
2478
2492
|
if res.status_code != 200 and res.status_code != 201:
|
|
2479
2493
|
raise ValueError(
|
|
@@ -13,6 +13,7 @@ from .types import (
|
|
|
13
13
|
CreateWebsetParameters,
|
|
14
14
|
PreviewWebsetParameters,
|
|
15
15
|
PreviewWebsetResponse,
|
|
16
|
+
RequestOptions,
|
|
16
17
|
)
|
|
17
18
|
from .core.base import WebsetsBaseClient
|
|
18
19
|
from .core.async_base import WebsetsAsyncBaseClient
|
|
@@ -37,16 +38,19 @@ class WebsetsClient(WebsetsBaseClient):
|
|
|
37
38
|
self.imports = ImportsClient(client)
|
|
38
39
|
self.events = EventsClient(client)
|
|
39
40
|
|
|
40
|
-
def create(self, params: Union[Dict[str, Any], CreateWebsetParameters]
|
|
41
|
+
def create(self, params: Union[Dict[str, Any], CreateWebsetParameters],
|
|
42
|
+
options: Optional[Union[Dict[str, Any], RequestOptions]] = None) -> Webset:
|
|
41
43
|
"""Create a new Webset.
|
|
42
44
|
|
|
43
45
|
Args:
|
|
44
46
|
params (CreateWebsetParameters): The parameters for creating a webset.
|
|
47
|
+
options (RequestOptions, optional): Request options including priority and/or custom headers.
|
|
48
|
+
Can specify priority as 'low', 'medium', or 'high'.
|
|
45
49
|
|
|
46
50
|
Returns:
|
|
47
51
|
Webset: The created webset.
|
|
48
52
|
"""
|
|
49
|
-
response = self.request("/v0/websets", data=params)
|
|
53
|
+
response = self.request("/v0/websets", data=params, options=options)
|
|
50
54
|
return Webset.model_validate(response)
|
|
51
55
|
|
|
52
56
|
def preview(self, params: Union[Dict[str, Any], PreviewWebsetParameters]) -> PreviewWebsetResponse:
|
|
@@ -171,16 +175,19 @@ class AsyncWebsetsClient(WebsetsAsyncBaseClient):
|
|
|
171
175
|
self.imports = AsyncImportsClient(client)
|
|
172
176
|
self.events = AsyncEventsClient(client)
|
|
173
177
|
|
|
174
|
-
async def create(self, params: Union[Dict[str, Any], CreateWebsetParameters]
|
|
178
|
+
async def create(self, params: Union[Dict[str, Any], CreateWebsetParameters],
|
|
179
|
+
options: Optional[Union[Dict[str, Any], RequestOptions]] = None) -> Webset:
|
|
175
180
|
"""Create a new Webset.
|
|
176
181
|
|
|
177
182
|
Args:
|
|
178
183
|
params (CreateWebsetParameters): The parameters for creating a webset.
|
|
184
|
+
options (RequestOptions, optional): Request options including priority and/or custom headers.
|
|
185
|
+
Can specify priority as 'low', 'medium', or 'high'.
|
|
179
186
|
|
|
180
187
|
Returns:
|
|
181
188
|
Webset: The created webset.
|
|
182
189
|
"""
|
|
183
|
-
response = await self.request("/v0/websets", data=params)
|
|
190
|
+
response = await self.request("/v0/websets", data=params, options=options)
|
|
184
191
|
return Webset.model_validate(response)
|
|
185
192
|
|
|
186
193
|
async def preview(self, params: Union[Dict[str, Any], PreviewWebsetParameters]) -> PreviewWebsetResponse:
|
|
@@ -51,7 +51,8 @@ class WebsetsAsyncBaseClient:
|
|
|
51
51
|
raise TypeError(f"Expected dict, ExaBaseModel, or str, got {type(data)}")
|
|
52
52
|
|
|
53
53
|
async def request(self, endpoint: str, data: Optional[Union[Dict[str, Any], ExaBaseModel, str]] = None,
|
|
54
|
-
method: str = "POST", params: Optional[Dict[str, Any]] = None
|
|
54
|
+
method: str = "POST", params: Optional[Dict[str, Any]] = None,
|
|
55
|
+
headers: Optional[Dict[str, str]] = None, options: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
55
56
|
"""Make an async request to the Exa API.
|
|
56
57
|
|
|
57
58
|
Args:
|
|
@@ -59,6 +60,8 @@ class WebsetsAsyncBaseClient:
|
|
|
59
60
|
data (Union[Dict[str, Any], ExaBaseModel, str], optional): The request data. Can be a dictionary, model instance, or string. Defaults to None.
|
|
60
61
|
method (str, optional): The HTTP method. Defaults to "POST".
|
|
61
62
|
params (Dict[str, Any], optional): The query parameters. Defaults to None.
|
|
63
|
+
headers (Dict[str, str], optional): Custom headers to include in the request. Defaults to None.
|
|
64
|
+
options (Dict[str, Any], optional): Request options that may include 'priority' and/or 'headers'. Defaults to None.
|
|
62
65
|
|
|
63
66
|
Returns:
|
|
64
67
|
Dict[str, Any]: The API response.
|
|
@@ -70,8 +73,35 @@ class WebsetsAsyncBaseClient:
|
|
|
70
73
|
# If data is a model instance, convert it to a dict
|
|
71
74
|
data = data.model_dump(mode='json', by_alias=True, exclude_none=True)
|
|
72
75
|
|
|
76
|
+
# Process options to build headers
|
|
77
|
+
final_headers = {}
|
|
78
|
+
|
|
79
|
+
# If options are provided, process them
|
|
80
|
+
if options:
|
|
81
|
+
# Handle RequestOptions model
|
|
82
|
+
if hasattr(options, 'priority') or hasattr(options, 'headers'):
|
|
83
|
+
# It's a RequestOptions instance
|
|
84
|
+
if hasattr(options, 'priority') and options.priority:
|
|
85
|
+
final_headers['x-exa-websets-priority'] = options.priority
|
|
86
|
+
if hasattr(options, 'headers') and options.headers:
|
|
87
|
+
final_headers.update(options.headers)
|
|
88
|
+
# Handle dict options
|
|
89
|
+
elif isinstance(options, dict):
|
|
90
|
+
if 'priority' in options:
|
|
91
|
+
final_headers['x-exa-websets-priority'] = options['priority']
|
|
92
|
+
if 'headers' in options:
|
|
93
|
+
final_headers.update(options.get('headers', {}))
|
|
94
|
+
|
|
95
|
+
# Merge with any directly passed headers
|
|
96
|
+
if headers:
|
|
97
|
+
final_headers.update(headers)
|
|
98
|
+
|
|
73
99
|
# Ensure proper URL construction by removing leading slash from endpoint if present
|
|
74
100
|
if endpoint.startswith("/"):
|
|
75
101
|
endpoint = endpoint[1:]
|
|
76
102
|
|
|
77
|
-
|
|
103
|
+
# Only pass headers if there are any
|
|
104
|
+
if final_headers:
|
|
105
|
+
return await self._client.async_request("/websets/" + endpoint, data=data, method=method, params=params, headers=final_headers)
|
|
106
|
+
else:
|
|
107
|
+
return await self._client.async_request("/websets/" + endpoint, data=data, method=method, params=params)
|
|
@@ -73,7 +73,8 @@ class WebsetsBaseClient:
|
|
|
73
73
|
raise TypeError(f"Expected dict, ExaBaseModel, or str, got {type(data)}")
|
|
74
74
|
|
|
75
75
|
def request(self, endpoint: str, data: Optional[Union[Dict[str, Any], ExaBaseModel, str]] = None,
|
|
76
|
-
method: str = "POST", params: Optional[Dict[str, Any]] = None
|
|
76
|
+
method: str = "POST", params: Optional[Dict[str, Any]] = None,
|
|
77
|
+
headers: Optional[Dict[str, str]] = None, options: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
77
78
|
"""Make a request to the Exa API.
|
|
78
79
|
|
|
79
80
|
Args:
|
|
@@ -81,6 +82,8 @@ class WebsetsBaseClient:
|
|
|
81
82
|
data (Union[Dict[str, Any], ExaBaseModel, str], optional): The request data. Can be a dictionary, model instance, or string. Defaults to None.
|
|
82
83
|
method (str, optional): The HTTP method. Defaults to "POST".
|
|
83
84
|
params (Dict[str, Any], optional): The query parameters. Defaults to None.
|
|
85
|
+
headers (Dict[str, str], optional): Custom headers to include in the request. Defaults to None.
|
|
86
|
+
options (Dict[str, Any], optional): Request options that may include 'priority' and/or 'headers'. Defaults to None.
|
|
84
87
|
|
|
85
88
|
Returns:
|
|
86
89
|
Dict[str, Any]: The API response.
|
|
@@ -92,9 +95,36 @@ class WebsetsBaseClient:
|
|
|
92
95
|
# If data is a model instance, convert it to a dict
|
|
93
96
|
data = data.model_dump(mode='json', by_alias=True, exclude_none=True)
|
|
94
97
|
|
|
98
|
+
# Process options to build headers
|
|
99
|
+
final_headers = {}
|
|
100
|
+
|
|
101
|
+
# If options are provided, process them
|
|
102
|
+
if options:
|
|
103
|
+
# Handle RequestOptions model
|
|
104
|
+
if hasattr(options, 'priority') or hasattr(options, 'headers'):
|
|
105
|
+
# It's a RequestOptions instance
|
|
106
|
+
if hasattr(options, 'priority') and options.priority:
|
|
107
|
+
final_headers['x-exa-websets-priority'] = options.priority
|
|
108
|
+
if hasattr(options, 'headers') and options.headers:
|
|
109
|
+
final_headers.update(options.headers)
|
|
110
|
+
# Handle dict options
|
|
111
|
+
elif isinstance(options, dict):
|
|
112
|
+
if 'priority' in options:
|
|
113
|
+
final_headers['x-exa-websets-priority'] = options['priority']
|
|
114
|
+
if 'headers' in options:
|
|
115
|
+
final_headers.update(options.get('headers', {}))
|
|
116
|
+
|
|
117
|
+
# Merge with any directly passed headers
|
|
118
|
+
if headers:
|
|
119
|
+
final_headers.update(headers)
|
|
120
|
+
|
|
95
121
|
# Ensure proper URL construction by removing leading slash from endpoint if present
|
|
96
122
|
if endpoint.startswith("/"):
|
|
97
123
|
endpoint = endpoint[1:]
|
|
98
124
|
|
|
99
|
-
|
|
125
|
+
# Only pass headers if there are any
|
|
126
|
+
if final_headers:
|
|
127
|
+
return self._client.request("/websets/" + endpoint, data=data, method=method, params=params, headers=final_headers)
|
|
128
|
+
else:
|
|
129
|
+
return self._client.request("/websets/" + endpoint, data=data, method=method, params=params)
|
|
100
130
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import Dict, Any, Union
|
|
3
|
+
from typing import Dict, Any, Union, Optional
|
|
4
4
|
|
|
5
5
|
from ..types import (
|
|
6
6
|
CreateWebsetSearchParameters,
|
|
7
7
|
WebsetSearch,
|
|
8
|
+
RequestOptions,
|
|
8
9
|
)
|
|
9
10
|
from ..core.base import WebsetsBaseClient
|
|
10
11
|
from ..core.async_base import WebsetsAsyncBaseClient
|
|
@@ -15,17 +16,20 @@ class WebsetSearchesClient(WebsetsBaseClient):
|
|
|
15
16
|
def __init__(self, client):
|
|
16
17
|
super().__init__(client)
|
|
17
18
|
|
|
18
|
-
def create(self, webset_id: str, params: Union[Dict[str, Any], CreateWebsetSearchParameters]
|
|
19
|
+
def create(self, webset_id: str, params: Union[Dict[str, Any], CreateWebsetSearchParameters],
|
|
20
|
+
options: Optional[Union[Dict[str, Any], RequestOptions]] = None) -> WebsetSearch:
|
|
19
21
|
"""Create a new Search for the Webset.
|
|
20
22
|
|
|
21
23
|
Args:
|
|
22
24
|
webset_id (str): The id of the Webset.
|
|
23
25
|
params (CreateWebsetSearchParameters): The parameters for creating a search.
|
|
26
|
+
options (RequestOptions, optional): Request options including priority and/or custom headers.
|
|
27
|
+
Can specify priority as 'low', 'medium', or 'high'.
|
|
24
28
|
|
|
25
29
|
Returns:
|
|
26
30
|
WebsetSearch: The created search.
|
|
27
31
|
"""
|
|
28
|
-
response = self.request(f"/v0/websets/{webset_id}/searches", data=params)
|
|
32
|
+
response = self.request(f"/v0/websets/{webset_id}/searches", data=params, options=options)
|
|
29
33
|
return WebsetSearch.model_validate(response)
|
|
30
34
|
|
|
31
35
|
def get(self, webset_id: str, id: str) -> WebsetSearch:
|
|
@@ -61,17 +65,20 @@ class AsyncWebsetSearchesClient(WebsetsAsyncBaseClient):
|
|
|
61
65
|
def __init__(self, client):
|
|
62
66
|
super().__init__(client)
|
|
63
67
|
|
|
64
|
-
async def create(self, webset_id: str, params: Union[Dict[str, Any], CreateWebsetSearchParameters]
|
|
68
|
+
async def create(self, webset_id: str, params: Union[Dict[str, Any], CreateWebsetSearchParameters],
|
|
69
|
+
options: Optional[Union[Dict[str, Any], RequestOptions]] = None) -> WebsetSearch:
|
|
65
70
|
"""Create a new Search for the Webset.
|
|
66
71
|
|
|
67
72
|
Args:
|
|
68
73
|
webset_id (str): The id of the Webset.
|
|
69
74
|
params (CreateWebsetSearchParameters): The parameters for creating a search.
|
|
75
|
+
options (RequestOptions, optional): Request options including priority and/or custom headers.
|
|
76
|
+
Can specify priority as 'low', 'medium', or 'high'.
|
|
70
77
|
|
|
71
78
|
Returns:
|
|
72
79
|
WebsetSearch: The created search.
|
|
73
80
|
"""
|
|
74
|
-
response = await self.request(f"/v0/websets/{webset_id}/searches", data=params)
|
|
81
|
+
response = await self.request(f"/v0/websets/{webset_id}/searches", data=params, options=options)
|
|
75
82
|
return WebsetSearch.model_validate(response)
|
|
76
83
|
|
|
77
84
|
async def get(self, webset_id: str, id: str) -> WebsetSearch:
|
|
@@ -12,6 +12,21 @@ from pydantic import AnyUrl, Field, PositiveInt
|
|
|
12
12
|
from .core.base import ExaBaseModel
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
class WebsetPriority(Enum):
|
|
16
|
+
"""Priority levels for webset operations."""
|
|
17
|
+
low = 'low'
|
|
18
|
+
medium = 'medium'
|
|
19
|
+
high = 'high'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RequestOptions(ExaBaseModel):
|
|
23
|
+
"""Options for API requests."""
|
|
24
|
+
priority: Optional[Literal['low', 'medium', 'high']] = None
|
|
25
|
+
"""Priority level for the request (low, medium, or high)."""
|
|
26
|
+
headers: Optional[Dict[str, str]] = None
|
|
27
|
+
"""Custom headers to include in the request."""
|
|
28
|
+
|
|
29
|
+
|
|
15
30
|
class WebsetSearchBehavior(Enum):
|
|
16
31
|
"""
|
|
17
32
|
The behavior of the Search when it is added to a Webset.
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|