unique_sdk 0.9.12__tar.gz → 0.9.13__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.
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/CHANGELOG.md +3 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/PKG-INFO +4 -1
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/pyproject.toml +1 -1
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_api_resource.py +2 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_util.py +17 -6
- unique_sdk-0.9.13/unique_sdk/_version.py +1 -0
- unique_sdk-0.9.12/unique_sdk/_version.py +0 -1
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/LICENSE +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/README.md +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/__init__.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_api_requestor.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_api_version.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_error.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_http_client.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_list_object.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_object_classes.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_request_options.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_unique_object.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_unique_ql.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_unique_response.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/_webhook.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/__init__.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_acronyms.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_chat_completion.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_content.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_embedding.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_event.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_integrated.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_message.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_search.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_search_string.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/api_resources/_short_term_memory.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/utils/chat_history.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/utils/file_io.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/utils/sources.py +0 -0
- {unique_sdk-0.9.12 → unique_sdk-0.9.13}/unique_sdk/utils/token.py +0 -0
|
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.9.13] - 2024-10-23
|
|
9
|
+
- Add retry for `5xx` errors, add additional error message.
|
|
10
|
+
|
|
8
11
|
## [0.9.12] - 2024-11-21
|
|
9
12
|
- Include original error message in returned exceptions
|
|
10
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_sdk
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.13
|
|
4
4
|
Summary:
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Martin Fadler
|
|
@@ -899,6 +899,9 @@ All notable changes to this project will be documented in this file.
|
|
|
899
899
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
900
900
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
901
901
|
|
|
902
|
+
## [0.9.13] - 2024-10-23
|
|
903
|
+
- Add retry for `5xx` errors, add additional error message.
|
|
904
|
+
|
|
902
905
|
## [0.9.12] - 2024-11-21
|
|
903
906
|
- Include original error message in returned exceptions
|
|
904
907
|
|
|
@@ -22,10 +22,12 @@ retry_dict = {
|
|
|
22
22
|
"error_messages": [
|
|
23
23
|
"problem proxying the request",
|
|
24
24
|
"Upstream service reached a hard timeout",
|
|
25
|
+
"Invalid response body from API",
|
|
25
26
|
],
|
|
26
27
|
"max_retries": 3,
|
|
27
28
|
"backoff_factor": 2,
|
|
28
29
|
"initial_delay": 1,
|
|
30
|
+
"should_retry_5xx": True,
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
|
|
@@ -200,6 +200,7 @@ def retry_on_error(
|
|
|
200
200
|
initial_delay: int = 1,
|
|
201
201
|
backoff_factor: int = 2,
|
|
202
202
|
error_class=APIError,
|
|
203
|
+
should_retry_5xx=False,
|
|
203
204
|
):
|
|
204
205
|
def decorator(func: Callable) -> Callable:
|
|
205
206
|
@wraps(func)
|
|
@@ -209,10 +210,15 @@ def retry_on_error(
|
|
|
209
210
|
try:
|
|
210
211
|
return await func(*args, **kwargs)
|
|
211
212
|
except Exception as e:
|
|
212
|
-
|
|
213
|
+
should_retry = any(
|
|
213
214
|
err_msg.lower() in str(e).lower() for err_msg in error_messages
|
|
214
|
-
)
|
|
215
|
-
|
|
215
|
+
)
|
|
216
|
+
# Add 5xx check if `should_retry_5xx` is True
|
|
217
|
+
if should_retry_5xx and hasattr(e, "status_code"):
|
|
218
|
+
should_retry = should_retry or (500 <= e.status_code < 600)
|
|
219
|
+
|
|
220
|
+
if not should_retry:
|
|
221
|
+
raise e # Raise the error if no retry condition is met
|
|
216
222
|
|
|
217
223
|
attempts += 1
|
|
218
224
|
if attempts >= max_retries:
|
|
@@ -229,10 +235,15 @@ def retry_on_error(
|
|
|
229
235
|
try:
|
|
230
236
|
return func(*args, **kwargs)
|
|
231
237
|
except Exception as e:
|
|
232
|
-
|
|
238
|
+
should_retry = any(
|
|
233
239
|
err_msg.lower() in str(e).lower() for err_msg in error_messages
|
|
234
|
-
)
|
|
235
|
-
|
|
240
|
+
)
|
|
241
|
+
# Add 5xx check if `should_retry_5xx` is True
|
|
242
|
+
if should_retry_5xx and hasattr(e, "status_code"):
|
|
243
|
+
should_retry = should_retry or (500 <= e.status_code < 600)
|
|
244
|
+
|
|
245
|
+
if not should_retry:
|
|
246
|
+
raise e # Raise the error if no retry condition is met
|
|
236
247
|
|
|
237
248
|
attempts += 1
|
|
238
249
|
if attempts >= max_retries:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.9.13"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.9.8"
|
|
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
|