unique_sdk 0.10.14__py3-none-any.whl → 0.10.16__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.
- unique_sdk/api_resources/_content.py +109 -1
- unique_sdk/api_resources/_message_log.py +6 -6
- {unique_sdk-0.10.14.dist-info → unique_sdk-0.10.16.dist-info}/METADATA +36 -1
- {unique_sdk-0.10.14.dist-info → unique_sdk-0.10.16.dist-info}/RECORD +6 -6
- {unique_sdk-0.10.14.dist-info → unique_sdk-0.10.16.dist-info}/LICENSE +0 -0
- {unique_sdk-0.10.14.dist-info → unique_sdk-0.10.16.dist-info}/WHEEL +0 -0
@@ -1,5 +1,14 @@
|
|
1
1
|
from enum import Enum
|
2
|
-
from typing import
|
2
|
+
from typing import (
|
3
|
+
Any,
|
4
|
+
ClassVar,
|
5
|
+
Dict,
|
6
|
+
List,
|
7
|
+
Literal,
|
8
|
+
Optional,
|
9
|
+
TypedDict,
|
10
|
+
cast,
|
11
|
+
)
|
3
12
|
|
4
13
|
from typing_extensions import NotRequired, Unpack
|
5
14
|
|
@@ -75,6 +84,7 @@ class Content(APIResource["Content"]):
|
|
75
84
|
metadataFilter: dict
|
76
85
|
skip: NotRequired[int]
|
77
86
|
take: NotRequired[int]
|
87
|
+
filePath: NotRequired[str]
|
78
88
|
|
79
89
|
class CustomApiOptions(TypedDict):
|
80
90
|
apiIdentifier: str
|
@@ -148,6 +158,14 @@ class Content(APIResource["Content"]):
|
|
148
158
|
contentInfos: List["Content.ContentInfo"]
|
149
159
|
totalCount: int
|
150
160
|
|
161
|
+
class DeleteParams(RequestOptions):
|
162
|
+
contentId: NotRequired[str]
|
163
|
+
filePath: NotRequired[str]
|
164
|
+
chatId: NotRequired[str]
|
165
|
+
|
166
|
+
class DeleteResponse(TypedDict):
|
167
|
+
id: str
|
168
|
+
|
151
169
|
id: str
|
152
170
|
key: str
|
153
171
|
url: Optional[str]
|
@@ -372,3 +390,93 @@ class Content(APIResource["Content"]):
|
|
372
390
|
params=params,
|
373
391
|
),
|
374
392
|
)
|
393
|
+
|
394
|
+
@classmethod
|
395
|
+
def delete(
|
396
|
+
cls,
|
397
|
+
user_id: str,
|
398
|
+
company_id: str,
|
399
|
+
**params: "Content.DeleteParams",
|
400
|
+
) -> "Content.DeleteResponse":
|
401
|
+
"""
|
402
|
+
Deletes a content by its id or file path.
|
403
|
+
"""
|
404
|
+
content_id = cls.resolve_content_id_from_file_path(
|
405
|
+
user_id,
|
406
|
+
company_id,
|
407
|
+
params.get("contentId"),
|
408
|
+
params.get("filePath"),
|
409
|
+
)
|
410
|
+
params.pop("contentId", None)
|
411
|
+
params.pop("filePath", None)
|
412
|
+
|
413
|
+
return cast(
|
414
|
+
"Content.DeleteResponse",
|
415
|
+
cls._static_request(
|
416
|
+
"delete",
|
417
|
+
f"/content/{content_id}",
|
418
|
+
user_id,
|
419
|
+
company_id,
|
420
|
+
params=params,
|
421
|
+
),
|
422
|
+
)
|
423
|
+
|
424
|
+
@classmethod
|
425
|
+
async def delete_async(
|
426
|
+
cls,
|
427
|
+
user_id: str,
|
428
|
+
company_id: str,
|
429
|
+
**params: "Content.DeleteParams",
|
430
|
+
) -> "Content.DeleteResponse":
|
431
|
+
"""
|
432
|
+
Async deletes a content by its id or file path.
|
433
|
+
"""
|
434
|
+
content_id = cls.resolve_content_id_from_file_path(
|
435
|
+
user_id,
|
436
|
+
company_id,
|
437
|
+
params.get("contentId"),
|
438
|
+
params.get("filePath"),
|
439
|
+
)
|
440
|
+
params.pop("contentId", None)
|
441
|
+
params.pop("filePath", None)
|
442
|
+
|
443
|
+
return cast(
|
444
|
+
"Content.DeleteResponse",
|
445
|
+
await cls._static_request_async(
|
446
|
+
"delete",
|
447
|
+
f"/content/{content_id}",
|
448
|
+
user_id,
|
449
|
+
company_id,
|
450
|
+
params=params,
|
451
|
+
),
|
452
|
+
)
|
453
|
+
|
454
|
+
@classmethod
|
455
|
+
def resolve_content_id_from_file_path(
|
456
|
+
cls,
|
457
|
+
user_id: str,
|
458
|
+
company_id: str,
|
459
|
+
content_id: str | None = None,
|
460
|
+
file_path: str | None = None,
|
461
|
+
) -> str:
|
462
|
+
"""
|
463
|
+
Returns the contentId to use: if content_id is provided, returns it;
|
464
|
+
if not, but file_path is provided, resolves and returns the id for that file path.
|
465
|
+
"""
|
466
|
+
if content_id:
|
467
|
+
return content_id
|
468
|
+
if file_path:
|
469
|
+
file_info = cls.get_info(
|
470
|
+
user_id=user_id,
|
471
|
+
company_id=company_id,
|
472
|
+
filePath=file_path,
|
473
|
+
)
|
474
|
+
resolved_id = (
|
475
|
+
file_info.get("contentInfo")[0].get("id")
|
476
|
+
if file_info.get("totalCount", 0) > 0
|
477
|
+
else None
|
478
|
+
)
|
479
|
+
if not resolved_id:
|
480
|
+
raise ValueError(f"Could not find file with filePath: {file_path}")
|
481
|
+
return resolved_id
|
482
|
+
return None
|
@@ -25,9 +25,9 @@ class MessageLog(APIResource["MessageLog"]):
|
|
25
25
|
text: str
|
26
26
|
status: Literal["RUNNING", "COMPLETED", "FAILED"]
|
27
27
|
order: int
|
28
|
-
details: dict | None
|
29
|
-
uncitedReferences: dict | None
|
30
|
-
references: list["MessageLog.Reference"] | None
|
28
|
+
details: dict | None = None
|
29
|
+
uncitedReferences: dict | None = None
|
30
|
+
references: list["MessageLog.Reference"] | None = None
|
31
31
|
|
32
32
|
class UpdateMessageLogParams(RequestOptions):
|
33
33
|
"""
|
@@ -37,9 +37,9 @@ class MessageLog(APIResource["MessageLog"]):
|
|
37
37
|
text: str | None
|
38
38
|
status: Literal["RUNNING", "COMPLETED", "FAILED"] | None
|
39
39
|
order: int
|
40
|
-
details: dict | None
|
41
|
-
uncitedReferences: dict | None
|
42
|
-
references: list["MessageLog.Reference"] | None
|
40
|
+
details: dict | None = None
|
41
|
+
uncitedReferences: dict | None = None
|
42
|
+
references: list["MessageLog.Reference"] | None = None
|
43
43
|
|
44
44
|
messageLogId: str | None
|
45
45
|
messageId: str | None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_sdk
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.16
|
4
4
|
Summary:
|
5
5
|
License: MIT
|
6
6
|
Author: Martin Fadler
|
@@ -554,6 +554,35 @@ Allows you to ingest a magic table sheet, each row is processed and converted in
|
|
554
554
|
unique_sdk.Content.ingest_magic_table_sheets(**params)
|
555
555
|
```
|
556
556
|
|
557
|
+
#### `unique_sdk.Content.delete` (Compatible with release >.36)
|
558
|
+
|
559
|
+
Allows you to delete a file by its `contentId` or by its `filePath`. When deleting by `id`, if the file is part of a chat, the `chatId` also needs do be set. If both `contentId` and `filePath` are provided, `filePath` is ignored.
|
560
|
+
|
561
|
+
- `contentId` optional if `filePath` is provided, the id of the file to be deleted
|
562
|
+
- `chatId` optional, the id of the chat where the file is. Only needed if the file is part of a chat
|
563
|
+
- `filePath` optional if `contentId` is provided, the absolute path of the file to be deleted
|
564
|
+
|
565
|
+
Example of deleting a file from a chat.
|
566
|
+
|
567
|
+
```python
|
568
|
+
unique_sdk.Content.delete(
|
569
|
+
user_id=user_id,
|
570
|
+
company_id=company_id,
|
571
|
+
contentId="cont_ok2343q5owbce80w78hudawu5",
|
572
|
+
chatId="chat_v3xfa7liv876h89vuiibus1"
|
573
|
+
)
|
574
|
+
```
|
575
|
+
|
576
|
+
Example of deleting a file by its path.
|
577
|
+
|
578
|
+
```python
|
579
|
+
unique_sdk.Content.delete(
|
580
|
+
user_id=user_id,
|
581
|
+
company_id=company_id,
|
582
|
+
filePath="/Company/finance/january.xls",
|
583
|
+
)
|
584
|
+
```
|
585
|
+
|
557
586
|
### Message
|
558
587
|
|
559
588
|
#### `unique_sdk.Message.list`
|
@@ -1516,6 +1545,12 @@ All notable changes to this project will be documented in this file.
|
|
1516
1545
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
1517
1546
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
1518
1547
|
|
1548
|
+
## [0.10.16] - 2025-08-31
|
1549
|
+
- Add function to delete a content.
|
1550
|
+
|
1551
|
+
## [0.10.15] - 2025-08-28
|
1552
|
+
- Add default values for message log types
|
1553
|
+
|
1519
1554
|
## [0.10.14] - 2025-08-28
|
1520
1555
|
- Add function to delete folders and files recursively
|
1521
1556
|
|
@@ -17,7 +17,7 @@ unique_sdk/api_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
17
17
|
unique_sdk/api_resources/_acronyms.py,sha256=GIU1XH1flGWQYcpsFqTYwg4ioIGxVmb15tux84nmhEg,891
|
18
18
|
unique_sdk/api_resources/_agentic_table.py,sha256=8-_f7t-m_iiiOj2835iESoxz91YRxl4-tkxpzQbgdcI,9958
|
19
19
|
unique_sdk/api_resources/_chat_completion.py,sha256=ILCAffxkbkfh2iV9L4KKnfe80gZmT9pWfkNmf3mq68U,2172
|
20
|
-
unique_sdk/api_resources/_content.py,sha256=
|
20
|
+
unique_sdk/api_resources/_content.py,sha256=AFqM_E-3Fdn5J9wpIoBfyLpGI0cs7XUNPrN_HQWvH84,13566
|
21
21
|
unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUElqDJJ8dG10,1281
|
22
22
|
unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
|
23
23
|
unique_sdk/api_resources/_folder.py,sha256=u_x6g8g_LQsRiJm7ExYuFBxNywfbhOtnSIVK0HwcDws,12820
|
@@ -26,7 +26,7 @@ unique_sdk/api_resources/_mcp.py,sha256=zKh0dyn0QnkKk57N2zlGVN_GQoxEp5T2CS38vVm6
|
|
26
26
|
unique_sdk/api_resources/_message.py,sha256=gEDIzg3METZU2k7m69meAuf0IWmZxnYOjbBKPRMwPYE,7688
|
27
27
|
unique_sdk/api_resources/_message_assessment.py,sha256=SSfx6eW7zb_GKe8cFJzCqW-t-_eWEXxKP5cnIb0DhIc,2276
|
28
28
|
unique_sdk/api_resources/_message_execution.py,sha256=YzNy7l_BWs8mlEi9TlZL3D_KaecNNRpLmPLUnKeNoQ4,4425
|
29
|
-
unique_sdk/api_resources/_message_log.py,sha256=
|
29
|
+
unique_sdk/api_resources/_message_log.py,sha256=p7sqU-wSXDJ9EGv0zW8PFEO88trOim2RnLnrzwMmQaE,3583
|
30
30
|
unique_sdk/api_resources/_search.py,sha256=GQItZKoGNOVZfkLLltBmsRZYBIreRKU0lGW8Kgpj1_Q,1959
|
31
31
|
unique_sdk/api_resources/_search_string.py,sha256=4Idw6exgZdA8qksz9WkiA68k1hTU-7yFkgT_OLU_GkE,1662
|
32
32
|
unique_sdk/api_resources/_short_term_memory.py,sha256=vPRN-Y0WPx74E6y-A3LocGc0TxJdzT-xGL66WzZwKRg,2820
|
@@ -36,7 +36,7 @@ unique_sdk/utils/chat_in_space.py,sha256=3NeBjOu7p43V_6PrjwxyaTkgknUS10KE4QRuTlF
|
|
36
36
|
unique_sdk/utils/file_io.py,sha256=YY8B7VJcTLOPmCXByiOfNerXGlAtjCC5EVNmAbQJ3dQ,4306
|
37
37
|
unique_sdk/utils/sources.py,sha256=DoxxhMLcLhmDfNarjXa41H4JD2GSSDywr71hiC-4pYc,4952
|
38
38
|
unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
|
39
|
-
unique_sdk-0.10.
|
40
|
-
unique_sdk-0.10.
|
41
|
-
unique_sdk-0.10.
|
42
|
-
unique_sdk-0.10.
|
39
|
+
unique_sdk-0.10.16.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
|
40
|
+
unique_sdk-0.10.16.dist-info/METADATA,sha256=lY5N3HPmlMyWH9Lr1wdMiMomweTXi0HQJsudkFFy-9k,53097
|
41
|
+
unique_sdk-0.10.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
42
|
+
unique_sdk-0.10.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|