unique_sdk 0.10.63__py3-none-any.whl → 0.10.75__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/__init__.py +1 -0
- unique_sdk/api_resources/_chat_completion.py +1 -0
- unique_sdk/api_resources/_content.py +55 -1
- unique_sdk/api_resources/_elicitation.py +248 -0
- unique_sdk/api_resources/_folder.py +134 -0
- unique_sdk/api_resources/_mcp.py +2 -0
- unique_sdk/api_resources/_message.py +6 -0
- unique_sdk/api_resources/_message_execution.py +7 -0
- unique_sdk/api_resources/_search.py +1 -1
- unique_sdk/api_resources/_space.py +49 -0
- unique_sdk/utils/chat_in_space.py +7 -1
- {unique_sdk-0.10.63.dist-info → unique_sdk-0.10.75.dist-info}/METADATA +45 -3
- {unique_sdk-0.10.63.dist-info → unique_sdk-0.10.75.dist-info}/RECORD +15 -14
- {unique_sdk-0.10.63.dist-info → unique_sdk-0.10.75.dist-info}/LICENSE +0 -0
- {unique_sdk-0.10.63.dist-info → unique_sdk-0.10.75.dist-info}/WHEEL +0 -0
unique_sdk/__init__.py
CHANGED
|
@@ -95,6 +95,7 @@ from unique_sdk.api_resources._message_execution import (
|
|
|
95
95
|
MessageExecution as MessageExecution,
|
|
96
96
|
)
|
|
97
97
|
from unique_sdk.api_resources._message_log import MessageLog as MessageLog
|
|
98
|
+
from unique_sdk.api_resources._elicitation import Elicitation as Elicitation
|
|
98
99
|
|
|
99
100
|
# Unique QL
|
|
100
101
|
from unique_sdk._unique_ql import UQLOperator as UQLOperator
|
|
@@ -30,6 +30,7 @@ class Content(APIResource["Content"]):
|
|
|
30
30
|
writeUrl: Optional[str]
|
|
31
31
|
readUrl: Optional[str]
|
|
32
32
|
expiredAt: Optional[str]
|
|
33
|
+
appliedIngestionConfig: Optional[Dict[str, Any]]
|
|
33
34
|
|
|
34
35
|
class QueryMode(Enum):
|
|
35
36
|
Default = "default"
|
|
@@ -110,6 +111,7 @@ class Content(APIResource["Content"]):
|
|
|
110
111
|
skip: NotRequired[int | None]
|
|
111
112
|
take: NotRequired[int | None]
|
|
112
113
|
parentId: NotRequired[str | None]
|
|
114
|
+
parentFolderPath: NotRequired[str | None]
|
|
113
115
|
|
|
114
116
|
class CustomApiOptions(TypedDict):
|
|
115
117
|
apiIdentifier: str
|
|
@@ -149,6 +151,8 @@ class Content(APIResource["Content"]):
|
|
|
149
151
|
class UpsertParams(RequestOptions):
|
|
150
152
|
input: "Content.Input"
|
|
151
153
|
scopeId: NotRequired[str | None]
|
|
154
|
+
parentFolderPath: NotRequired[str | None]
|
|
155
|
+
createFolderIfNotExists: NotRequired[bool | None]
|
|
152
156
|
chatId: NotRequired[str | None]
|
|
153
157
|
sourceOwnerType: NotRequired[str | None]
|
|
154
158
|
storeInternally: NotRequired[bool | None]
|
|
@@ -315,6 +319,16 @@ class Content(APIResource["Content"]):
|
|
|
315
319
|
company_id: str,
|
|
316
320
|
**params: Unpack["Content.ContentInfosParams"],
|
|
317
321
|
) -> "Content.PaginatedContentInfos":
|
|
322
|
+
parent_id = unique_sdk.Folder.resolve_scope_id_from_folder_path(
|
|
323
|
+
user_id=user_id,
|
|
324
|
+
company_id=company_id,
|
|
325
|
+
scope_id=params.get("parentId"),
|
|
326
|
+
folder_path=params.get("parentFolderPath"),
|
|
327
|
+
)
|
|
328
|
+
params.pop("parentFolderPath", None)
|
|
329
|
+
if parent_id:
|
|
330
|
+
params["parentId"] = parent_id
|
|
331
|
+
|
|
318
332
|
return cast(
|
|
319
333
|
Content.PaginatedContentInfos,
|
|
320
334
|
cls._static_request(
|
|
@@ -333,6 +347,16 @@ class Content(APIResource["Content"]):
|
|
|
333
347
|
company_id: str,
|
|
334
348
|
**params: Unpack["Content.ContentInfosParams"],
|
|
335
349
|
) -> "Content.PaginatedContentInfos":
|
|
350
|
+
parent_id = await unique_sdk.Folder.resolve_scope_id_from_folder_path_async(
|
|
351
|
+
user_id=user_id,
|
|
352
|
+
company_id=company_id,
|
|
353
|
+
scope_id=params.get("parentId"),
|
|
354
|
+
folder_path=params.get("parentFolderPath"),
|
|
355
|
+
)
|
|
356
|
+
params.pop("parentFolderPath", None)
|
|
357
|
+
if parent_id:
|
|
358
|
+
params["parentId"] = parent_id
|
|
359
|
+
|
|
336
360
|
return cast(
|
|
337
361
|
Content.PaginatedContentInfos,
|
|
338
362
|
await cls._static_request_async(
|
|
@@ -359,6 +383,19 @@ class Content(APIResource["Content"]):
|
|
|
359
383
|
if "description" in params["input"] and not params["input"]["description"]:
|
|
360
384
|
params["input"].pop("description")
|
|
361
385
|
|
|
386
|
+
create_folder = params.get("createFolderIfNotExists")
|
|
387
|
+
scope_id = unique_sdk.Folder.resolve_scope_id_from_folder_path_with_create(
|
|
388
|
+
user_id=user_id,
|
|
389
|
+
company_id=company_id,
|
|
390
|
+
scope_id=params.get("scopeId"),
|
|
391
|
+
folder_path=params.get("parentFolderPath"),
|
|
392
|
+
create_if_not_exists=create_folder if create_folder is not None else True,
|
|
393
|
+
)
|
|
394
|
+
params.pop("parentFolderPath", None)
|
|
395
|
+
params.pop("createFolderIfNotExists", None)
|
|
396
|
+
if scope_id:
|
|
397
|
+
params["scopeId"] = scope_id
|
|
398
|
+
|
|
362
399
|
return cast(
|
|
363
400
|
"Content",
|
|
364
401
|
cls._static_request(
|
|
@@ -385,6 +422,23 @@ class Content(APIResource["Content"]):
|
|
|
385
422
|
if "description" in params["input"] and not params["input"]["description"]:
|
|
386
423
|
params["input"].pop("description")
|
|
387
424
|
|
|
425
|
+
create_folder = params.get("createFolderIfNotExists")
|
|
426
|
+
scope_id = (
|
|
427
|
+
await unique_sdk.Folder.resolve_scope_id_from_folder_path_with_create_async(
|
|
428
|
+
user_id=user_id,
|
|
429
|
+
company_id=company_id,
|
|
430
|
+
scope_id=params.get("scopeId"),
|
|
431
|
+
folder_path=params.get("parentFolderPath"),
|
|
432
|
+
create_if_not_exists=create_folder
|
|
433
|
+
if create_folder is not None
|
|
434
|
+
else True,
|
|
435
|
+
)
|
|
436
|
+
)
|
|
437
|
+
params.pop("parentFolderPath", None)
|
|
438
|
+
params.pop("createFolderIfNotExists", None)
|
|
439
|
+
if scope_id:
|
|
440
|
+
params["scopeId"] = scope_id
|
|
441
|
+
|
|
388
442
|
return cast(
|
|
389
443
|
"Content",
|
|
390
444
|
await cls._static_request_async(
|
|
@@ -481,7 +535,7 @@ class Content(APIResource["Content"]):
|
|
|
481
535
|
params.get("contentId"),
|
|
482
536
|
params.get("filePath"),
|
|
483
537
|
)
|
|
484
|
-
owner_id = unique_sdk.Folder.
|
|
538
|
+
owner_id = await unique_sdk.Folder.resolve_scope_id_from_folder_path_async(
|
|
485
539
|
user_id,
|
|
486
540
|
company_id,
|
|
487
541
|
params.get("ownerId"),
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
Any,
|
|
3
|
+
ClassVar,
|
|
4
|
+
Dict,
|
|
5
|
+
List,
|
|
6
|
+
Literal,
|
|
7
|
+
NotRequired,
|
|
8
|
+
Optional,
|
|
9
|
+
TypedDict,
|
|
10
|
+
Unpack,
|
|
11
|
+
cast,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from unique_sdk._api_resource import APIResource
|
|
15
|
+
from unique_sdk._request_options import RequestOptions
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Elicitation(APIResource["Elicitation"]):
|
|
19
|
+
OBJECT_NAME: ClassVar[Literal["elicitation"]] = "elicitation"
|
|
20
|
+
|
|
21
|
+
class CreateParams(RequestOptions):
|
|
22
|
+
"""
|
|
23
|
+
Parameters for creating an elicitation request.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
mode: Literal["FORM", "URL"]
|
|
27
|
+
message: str
|
|
28
|
+
toolName: str
|
|
29
|
+
schema: NotRequired[Optional[Dict[str, Any]]]
|
|
30
|
+
url: NotRequired[Optional[str]]
|
|
31
|
+
externalElicitationId: NotRequired[Optional[str]]
|
|
32
|
+
chatId: NotRequired[Optional[str]]
|
|
33
|
+
messageId: NotRequired[Optional[str]]
|
|
34
|
+
expiresInSeconds: NotRequired[Optional[int]]
|
|
35
|
+
metadata: NotRequired[Optional[Dict[str, Any]]]
|
|
36
|
+
|
|
37
|
+
class RespondParams(RequestOptions):
|
|
38
|
+
"""
|
|
39
|
+
Parameters for responding to an elicitation request.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
elicitationId: str
|
|
43
|
+
action: Literal["ACCEPT", "DECLINE", "CANCEL"]
|
|
44
|
+
content: NotRequired[Optional[Dict[str, str | int | bool | List[str]]]]
|
|
45
|
+
|
|
46
|
+
class Elicitation(TypedDict):
|
|
47
|
+
"""
|
|
48
|
+
Represents an elicitation request.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
id: str
|
|
52
|
+
object: str
|
|
53
|
+
source: str
|
|
54
|
+
mode: str
|
|
55
|
+
status: str
|
|
56
|
+
message: str
|
|
57
|
+
mcpServerId: NotRequired[Optional[str]]
|
|
58
|
+
toolName: NotRequired[Optional[str]]
|
|
59
|
+
schema: NotRequired[Optional[Dict[str, Any]]]
|
|
60
|
+
url: NotRequired[Optional[str]]
|
|
61
|
+
externalElicitationId: NotRequired[Optional[str]]
|
|
62
|
+
responseContent: NotRequired[Optional[Dict[str, Any]]]
|
|
63
|
+
respondedAt: NotRequired[Optional[str]]
|
|
64
|
+
companyId: str
|
|
65
|
+
userId: str
|
|
66
|
+
chatId: NotRequired[Optional[str]]
|
|
67
|
+
messageId: NotRequired[Optional[str]]
|
|
68
|
+
metadata: NotRequired[Optional[Dict[str, Any]]]
|
|
69
|
+
createdAt: str
|
|
70
|
+
updatedAt: NotRequired[Optional[str]]
|
|
71
|
+
expiresAt: NotRequired[Optional[str]]
|
|
72
|
+
|
|
73
|
+
class ElicitationResponseResult(TypedDict):
|
|
74
|
+
"""
|
|
75
|
+
Response for responding to an elicitation request.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
success: bool
|
|
79
|
+
message: NotRequired[Optional[str]]
|
|
80
|
+
|
|
81
|
+
class Elicitations(TypedDict):
|
|
82
|
+
"""
|
|
83
|
+
Response for getting pending elicitations.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
elicitations: List["Elicitation.Elicitation"]
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def create_elicitation(
|
|
90
|
+
cls,
|
|
91
|
+
user_id: str,
|
|
92
|
+
company_id: str,
|
|
93
|
+
**params: Unpack["Elicitation.CreateParams"],
|
|
94
|
+
) -> "Elicitation.Elicitation":
|
|
95
|
+
"""
|
|
96
|
+
Create an elicitation request in a company.
|
|
97
|
+
"""
|
|
98
|
+
return cast(
|
|
99
|
+
"Elicitation.Elicitation",
|
|
100
|
+
cls._static_request(
|
|
101
|
+
"post",
|
|
102
|
+
"/elicitation",
|
|
103
|
+
user_id,
|
|
104
|
+
company_id,
|
|
105
|
+
params=params,
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
async def create_elicitation_async(
|
|
111
|
+
cls,
|
|
112
|
+
user_id: str,
|
|
113
|
+
company_id: str,
|
|
114
|
+
**params: Unpack["Elicitation.CreateParams"],
|
|
115
|
+
) -> "Elicitation.Elicitation":
|
|
116
|
+
"""
|
|
117
|
+
Async create an elicitation request in a company.
|
|
118
|
+
"""
|
|
119
|
+
return cast(
|
|
120
|
+
"Elicitation.Elicitation",
|
|
121
|
+
await cls._static_request_async(
|
|
122
|
+
"post",
|
|
123
|
+
"/elicitation",
|
|
124
|
+
user_id,
|
|
125
|
+
company_id,
|
|
126
|
+
params=params,
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
@classmethod
|
|
131
|
+
def get_pending_elicitations(
|
|
132
|
+
cls,
|
|
133
|
+
user_id: str,
|
|
134
|
+
company_id: str,
|
|
135
|
+
) -> "Elicitation.Elicitations":
|
|
136
|
+
"""
|
|
137
|
+
Get all pending elicitation requests for a user in a company.
|
|
138
|
+
"""
|
|
139
|
+
return cast(
|
|
140
|
+
"Elicitation.Elicitations",
|
|
141
|
+
cls._static_request(
|
|
142
|
+
"get",
|
|
143
|
+
"/elicitation/pending",
|
|
144
|
+
user_id,
|
|
145
|
+
company_id,
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
@classmethod
|
|
150
|
+
async def get_pending_elicitations_async(
|
|
151
|
+
cls,
|
|
152
|
+
user_id: str,
|
|
153
|
+
company_id: str,
|
|
154
|
+
) -> "Elicitation.Elicitations":
|
|
155
|
+
"""
|
|
156
|
+
Async get all pending elicitation requests for a user in a company.
|
|
157
|
+
"""
|
|
158
|
+
return cast(
|
|
159
|
+
"Elicitation.Elicitations",
|
|
160
|
+
await cls._static_request_async(
|
|
161
|
+
"get",
|
|
162
|
+
"/elicitation/pending",
|
|
163
|
+
user_id,
|
|
164
|
+
company_id,
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def get_elicitation(
|
|
170
|
+
cls,
|
|
171
|
+
user_id: str,
|
|
172
|
+
company_id: str,
|
|
173
|
+
elicitation_id: str,
|
|
174
|
+
) -> "Elicitation.Elicitation":
|
|
175
|
+
"""
|
|
176
|
+
Get an elicitation request by ID in a company.
|
|
177
|
+
"""
|
|
178
|
+
return cast(
|
|
179
|
+
"Elicitation.Elicitation",
|
|
180
|
+
cls._static_request(
|
|
181
|
+
"get",
|
|
182
|
+
f"/elicitation/{elicitation_id}",
|
|
183
|
+
user_id,
|
|
184
|
+
company_id,
|
|
185
|
+
),
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
@classmethod
|
|
189
|
+
async def get_elicitation_async(
|
|
190
|
+
cls,
|
|
191
|
+
user_id: str,
|
|
192
|
+
company_id: str,
|
|
193
|
+
elicitation_id: str,
|
|
194
|
+
) -> "Elicitation.Elicitation":
|
|
195
|
+
"""
|
|
196
|
+
Async get an elicitation request by ID in a company.
|
|
197
|
+
"""
|
|
198
|
+
return cast(
|
|
199
|
+
"Elicitation.Elicitation",
|
|
200
|
+
await cls._static_request_async(
|
|
201
|
+
"get",
|
|
202
|
+
f"/elicitation/{elicitation_id}",
|
|
203
|
+
user_id,
|
|
204
|
+
company_id,
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
@classmethod
|
|
209
|
+
def respond_to_elicitation(
|
|
210
|
+
cls,
|
|
211
|
+
user_id: str,
|
|
212
|
+
company_id: str,
|
|
213
|
+
**params: Unpack["Elicitation.RespondParams"],
|
|
214
|
+
) -> "Elicitation.ElicitationResponseResult":
|
|
215
|
+
"""
|
|
216
|
+
Respond to an elicitation request in a company.
|
|
217
|
+
"""
|
|
218
|
+
return cast(
|
|
219
|
+
"Elicitation.ElicitationResponseResult",
|
|
220
|
+
cls._static_request(
|
|
221
|
+
"post",
|
|
222
|
+
"/elicitation/respond",
|
|
223
|
+
user_id,
|
|
224
|
+
company_id,
|
|
225
|
+
params=params,
|
|
226
|
+
),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
@classmethod
|
|
230
|
+
async def respond_to_elicitation_async(
|
|
231
|
+
cls,
|
|
232
|
+
user_id: str,
|
|
233
|
+
company_id: str,
|
|
234
|
+
**params: Unpack["Elicitation.RespondParams"],
|
|
235
|
+
) -> "Elicitation.ElicitationResponseResult":
|
|
236
|
+
"""
|
|
237
|
+
Async respond to an elicitation request in a company.
|
|
238
|
+
"""
|
|
239
|
+
return cast(
|
|
240
|
+
"Elicitation.ElicitationResponseResult",
|
|
241
|
+
await cls._static_request_async(
|
|
242
|
+
"post",
|
|
243
|
+
"/elicitation/respond",
|
|
244
|
+
user_id,
|
|
245
|
+
company_id,
|
|
246
|
+
params=params,
|
|
247
|
+
),
|
|
248
|
+
)
|
|
@@ -157,6 +157,7 @@ class Folder(APIResource["Folder"]):
|
|
|
157
157
|
"""
|
|
158
158
|
|
|
159
159
|
parentId: NotRequired[str]
|
|
160
|
+
parentFolderPath: NotRequired[str]
|
|
160
161
|
take: NotRequired[int]
|
|
161
162
|
skip: NotRequired[int]
|
|
162
163
|
|
|
@@ -268,6 +269,16 @@ class Folder(APIResource["Folder"]):
|
|
|
268
269
|
"""
|
|
269
270
|
Get paginated folders based on parentId. If the parentId is not defined, the root folders will be returned.
|
|
270
271
|
"""
|
|
272
|
+
parent_id = cls.resolve_scope_id_from_folder_path(
|
|
273
|
+
user_id=user_id,
|
|
274
|
+
company_id=company_id,
|
|
275
|
+
scope_id=params.get("parentId"),
|
|
276
|
+
folder_path=params.get("parentFolderPath"),
|
|
277
|
+
)
|
|
278
|
+
params.pop("parentFolderPath", None)
|
|
279
|
+
if parent_id:
|
|
280
|
+
params["parentId"] = parent_id
|
|
281
|
+
|
|
271
282
|
return cast(
|
|
272
283
|
"Folder.FolderInfos",
|
|
273
284
|
cls._static_request(
|
|
@@ -286,6 +297,16 @@ class Folder(APIResource["Folder"]):
|
|
|
286
297
|
"""
|
|
287
298
|
Async get paginated folders based on parentId. If the parentId is not defined, the root folders will be returned.
|
|
288
299
|
"""
|
|
300
|
+
parent_id = await cls.resolve_scope_id_from_folder_path_async(
|
|
301
|
+
user_id=user_id,
|
|
302
|
+
company_id=company_id,
|
|
303
|
+
scope_id=params.get("parentId"),
|
|
304
|
+
folder_path=params.get("parentFolderPath"),
|
|
305
|
+
)
|
|
306
|
+
params.pop("parentFolderPath", None)
|
|
307
|
+
if parent_id:
|
|
308
|
+
params["parentId"] = parent_id
|
|
309
|
+
|
|
289
310
|
return cast(
|
|
290
311
|
"Folder.FolderInfos",
|
|
291
312
|
await cls._static_request_async(
|
|
@@ -617,3 +638,116 @@ class Folder(APIResource["Folder"]):
|
|
|
617
638
|
)
|
|
618
639
|
return resolved_id
|
|
619
640
|
return None
|
|
641
|
+
|
|
642
|
+
@classmethod
|
|
643
|
+
def resolve_scope_id_from_folder_path_with_create(
|
|
644
|
+
cls,
|
|
645
|
+
user_id: str,
|
|
646
|
+
company_id: str,
|
|
647
|
+
scope_id: str | None = None,
|
|
648
|
+
folder_path: str | None = None,
|
|
649
|
+
create_if_not_exists: bool = True,
|
|
650
|
+
) -> str | None:
|
|
651
|
+
if scope_id:
|
|
652
|
+
return scope_id
|
|
653
|
+
if folder_path:
|
|
654
|
+
try:
|
|
655
|
+
folder_info = cls.get_info(
|
|
656
|
+
user_id=user_id,
|
|
657
|
+
company_id=company_id,
|
|
658
|
+
folderPath=folder_path,
|
|
659
|
+
)
|
|
660
|
+
resolved_id = folder_info.get("id")
|
|
661
|
+
if resolved_id:
|
|
662
|
+
return resolved_id
|
|
663
|
+
except Exception:
|
|
664
|
+
pass
|
|
665
|
+
|
|
666
|
+
if create_if_not_exists:
|
|
667
|
+
result = cls.create_paths(
|
|
668
|
+
user_id=user_id,
|
|
669
|
+
company_id=company_id,
|
|
670
|
+
paths=[folder_path],
|
|
671
|
+
)
|
|
672
|
+
created_folders = result.get("createdFolders", [])
|
|
673
|
+
if created_folders:
|
|
674
|
+
return created_folders[-1]["id"]
|
|
675
|
+
raise ValueError(
|
|
676
|
+
f"Failed to create folder with folderPath: {folder_path}"
|
|
677
|
+
)
|
|
678
|
+
|
|
679
|
+
raise ValueError(f"Could not find a folder with folderPath: {folder_path}")
|
|
680
|
+
return None
|
|
681
|
+
|
|
682
|
+
@classmethod
|
|
683
|
+
async def resolve_scope_id_from_folder_path_async(
|
|
684
|
+
cls,
|
|
685
|
+
user_id: str,
|
|
686
|
+
company_id: str,
|
|
687
|
+
scope_id: str | None = None,
|
|
688
|
+
folder_path: str | None = None,
|
|
689
|
+
) -> str | None:
|
|
690
|
+
"""
|
|
691
|
+
Async version of resolve_scope_id_from_folder_path.
|
|
692
|
+
Returns the scopeId to use: if scope_id is provided, returns it;
|
|
693
|
+
if not, but folder_path is provided, resolves and returns the id for that folder path.
|
|
694
|
+
|
|
695
|
+
Returns:
|
|
696
|
+
str: The resolved folder ID.
|
|
697
|
+
None: Failed to resolve a folder ID (e.g., folder_path not found or not provided).
|
|
698
|
+
"""
|
|
699
|
+
if scope_id:
|
|
700
|
+
return scope_id
|
|
701
|
+
if folder_path:
|
|
702
|
+
folder_info = await cls.get_info_async(
|
|
703
|
+
user_id=user_id,
|
|
704
|
+
company_id=company_id,
|
|
705
|
+
folderPath=folder_path,
|
|
706
|
+
)
|
|
707
|
+
resolved_id = folder_info.get("id")
|
|
708
|
+
if not resolved_id:
|
|
709
|
+
raise ValueError(
|
|
710
|
+
f"Could not find a folder with folderPath: {folder_path}"
|
|
711
|
+
)
|
|
712
|
+
return resolved_id
|
|
713
|
+
return None
|
|
714
|
+
|
|
715
|
+
@classmethod
|
|
716
|
+
async def resolve_scope_id_from_folder_path_with_create_async(
|
|
717
|
+
cls,
|
|
718
|
+
user_id: str,
|
|
719
|
+
company_id: str,
|
|
720
|
+
scope_id: str | None = None,
|
|
721
|
+
folder_path: str | None = None,
|
|
722
|
+
create_if_not_exists: bool = True,
|
|
723
|
+
) -> str | None:
|
|
724
|
+
if scope_id:
|
|
725
|
+
return scope_id
|
|
726
|
+
if folder_path:
|
|
727
|
+
try:
|
|
728
|
+
folder_info = await cls.get_info_async(
|
|
729
|
+
user_id=user_id,
|
|
730
|
+
company_id=company_id,
|
|
731
|
+
folderPath=folder_path,
|
|
732
|
+
)
|
|
733
|
+
resolved_id = folder_info.get("id")
|
|
734
|
+
if resolved_id:
|
|
735
|
+
return resolved_id
|
|
736
|
+
except Exception:
|
|
737
|
+
pass
|
|
738
|
+
|
|
739
|
+
if create_if_not_exists:
|
|
740
|
+
result = await cls.create_paths_async(
|
|
741
|
+
user_id=user_id,
|
|
742
|
+
company_id=company_id,
|
|
743
|
+
paths=[folder_path],
|
|
744
|
+
)
|
|
745
|
+
created_folders = result.get("createdFolders", [])
|
|
746
|
+
if created_folders:
|
|
747
|
+
return created_folders[-1]["id"]
|
|
748
|
+
raise ValueError(
|
|
749
|
+
f"Failed to create folder with folderPath: {folder_path}"
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
raise ValueError(f"Could not find a folder with folderPath: {folder_path}")
|
|
753
|
+
return None
|
unique_sdk/api_resources/_mcp.py
CHANGED
|
@@ -36,6 +36,11 @@ class Message(APIResource["Message"]):
|
|
|
36
36
|
sourceId: str
|
|
37
37
|
source: str
|
|
38
38
|
|
|
39
|
+
class Correlation(TypedDict):
|
|
40
|
+
parentMessageId: str
|
|
41
|
+
parentChatId: str
|
|
42
|
+
parentAssistantId: str
|
|
43
|
+
|
|
39
44
|
class CreateParams(RequestOptions):
|
|
40
45
|
chatId: str
|
|
41
46
|
assistantId: str
|
|
@@ -44,6 +49,7 @@ class Message(APIResource["Message"]):
|
|
|
44
49
|
references: Optional[List["Message.Reference"]]
|
|
45
50
|
debugInfo: Optional[Dict[str, Any]]
|
|
46
51
|
completedAt: Optional[datetime]
|
|
52
|
+
correlation: NotRequired[Optional["Message.Correlation"]]
|
|
47
53
|
|
|
48
54
|
class ModifyParams(RequestOptions):
|
|
49
55
|
chatId: str
|
|
@@ -20,6 +20,9 @@ class MessageExecution(APIResource["MessageExecution"]):
|
|
|
20
20
|
|
|
21
21
|
messageId: str
|
|
22
22
|
type: "MessageExecution.TypeLiteral"
|
|
23
|
+
isQueueable: NotRequired[bool | None]
|
|
24
|
+
executionOptions: NotRequired[dict | None]
|
|
25
|
+
progressTitle: NotRequired[str | None]
|
|
23
26
|
|
|
24
27
|
class GetMessageExecutionParams(RequestOptions):
|
|
25
28
|
"""
|
|
@@ -37,6 +40,7 @@ class MessageExecution(APIResource["MessageExecution"]):
|
|
|
37
40
|
status: NotRequired["MessageExecution.UpdateStatusLiteral | None"]
|
|
38
41
|
secondsRemaining: NotRequired[int | None]
|
|
39
42
|
percentageCompleted: NotRequired[int | None]
|
|
43
|
+
progressTitle: NotRequired[str | None]
|
|
40
44
|
|
|
41
45
|
id: str
|
|
42
46
|
messageId: str
|
|
@@ -44,6 +48,9 @@ class MessageExecution(APIResource["MessageExecution"]):
|
|
|
44
48
|
type: "MessageExecution.TypeLiteral"
|
|
45
49
|
secondsRemaining: int | None
|
|
46
50
|
percentageCompleted: int | None
|
|
51
|
+
isQueueable: bool
|
|
52
|
+
executionOptions: dict | None
|
|
53
|
+
progressTitle: str | None
|
|
47
54
|
positionInQueue: int | None
|
|
48
55
|
createdAt: str
|
|
49
56
|
updatedAt: str
|
|
@@ -10,7 +10,7 @@ class Search(APIResource["Search"]):
|
|
|
10
10
|
class CreateParams(RequestOptions):
|
|
11
11
|
chatId: NotRequired[Optional[str]]
|
|
12
12
|
searchString: str
|
|
13
|
-
searchType: Literal["VECTOR", "COMBINED"]
|
|
13
|
+
searchType: Literal["VECTOR", "COMBINED", "FULL_TEXT", "POSTGRES_FULL_TEXT"]
|
|
14
14
|
language: NotRequired[Optional[str]]
|
|
15
15
|
reranker: NotRequired[Optional[dict[str, Any]]]
|
|
16
16
|
scopeIds: NotRequired[Optional[list[str]]]
|
|
@@ -55,6 +55,11 @@ class Space(APIResource["Space"]):
|
|
|
55
55
|
class DeleteSpaceAccessParams(RequestOptions):
|
|
56
56
|
accessIds: List[str]
|
|
57
57
|
|
|
58
|
+
class Correlation(TypedDict):
|
|
59
|
+
parentMessageId: str
|
|
60
|
+
parentChatId: str
|
|
61
|
+
parentAssistantId: str
|
|
62
|
+
|
|
58
63
|
class CreateMessageParams(RequestOptions):
|
|
59
64
|
"""
|
|
60
65
|
Parameters for querying the assistant for a message.
|
|
@@ -65,6 +70,7 @@ class Space(APIResource["Space"]):
|
|
|
65
70
|
text: NotRequired[str | None]
|
|
66
71
|
toolChoices: NotRequired[List[str] | None]
|
|
67
72
|
scopeRules: NotRequired[dict | None]
|
|
73
|
+
correlation: NotRequired["Space.Correlation | None"]
|
|
68
74
|
|
|
69
75
|
class GetChatMessagesParams(RequestOptions):
|
|
70
76
|
"""
|
|
@@ -198,6 +204,9 @@ class Space(APIResource["Space"]):
|
|
|
198
204
|
class DeleteSpaceAccessResponse(TypedDict):
|
|
199
205
|
success: bool
|
|
200
206
|
|
|
207
|
+
class DeleteSpaceResponse(TypedDict):
|
|
208
|
+
id: str
|
|
209
|
+
|
|
201
210
|
id: str
|
|
202
211
|
name: str
|
|
203
212
|
defaultForCompanyId: Optional[str]
|
|
@@ -570,3 +579,43 @@ class Space(APIResource["Space"]):
|
|
|
570
579
|
params=params,
|
|
571
580
|
),
|
|
572
581
|
)
|
|
582
|
+
|
|
583
|
+
@classmethod
|
|
584
|
+
def delete_space(
|
|
585
|
+
cls,
|
|
586
|
+
user_id: str,
|
|
587
|
+
company_id: str,
|
|
588
|
+
space_id: str,
|
|
589
|
+
) -> "Space.DeleteSpaceResponse":
|
|
590
|
+
"""
|
|
591
|
+
Delete a space.
|
|
592
|
+
"""
|
|
593
|
+
return cast(
|
|
594
|
+
"Space.DeleteSpaceResponse",
|
|
595
|
+
cls._static_request(
|
|
596
|
+
"delete",
|
|
597
|
+
f"/space/{space_id}",
|
|
598
|
+
user_id,
|
|
599
|
+
company_id,
|
|
600
|
+
),
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
@classmethod
|
|
604
|
+
async def delete_space_async(
|
|
605
|
+
cls,
|
|
606
|
+
user_id: str,
|
|
607
|
+
company_id: str,
|
|
608
|
+
space_id: str,
|
|
609
|
+
) -> "Space.DeleteSpaceResponse":
|
|
610
|
+
"""
|
|
611
|
+
Async delete a space.
|
|
612
|
+
"""
|
|
613
|
+
return cast(
|
|
614
|
+
"Space.DeleteSpaceResponse",
|
|
615
|
+
await cls._static_request_async(
|
|
616
|
+
"delete",
|
|
617
|
+
f"/space/{space_id}",
|
|
618
|
+
user_id,
|
|
619
|
+
company_id,
|
|
620
|
+
),
|
|
621
|
+
)
|
|
@@ -21,6 +21,7 @@ async def send_message_and_wait_for_completion(
|
|
|
21
21
|
poll_interval: float = 1.0,
|
|
22
22
|
max_wait: float = 60.0,
|
|
23
23
|
stop_condition: Literal["stoppedStreamingAt", "completedAt"] = "stoppedStreamingAt",
|
|
24
|
+
correlation: "Space.Correlation | None" = None,
|
|
24
25
|
) -> "Space.Message":
|
|
25
26
|
"""
|
|
26
27
|
Sends a prompt asynchronously and polls for completion. (until stoppedStreamingAt is not None)
|
|
@@ -30,10 +31,14 @@ async def send_message_and_wait_for_completion(
|
|
|
30
31
|
company_id: The company ID.
|
|
31
32
|
assistant_id: The assistant ID.
|
|
32
33
|
text: The prompt text.
|
|
34
|
+
tool_choices: List of tool names to use.
|
|
35
|
+
scope_rules: Scope rules for filtering content.
|
|
36
|
+
chat_id: Optional chat ID to continue an existing chat.
|
|
33
37
|
poll_interval: Seconds between polls.
|
|
34
38
|
max_wait: Maximum seconds to wait for completion.
|
|
35
39
|
stop_condition: Defines when to expect a response back, when the assistant stop streaming or when it completes the message. (default: "stoppedStreamingAt")
|
|
36
|
-
|
|
40
|
+
correlation: Optional correlation data to link this message to a parent message in another chat.
|
|
41
|
+
Should contain: parentMessageId, parentChatId, parentAssistantId.
|
|
37
42
|
|
|
38
43
|
Returns:
|
|
39
44
|
The completed Space.Message.
|
|
@@ -46,6 +51,7 @@ async def send_message_and_wait_for_completion(
|
|
|
46
51
|
text=text,
|
|
47
52
|
toolChoices=tool_choices,
|
|
48
53
|
scopeRules=scope_rules,
|
|
54
|
+
correlation=correlation,
|
|
49
55
|
)
|
|
50
56
|
chat_id = response.get("chatId")
|
|
51
57
|
message_id = response.get("id")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_sdk
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.75
|
|
4
4
|
Summary:
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Martin Fadler
|
|
@@ -11,8 +11,13 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Provides-Extra: openai
|
|
14
|
+
Requires-Dist: aiohttp (>=3.9.0,<4.0.0)
|
|
15
|
+
Requires-Dist: anyio (>=4.0.0,<5.0.0)
|
|
16
|
+
Requires-Dist: httpx (>=0.28.0,<0.29.0)
|
|
14
17
|
Requires-Dist: openai (>=1.105.0,<2.0.0) ; extra == "openai"
|
|
18
|
+
Requires-Dist: regex (>=2024.5.15,<2025.0.0)
|
|
15
19
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
20
|
+
Requires-Dist: tiktoken (>=0.12.0,<0.13.0)
|
|
16
21
|
Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
|
|
17
22
|
Description-Content-Type: text/markdown
|
|
18
23
|
|
|
@@ -28,11 +33,48 @@ All notable changes to this project will be documented in this file.
|
|
|
28
33
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
29
34
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
30
35
|
|
|
36
|
+
## [0.10.75] - 2026-02-02
|
|
37
|
+
- Add correlation parameter to Message.create for linking messages to parent messages in other chats.
|
|
38
|
+
- Add correlation parameter to Space.create_message and send_message_and_wait_for_completion utility.
|
|
39
|
+
|
|
40
|
+
## [0.10.74] - 2026-01-22
|
|
41
|
+
- Add delete space function.
|
|
42
|
+
|
|
43
|
+
## [0.10.73] - 2026-01-21
|
|
44
|
+
- added searchtype `FULL_TEXT` and `POSTGRES_FULL_TEXT`
|
|
45
|
+
|
|
46
|
+
## [0.10.72] - 2026-01-20
|
|
47
|
+
- Expose elicitation functions [BETA feature].
|
|
48
|
+
|
|
49
|
+
## [0.10.71] - 2026-01-16
|
|
50
|
+
- Add local CI testing commands via poethepoet (poe lint, poe test, poe ci-typecheck, etc.)
|
|
51
|
+
|
|
52
|
+
## [0.10.70] - 2026-01-13
|
|
53
|
+
- Adding additional parameters `isQueueable`, `executionOptions` and `progressTitle` to the message execution
|
|
54
|
+
|
|
55
|
+
## [0.10.69] - 2026-01-16
|
|
56
|
+
- Add unified type checking CI with basedpyright
|
|
57
|
+
|
|
58
|
+
## [0.10.68] - 2026-01-13
|
|
59
|
+
- Add missing direct dependencies (httpx, anyio, aiohttp, regex, tiktoken) for deptry compliance
|
|
60
|
+
|
|
61
|
+
## [0.10.67] - 2026-01-14
|
|
62
|
+
- chore(deps): bump requests from 2.31.0 to 2.32.4 in examples/custom-assistant
|
|
63
|
+
|
|
64
|
+
## [0.10.66] - 2026-01-05
|
|
65
|
+
- Expose appliedIngestionConfig field on content search.
|
|
66
|
+
|
|
67
|
+
## [0.10.65] - 2025-01-05
|
|
68
|
+
- Add new params for elicitation to `call_tool` api
|
|
69
|
+
|
|
70
|
+
## [0.10.64] - 2025-12-31
|
|
71
|
+
- Add create path functionality to theupsert function and allow getinfo(s) to query by parentfolderpath.
|
|
72
|
+
|
|
31
73
|
## [0.10.63] - 2025-12-23
|
|
32
|
-
- Add functions to
|
|
74
|
+
- Add functions to create a space and manage its access.
|
|
33
75
|
|
|
34
76
|
## [0.10.62] - 2025-12-23
|
|
35
|
-
- Add get user
|
|
77
|
+
- Add get user groups function and allow the get users function to filter by username.
|
|
36
78
|
|
|
37
79
|
## [0.10.61] - 2025-12-22
|
|
38
80
|
- Add `displayInChat` field to ingestion config, allowing silent uploads to chat.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
unique_sdk/__init__.py,sha256=
|
|
1
|
+
unique_sdk/__init__.py,sha256=WqIkIYrEmUxsNCO5B5Nm6bFbbVaL_QLmcFarK4zAYsQ,4281
|
|
2
2
|
unique_sdk/_api_requestor.py,sha256=i4gCpzx8zP95sv-AhJfpQxKvWR0U-I6lclHyV55RPtg,14397
|
|
3
3
|
unique_sdk/_api_resource.py,sha256=ytjomI-IVJwsbvdPyuZCfF-bl-Abgf66bu1D34YxCu8,6244
|
|
4
4
|
unique_sdk/_api_version.py,sha256=Ku4JPdeyJtnX5eJJvRCEc1_u44UObdVrvrL1T-WwWCs,46
|
|
@@ -16,30 +16,31 @@ 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
|
|
18
18
|
unique_sdk/api_resources/_agentic_table.py,sha256=omdF4vbGCsjuQpPhuMUwaaGAb9nXscEUZsqUz3cz2AY,10353
|
|
19
|
-
unique_sdk/api_resources/_chat_completion.py,sha256=
|
|
20
|
-
unique_sdk/api_resources/_content.py,sha256=
|
|
19
|
+
unique_sdk/api_resources/_chat_completion.py,sha256=clTqSglg8x0liom0NTVce-gjam2SIxFgX8OrMeEBwpw,2207
|
|
20
|
+
unique_sdk/api_resources/_content.py,sha256=UNHsEIOyNVx5VFtv7n4MeXBxSyAW53vagUHMA5_Udec,19849
|
|
21
|
+
unique_sdk/api_resources/_elicitation.py,sha256=3VrYE__xVOYkTqR65hxVMYvHzRyBRLg0hu9wczV8xMk,6719
|
|
21
22
|
unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUElqDJJ8dG10,1281
|
|
22
23
|
unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
|
|
23
|
-
unique_sdk/api_resources/_folder.py,sha256=
|
|
24
|
+
unique_sdk/api_resources/_folder.py,sha256=h7f1NhTlC-pW9uAEMFw78vTpim_ctvRGB5rzcc-L87E,21553
|
|
24
25
|
unique_sdk/api_resources/_group.py,sha256=8A8mSjhWuhFxBA2r_z7q-70miJ_ugz7NAffVwbPu1oo,10302
|
|
25
26
|
unique_sdk/api_resources/_integrated.py,sha256=TxEKSYQZjZezBUk6kUgLvCgqgZXvgZR2IqHLieapKwQ,6204
|
|
26
27
|
unique_sdk/api_resources/_llm_models.py,sha256=3Jn6MpxWgZ43Hze8JHd4_n27si5xmwd3JE8r8cEZq_M,1640
|
|
27
|
-
unique_sdk/api_resources/_mcp.py,sha256=
|
|
28
|
-
unique_sdk/api_resources/_message.py,sha256=
|
|
28
|
+
unique_sdk/api_resources/_mcp.py,sha256=_kWSn4Awvd7vtopbYM3YKhV5-Xrz5h_LBlahmWlKx3U,3384
|
|
29
|
+
unique_sdk/api_resources/_message.py,sha256=3GSL0DZ3OoWjraCiGmgxV5rsFXiGN5MXyN0EQi5huME,11173
|
|
29
30
|
unique_sdk/api_resources/_message_assessment.py,sha256=SSfx6eW7zb_GKe8cFJzCqW-t-_eWEXxKP5cnIb0DhIc,2276
|
|
30
|
-
unique_sdk/api_resources/_message_execution.py,sha256=
|
|
31
|
+
unique_sdk/api_resources/_message_execution.py,sha256=B7gMisim5iJa8zzDRplIPAULrUd56S64GOltOV7z0sc,4833
|
|
31
32
|
unique_sdk/api_resources/_message_log.py,sha256=_DifZ4Di7uKyzkP0i8rwu5IIiYZPCBp5lvE4gfTrTHw,4793
|
|
32
|
-
unique_sdk/api_resources/_search.py,sha256=
|
|
33
|
+
unique_sdk/api_resources/_search.py,sha256=pEFowMjsKV4XgZkVB9MLkXaQkEUVQoDnIVQJLLJPaX0,1994
|
|
33
34
|
unique_sdk/api_resources/_search_string.py,sha256=LZz2_QPZXV1NXucRR06dnDC2miK7J8XBY7dXX2xoDY4,1610
|
|
34
35
|
unique_sdk/api_resources/_short_term_memory.py,sha256=vPRN-Y0WPx74E6y-A3LocGc0TxJdzT-xGL66WzZwKRg,2820
|
|
35
|
-
unique_sdk/api_resources/_space.py,sha256=
|
|
36
|
+
unique_sdk/api_resources/_space.py,sha256=bMOKH5Pq38yBSHDdHD_EoIUANE9u5JzPdEYv-n6lUcA,15761
|
|
36
37
|
unique_sdk/api_resources/_user.py,sha256=XGlE3SDtv-0qs9boT-ts6F2Cxq8RXAT5OCrvY5nOCx8,4677
|
|
37
38
|
unique_sdk/utils/chat_history.py,sha256=5UqL9hF1O9pV7skbNOlEibF5rHdYsmG3m5-YEPUowOs,3037
|
|
38
|
-
unique_sdk/utils/chat_in_space.py,sha256=
|
|
39
|
+
unique_sdk/utils/chat_in_space.py,sha256=QP6YD_XN2ZD2FGVEfatWrjRWJictK1EY9PV9gpWqHuM,6270
|
|
39
40
|
unique_sdk/utils/file_io.py,sha256=z0VdAOtrkU-tMq2v-nogeHtBku3TtnM5eJDHAR6A0-w,5721
|
|
40
41
|
unique_sdk/utils/sources.py,sha256=DoxxhMLcLhmDfNarjXa41H4JD2GSSDywr71hiC-4pYc,4952
|
|
41
42
|
unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
|
|
42
|
-
unique_sdk-0.10.
|
|
43
|
-
unique_sdk-0.10.
|
|
44
|
-
unique_sdk-0.10.
|
|
45
|
-
unique_sdk-0.10.
|
|
43
|
+
unique_sdk-0.10.75.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
|
|
44
|
+
unique_sdk-0.10.75.dist-info/METADATA,sha256=AMPZbmkiSU09sjsO8odO7FhQC-sciT-dQ1SxSfIrNmo,12671
|
|
45
|
+
unique_sdk-0.10.75.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
46
|
+
unique_sdk-0.10.75.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|