unique_sdk 0.9.12__py3-none-any.whl → 0.9.14__py3-none-any.whl

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.
@@ -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
 
unique_sdk/_util.py CHANGED
@@ -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
- if not any(
213
+ should_retry = any(
213
214
  err_msg.lower() in str(e).lower() for err_msg in error_messages
214
- ):
215
- raise e # Raise the error if none of the messages match
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
- if not any(
238
+ should_retry = any(
233
239
  err_msg.lower() in str(e).lower() for err_msg in error_messages
234
- ):
235
- raise e # Raise the error if none of the messages match
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:
unique_sdk/_version.py CHANGED
@@ -1 +1 @@
1
- VERSION = "0.9.8"
1
+ VERSION = "0.9.14"
@@ -18,6 +18,7 @@ class Search(APIResource["Search"]):
18
18
  limit: NotRequired[Optional[int]]
19
19
  page: NotRequired[Optional[int]]
20
20
  metaDataFilter: NotRequired[Optional[dict[str, Any]]]
21
+ contentIds: NotRequired[Optional[list[str]]]
21
22
 
22
23
  id: str
23
24
  chunkId: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.9.12
3
+ Version: 0.9.14
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -899,6 +899,13 @@ 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
+
903
+ ## [0.9.14] - 2024-12-06
904
+ - Add `contentIds` to `Search.create` and `Search.create_async`
905
+
906
+ ## [0.9.13] - 2024-10-23
907
+ - Add retry for `5xx` errors, add additional error message.
908
+
902
909
  ## [0.9.12] - 2024-11-21
903
910
  - Include original error message in returned exceptions
904
911
 
@@ -1,6 +1,6 @@
1
1
  unique_sdk/__init__.py,sha256=Cv42hZ3dlsNACMIza7LDARXiY-w7a_ijlSuY_jADJD8,3072
2
2
  unique_sdk/_api_requestor.py,sha256=O6iF_d_jc1ceTYVa3kOQHXjYKdmBp0kGW_pfMw1ClwE,14543
3
- unique_sdk/_api_resource.py,sha256=zKu-Sk1sJ6b9mr8ljrt9UBmi6y6lO7A29DNcBxdRYD4,6113
3
+ unique_sdk/_api_resource.py,sha256=tE3J9sC5qwOdIMGLYEyvHjdQRYX-1unrLatO7CzgSfk,6185
4
4
  unique_sdk/_api_version.py,sha256=Ku4JPdeyJtnX5eJJvRCEc1_u44UObdVrvrL1T-WwWCs,46
5
5
  unique_sdk/_error.py,sha256=j-deT0PJ-exLCwUkqORRaxaLLrGunDag9bKJSmBBKZI,3343
6
6
  unique_sdk/_http_client.py,sha256=CSc2gduhQ42v6G1oh4Jyg8XL7Sa3YQ7WdTpc6kAyTBI,10369
@@ -10,8 +10,8 @@ unique_sdk/_request_options.py,sha256=oHh2AKka6j9pO53Htur3Wj0VJSusEjq8zkXYY179B_
10
10
  unique_sdk/_unique_object.py,sha256=PLaIzb6NPYghfMKHqDx_ZyojcDcuQzTrATXrktLqMa0,11442
11
11
  unique_sdk/_unique_ql.py,sha256=aUYXhYPA-_kPfImTapilCyDvB_53YpLd51kxILe7fDA,1707
12
12
  unique_sdk/_unique_response.py,sha256=q19hIxlsrkLAQylfHA0webp6bsCCHXkDJDwaC69Iev8,576
13
- unique_sdk/_util.py,sha256=ddCV4IDbbf2fh1Z09X7Y2REQmXMETLrM7tKLOc33w0o,8240
14
- unique_sdk/_version.py,sha256=bLj15cDf-jfrKLtrOqhC3kl-ZIlt9q8ieogbrosWe_g,18
13
+ unique_sdk/_util.py,sha256=J8L4ynMM6_zzN5uaIxriShr9lYpYa_5RMQAWKuqIcC0,8806
14
+ unique_sdk/_version.py,sha256=Ny-C0e1cEmVxwAXD01RWMz0CqwI3WSxEXfuLbrCWv1g,19
15
15
  unique_sdk/_webhook.py,sha256=GYxbUibQN_W4XlNTHaMIksT9FQJk4LJmlKcxOu3jqiU,2855
16
16
  unique_sdk/api_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  unique_sdk/api_resources/_acronyms.py,sha256=GIU1XH1flGWQYcpsFqTYwg4ioIGxVmb15tux84nmhEg,891
@@ -21,14 +21,14 @@ unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUEl
21
21
  unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
22
22
  unique_sdk/api_resources/_integrated.py,sha256=R5a5oSVQXkh5xyeFwor-7sfePsBdtUyh8SbTMS6AMz4,3036
23
23
  unique_sdk/api_resources/_message.py,sha256=gEDIzg3METZU2k7m69meAuf0IWmZxnYOjbBKPRMwPYE,7688
24
- unique_sdk/api_resources/_search.py,sha256=UPFD-rQfvcqFAj7P5kWlp56uroK1y6pglRR3iyw02_c,1806
24
+ unique_sdk/api_resources/_search.py,sha256=TbzNZO7OOmQqmfHkbzhDGtRIrtJw_Eohs_vo02vamzE,1859
25
25
  unique_sdk/api_resources/_search_string.py,sha256=I43XqKfYwWSwhZ4r0UHx5fs1MUGbLszWHrxqBvo6Tx8,1785
26
26
  unique_sdk/api_resources/_short_term_memory.py,sha256=FWJ-PFR8x3o15lw1L0iKICFNdSTb1C9gs8y-CBkfdag,2815
27
27
  unique_sdk/utils/chat_history.py,sha256=5UqL9hF1O9pV7skbNOlEibF5rHdYsmG3m5-YEPUowOs,3037
28
28
  unique_sdk/utils/file_io.py,sha256=tcS-5NA97AyiJPhKpWs3i0qKNFsZlttToxrvnWRDJrs,3857
29
29
  unique_sdk/utils/sources.py,sha256=wfboE-neMKa0Wuq9QzfAEFMkNLrIrmm0v-QF33sLo6k,4952
30
30
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
31
- unique_sdk-0.9.12.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
32
- unique_sdk-0.9.12.dist-info/METADATA,sha256=qBpFA0leuy7tYkdDC1UfL0VTt2heE9SnqNVvO4YX3Wo,28057
33
- unique_sdk-0.9.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
- unique_sdk-0.9.12.dist-info/RECORD,,
31
+ unique_sdk-0.9.14.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
32
+ unique_sdk-0.9.14.dist-info/METADATA,sha256=aQkf8PdTSUR_kaitfjqDpJ_NjdN9Oak0fArbf4KbU2c,28234
33
+ unique_sdk-0.9.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
+ unique_sdk-0.9.14.dist-info/RECORD,,