unique_sdk 0.10.8__py3-none-any.whl → 0.10.9__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.
@@ -139,12 +139,12 @@ async def wait_for_ingestion_completion(
139
139
  user_id: str,
140
140
  company_id: str,
141
141
  content_id: str,
142
- chat_id: str,
142
+ chat_id: str = None,
143
143
  poll_interval: float = 1.0,
144
144
  max_wait: float = 60.0,
145
145
  ):
146
146
  """
147
- Waits until the content ingestionState is FINISHED or the maximum wait time is reached and throws if case of failed status.
147
+ Polls until the content ingestion is finished or the maximum wait time is reached and throws in case ingestion fails. The function assumes that the content exists.
148
148
  """
149
149
  max_attempts = int(max_wait // poll_interval)
150
150
  for _ in range(max_attempts):
@@ -158,7 +158,7 @@ async def wait_for_ingestion_completion(
158
158
  if searched_content:
159
159
  ingestion_state = searched_content[0].get("ingestionState")
160
160
  if ingestion_state == "FINISHED":
161
- return
161
+ return ingestion_state
162
162
  if isinstance(ingestion_state, str) and ingestion_state.startswith(
163
163
  "FAILED"
164
164
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.10.8
3
+ Version: 0.10.9
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -1447,6 +1447,30 @@ latest_message = await unique_sdk.utils.chat_in_space.chat_against_file(
1447
1447
  )
1448
1448
  ```
1449
1449
 
1450
+ #### `unique_sdk.utils.chat_in_space.wait_for_ingestion_completion`
1451
+
1452
+ The following script enables you to wait for the ingestion of a file. This should be used carefully as it continuously polls for the status. In case of bigger files, adjust the `poll_interval` and `max_waits`.
1453
+
1454
+ You must provide the following parameter:
1455
+ - `content_id`: The id of the content to check.
1456
+
1457
+ The script polls until the content ingestion is finished or the maximum wait time is reached and throws in case ingestion fails. The function assumes that the content exists.
1458
+
1459
+ **Optional parameters:**
1460
+ - `chat_id`: In case the content is uploaded to a chat, the `chat_id` must be provided.
1461
+ - `poll_interval`: The number of seconds to wait between polling attempts (default: `1` second).
1462
+ - `max_wait`: The maximum number of seconds to wait for the message to complete (default: `60` seconds).
1463
+
1464
+ Example of waiting for the ingestion of a file in the Knowledge Base.
1465
+
1466
+ ```python
1467
+ await unique_sdk.utils.chat_in_space.wait_for_ingestion_completion(
1468
+ user_id=user_id,
1469
+ company_id=company_id,
1470
+ content_id="cont_ddlezvag4kzxudfr24lrjc5mx",
1471
+ )
1472
+ ```
1473
+
1450
1474
  ## Error Handling
1451
1475
 
1452
1476
  ## Examples
@@ -1464,6 +1488,9 @@ All notable changes to this project will be documented in this file.
1464
1488
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1465
1489
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1466
1490
 
1491
+ ## [0.10.9] - 2025-08-15
1492
+ - Add script to wait for content ingestion finished.
1493
+
1467
1494
  ## [0.10.8] - 2025-08-13
1468
1495
  - Add support for Agentic Table.
1469
1496
 
@@ -30,11 +30,11 @@ unique_sdk/api_resources/_search_string.py,sha256=4Idw6exgZdA8qksz9WkiA68k1hTU-7
30
30
  unique_sdk/api_resources/_short_term_memory.py,sha256=vPRN-Y0WPx74E6y-A3LocGc0TxJdzT-xGL66WzZwKRg,2820
31
31
  unique_sdk/api_resources/_space.py,sha256=Mzl1EUn7RrfjB8fKC6f-TW9GAOl5M6JncYLrKMDa-pQ,4933
32
32
  unique_sdk/utils/chat_history.py,sha256=5UqL9hF1O9pV7skbNOlEibF5rHdYsmG3m5-YEPUowOs,3037
33
- unique_sdk/utils/chat_in_space.py,sha256=nYmgQYhIxqQex_6zjdCfNuGnjoU14WkxUN6_zmSOiCQ,5169
33
+ unique_sdk/utils/chat_in_space.py,sha256=3NeBjOu7p43V_6PrjwxyaTkgknUS10KE4QRuTlFDU_4,5232
34
34
  unique_sdk/utils/file_io.py,sha256=YY8B7VJcTLOPmCXByiOfNerXGlAtjCC5EVNmAbQJ3dQ,4306
35
35
  unique_sdk/utils/sources.py,sha256=wfboE-neMKa0Wuq9QzfAEFMkNLrIrmm0v-QF33sLo6k,4952
36
36
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
37
- unique_sdk-0.10.8.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
38
- unique_sdk-0.10.8.dist-info/METADATA,sha256=4BWxqpjZI_3hk-_ZWK4IIuhRn89GC8lsEQWPkprhB94,49203
39
- unique_sdk-0.10.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
- unique_sdk-0.10.8.dist-info/RECORD,,
37
+ unique_sdk-0.10.9.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
38
+ unique_sdk-0.10.9.dist-info/METADATA,sha256=HkLlEA2qV_xJPt5i7obS1trzOhzdZL0aEw4mexrODP4,50398
39
+ unique_sdk-0.10.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
+ unique_sdk-0.10.9.dist-info/RECORD,,