unique_sdk 0.10.19__py3-none-any.whl → 0.10.71__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.

Potentially problematic release.


This version of unique_sdk might be problematic. Click here for more details.

unique_sdk/__init__.py CHANGED
@@ -83,6 +83,9 @@ from unique_sdk.api_resources._short_term_memory import (
83
83
  from unique_sdk.api_resources._folder import Folder as Folder
84
84
  from unique_sdk.api_resources._embedding import Embeddings as Embeddings
85
85
  from unique_sdk.api_resources._acronyms import Acronyms as Acronyms
86
+ from unique_sdk.api_resources._llm_models import LLMModels as LLMModels
87
+ from unique_sdk.api_resources._user import User as User
88
+ from unique_sdk.api_resources._group import Group as Group
86
89
  from unique_sdk.api_resources._message_assessment import (
87
90
  MessageAssessment as MessageAssessment,
88
91
  )
@@ -19,8 +19,7 @@ class AgenticTableSheetState(StrEnum):
19
19
 
20
20
 
21
21
  class LogDetail(TypedDict, total=False):
22
- text: str
23
- messageId: str | None
22
+ llmRequest: list[dict] | None
24
23
 
25
24
 
26
25
  class LogEntry(TypedDict):
@@ -28,7 +27,7 @@ class LogEntry(TypedDict):
28
27
  createdAt: str
29
28
  actorType: Literal["USER", "SYSTEM", "ASSISTANT", "TOOL"]
30
29
  messageId: NotRequired[str]
31
- details: NotRequired[list[LogDetail]]
30
+ details: NotRequired[LogDetail]
32
31
 
33
32
 
34
33
  class AgenticTableCell(TypedDict, total=False):
@@ -37,7 +36,7 @@ class AgenticTableCell(TypedDict, total=False):
37
36
  columnOrder: int
38
37
  rowLocked: bool
39
38
  text: str
40
- logEntries: list[LogEntry]
39
+ logEntries: list[LogEntry] | None
41
40
 
42
41
 
43
42
  class ColumnMetadataUpdateStatus(TypedDict, total=False):
@@ -74,6 +73,29 @@ class CellRendererTypes(StrEnum):
74
73
  SELECTABLE_CELL_RENDERER = "SelectableCellRenderer"
75
74
 
76
75
 
76
+ class MagicTableAction(StrEnum):
77
+ DELETE_ROW = "DeleteRow"
78
+ DELETE_COLUMN = "DeleteColumn"
79
+ UPDATE_CELL = "UpdateCell"
80
+ ADD_QUESTION_TEXT = "AddQuestionText"
81
+ ADD_META_DATA = "AddMetaData"
82
+ GENERATE_ARTIFACT = "GenerateArtifact"
83
+ SHEET_COMPLETED = "SheetCompleted"
84
+ LIBRARY_SHEET_ROW_VERIFIED = "LibrarySheetRowVerified"
85
+ SHEET_CREATED = "SheetCreated"
86
+
87
+
88
+ class ActivityStatus(StrEnum):
89
+ IN_PROGRESS = "IN_PROGRESS"
90
+ COMPLETED = "COMPLETED"
91
+ FAILED = "FAILED"
92
+
93
+
94
+ class SheetType(StrEnum):
95
+ DEFAULT = "DEFAULT"
96
+ LIBRARY = "LIBRARY"
97
+
98
+
77
99
  class SelectionMethod(StrEnum):
78
100
  DEFAULT = "DEFAULT"
79
101
  MANUAL = "MANUAL"
@@ -106,24 +128,12 @@ class AgenticTable(APIResource["AgenticTable"]):
106
128
  tableId: str
107
129
  rowOrder: int
108
130
  columnOrder: int
131
+ includeRowMetadata: NotRequired[bool]
109
132
 
110
133
  class SetActivityStatus(RequestOptions):
111
134
  tableId: str
112
- activity: Literal[
113
- "DeleteRow",
114
- "DeleteColumn",
115
- "UpdateCell",
116
- "AddQuestionText",
117
- "AddMetaData",
118
- "GenerateArtifact",
119
- "SheetCompleted",
120
- "LibrarySheetRowVerified",
121
- ]
122
- status: Literal[
123
- "IN_PROGRESS",
124
- "COMPLETED",
125
- "FAILED",
126
- ]
135
+ activity: MagicTableAction
136
+ status: ActivityStatus
127
137
  text: str
128
138
 
129
139
  class SetArtifact(RequestOptions):
@@ -201,6 +211,9 @@ class AgenticTable(APIResource["AgenticTable"]):
201
211
  ) -> "AgenticTableCell":
202
212
  """ """
203
213
  url = f"/magic-table/{params['tableId']}/cell?rowOrder={params['rowOrder']}&columnOrder={params['columnOrder']}"
214
+ params.pop("tableId")
215
+ params.pop("rowOrder")
216
+ params.pop("columnOrder")
204
217
  return cast(
205
218
  "AgenticTableCell",
206
219
  await cls._static_request_async(
@@ -208,7 +221,7 @@ class AgenticTable(APIResource["AgenticTable"]):
208
221
  url,
209
222
  user_id,
210
223
  company_id,
211
- params={},
224
+ params=params,
212
225
  ),
213
226
  )
214
227
 
@@ -12,6 +12,7 @@ from typing import (
12
12
 
13
13
  from typing_extensions import NotRequired, Unpack
14
14
 
15
+ import unique_sdk
15
16
  from unique_sdk._api_resource import APIResource
16
17
  from unique_sdk._request_options import RequestOptions
17
18
 
@@ -19,6 +20,18 @@ from unique_sdk._request_options import RequestOptions
19
20
  class Content(APIResource["Content"]):
20
21
  OBJECT_NAME: ClassVar[Literal["content.search"]] = "content.search"
21
22
 
23
+ id: str
24
+ key: str
25
+ url: Optional[str]
26
+ title: Optional[str]
27
+ updatedAt: str
28
+ chunks: Optional[List["Content.Chunk"]]
29
+ metadata: Optional[Dict[str, Any]]
30
+ writeUrl: Optional[str]
31
+ readUrl: Optional[str]
32
+ expiredAt: Optional[str]
33
+ appliedIngestionConfig: Optional[Dict[str, Any]]
34
+
22
35
  class QueryMode(Enum):
23
36
  Default = "default"
24
37
  Insensitive = "insensitive"
@@ -72,7 +85,7 @@ class Content(APIResource["Content"]):
72
85
 
73
86
  class SearchParams(RequestOptions):
74
87
  where: "Content.ContentWhereInput"
75
- chatId: NotRequired[str]
88
+ chatId: NotRequired[str | None]
76
89
  includeFailedContent: NotRequired[bool]
77
90
 
78
91
  class ContentInfoParams(TypedDict):
@@ -81,10 +94,24 @@ class Content(APIResource["Content"]):
81
94
  This is used to retrieve information about content based on various filters.
82
95
  """
83
96
 
84
- metadataFilter: dict
85
- skip: NotRequired[int]
86
- take: NotRequired[int]
87
- filePath: NotRequired[str]
97
+ metadataFilter: NotRequired[dict[str, Any] | None]
98
+ skip: NotRequired[int | None]
99
+ take: NotRequired[int | None]
100
+ filePath: NotRequired[str | None]
101
+ contentId: NotRequired[str | None]
102
+ chatId: NotRequired[str | None]
103
+
104
+ class ContentInfosParams(TypedDict):
105
+ """
106
+ Parameters for the content infos endpoint.
107
+ This is used to retrieve information about contents based on various filters.
108
+ """
109
+
110
+ metadataFilter: NotRequired[dict[str, Any] | None]
111
+ skip: NotRequired[int | None]
112
+ take: NotRequired[int | None]
113
+ parentId: NotRequired[str | None]
114
+ parentFolderPath: NotRequired[str | None]
88
115
 
89
116
  class CustomApiOptions(TypedDict):
90
117
  apiIdentifier: str
@@ -108,29 +135,36 @@ class Content(APIResource["Content"]):
108
135
  uniqueIngestionMode: str
109
136
  vttConfig: Optional["Content.VttConfig"]
110
137
  wordReadMode: Optional[str]
138
+ hideInChat: Optional[bool]
111
139
 
112
140
  class Input(TypedDict):
113
141
  key: str
114
142
  title: Optional[str]
115
143
  mimeType: str
116
- ownerType: str
117
- ownerId: str
118
- byteSize: Optional[int]
119
- ingestionConfig: "Content.IngestionConfig"
120
- metadata: dict[str, Any] | None = None
144
+ description: NotRequired[str | None]
145
+ ownerType: NotRequired[str | None]
146
+ ownerId: NotRequired[str | None]
147
+ byteSize: NotRequired[int | None]
148
+ ingestionConfig: NotRequired["Content.IngestionConfig | None"]
149
+ metadata: NotRequired[dict[str, Any] | None]
121
150
 
122
151
  class UpsertParams(RequestOptions):
123
152
  input: "Content.Input"
124
- scopeId: Optional[str]
125
- chatId: Optional[str]
126
- sourceOwnerType: str
127
- storeInternally: bool
128
- fileUrl: Optional[str]
153
+ scopeId: NotRequired[str | None]
154
+ parentFolderPath: NotRequired[str | None]
155
+ createFolderIfNotExists: NotRequired[bool | None]
156
+ chatId: NotRequired[str | None]
157
+ sourceOwnerType: NotRequired[str | None]
158
+ storeInternally: NotRequired[bool | None]
159
+ fileUrl: NotRequired[str | None]
129
160
 
130
161
  class UpdateParams(RequestOptions):
131
- contentId: str | None = None
132
- ownerId: str | None = None
133
- title: str | None = None
162
+ contentId: NotRequired[str]
163
+ filePath: NotRequired[str]
164
+ ownerId: NotRequired[str]
165
+ parentFolderPath: NotRequired[str]
166
+ title: NotRequired[str]
167
+ metadata: NotRequired[dict[str, str | None]]
134
168
 
135
169
  class Chunk(TypedDict):
136
170
  id: str
@@ -151,6 +185,7 @@ class Content(APIResource["Content"]):
151
185
  title: str | None
152
186
  metadata: Dict[str, Any] | None
153
187
  mimeType: str
188
+ description: str | None
154
189
  byteSize: int
155
190
  ownerId: str
156
191
  createdAt: str
@@ -160,43 +195,43 @@ class Content(APIResource["Content"]):
160
195
  expiredAt: str | None
161
196
 
162
197
  class PaginatedContentInfo(TypedDict):
198
+ contentInfo: List["Content.ContentInfo"]
199
+ totalCount: int
200
+
201
+ class PaginatedContentInfos(TypedDict):
163
202
  contentInfos: List["Content.ContentInfo"]
164
203
  totalCount: int
165
204
 
166
205
  class DeleteParams(RequestOptions):
167
206
  contentId: NotRequired[str]
207
+ filePath: NotRequired[str]
168
208
  chatId: NotRequired[str]
169
209
 
170
210
  class DeleteResponse(TypedDict):
171
211
  id: str
172
212
 
173
- id: str
174
- key: str
175
- url: Optional[str]
176
- title: Optional[str]
177
- updatedAt: str
178
- chunks: List[Chunk]
179
- metadata: Optional[Dict[str, Any]]
180
-
181
213
  class MagicTableSheetTableColumn(TypedDict):
182
214
  columnId: str
183
215
  columnName: str
184
216
  content: str
185
217
 
186
- class MagicTableSheetTable(TypedDict):
218
+ class MagicTableRow(TypedDict):
187
219
  rowId: str
188
220
  columns: List["Content.MagicTableSheetTableColumn"]
221
+ context: NotRequired[str]
222
+ rowMetadata: NotRequired[str]
189
223
 
190
224
  class MagicTableSheetIngestionConfiguration(TypedDict):
191
225
  columnIdsInMetadata: List[str]
192
226
  columnIdsInChunkText: List[str]
193
227
 
194
228
  class MagicTableSheetIngestParams(TypedDict):
195
- data: List["Content.MagicTableSheetTable"]
229
+ data: List["Content.MagicTableRow"]
196
230
  ingestionConfiguration: "Content.MagicTableSheetIngestionConfiguration"
197
231
  metadata: Dict[str, Optional[str]]
198
232
  scopeId: str
199
233
  sheetName: str
234
+ context: NotRequired[str]
200
235
 
201
236
  class MagicTableSheetRowIdToContentId(TypedDict):
202
237
  rowId: str
@@ -282,10 +317,20 @@ class Content(APIResource["Content"]):
282
317
  cls,
283
318
  user_id: str,
284
319
  company_id: str,
285
- **params: Unpack["Content.ContentInfoParams"],
286
- ) -> "Content.PaginatedContentInfo":
320
+ **params: Unpack["Content.ContentInfosParams"],
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
+
287
332
  return cast(
288
- Content.PaginatedContentInfo,
333
+ Content.PaginatedContentInfos,
289
334
  cls._static_request(
290
335
  "post",
291
336
  "/content/infos",
@@ -300,10 +345,20 @@ class Content(APIResource["Content"]):
300
345
  cls,
301
346
  user_id: str,
302
347
  company_id: str,
303
- **params: Unpack["Content.ContentInfoParams"],
304
- ) -> "Content.PaginatedContentInfo":
348
+ **params: Unpack["Content.ContentInfosParams"],
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
+
305
360
  return cast(
306
- Content.PaginatedContentInfo,
361
+ Content.PaginatedContentInfos,
307
362
  await cls._static_request_async(
308
363
  "post",
309
364
  "/content/infos",
@@ -325,6 +380,22 @@ class Content(APIResource["Content"]):
325
380
  """
326
381
  if "input" in params:
327
382
  params["input"]["metadata"] = params["input"].get("metadata") or {}
383
+ if "description" in params["input"] and not params["input"]["description"]:
384
+ params["input"].pop("description")
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
+
328
399
  return cast(
329
400
  "Content",
330
401
  cls._static_request(
@@ -348,6 +419,26 @@ class Content(APIResource["Content"]):
348
419
  """
349
420
  if "input" in params:
350
421
  params["input"]["metadata"] = params["input"].get("metadata") or {}
422
+ if "description" in params["input"] and not params["input"]["description"]:
423
+ params["input"].pop("description")
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
+
351
442
  return cast(
352
443
  "Content",
353
444
  await cls._static_request_async(
@@ -402,11 +493,29 @@ class Content(APIResource["Content"]):
402
493
  company_id: str,
403
494
  **params: Unpack["Content.UpdateParams"],
404
495
  ) -> "Content.ContentInfo":
496
+ content_id = cls.resolve_content_id_from_file_path(
497
+ user_id=user_id,
498
+ company_id=company_id,
499
+ content_id=params.get("contentId"),
500
+ file_path=params.get("filePath"),
501
+ )
502
+ owner_id = unique_sdk.Folder.resolve_scope_id_from_folder_path(
503
+ user_id,
504
+ company_id,
505
+ params.get("ownerId"),
506
+ params.get("parentFolderPath"),
507
+ )
508
+ params.pop("contentId", None)
509
+ params.pop("filePath", None)
510
+ params.pop("parentFolderPath", None)
511
+ if owner_id is not None:
512
+ params["ownerId"] = owner_id
513
+
405
514
  return cast(
406
515
  "Content.ContentInfo",
407
516
  cls._static_request(
408
517
  "patch",
409
- f"/content/{params.get('contentId')}",
518
+ f"/content/{content_id}",
410
519
  user_id,
411
520
  company_id,
412
521
  params=params,
@@ -420,11 +529,29 @@ class Content(APIResource["Content"]):
420
529
  company_id: str,
421
530
  **params: Unpack["Content.UpdateParams"],
422
531
  ) -> "Content.ContentInfo":
532
+ content_id = cls.resolve_content_id_from_file_path(
533
+ user_id,
534
+ company_id,
535
+ params.get("contentId"),
536
+ params.get("filePath"),
537
+ )
538
+ owner_id = await unique_sdk.Folder.resolve_scope_id_from_folder_path_async(
539
+ user_id,
540
+ company_id,
541
+ params.get("ownerId"),
542
+ params.get("parentFolderPath"),
543
+ )
544
+ params.pop("contentId", None)
545
+ params.pop("filePath", None)
546
+ params.pop("parentFolderPath", None)
547
+ if owner_id is not None:
548
+ params["ownerId"] = owner_id
549
+
423
550
  return cast(
424
551
  "Content.ContentInfo",
425
552
  await cls._static_request_async(
426
553
  "patch",
427
- f"/content/{params.get('contentId')}",
554
+ f"/content/{content_id}",
428
555
  user_id,
429
556
  company_id,
430
557
  params=params,
@@ -436,17 +563,25 @@ class Content(APIResource["Content"]):
436
563
  cls,
437
564
  user_id: str,
438
565
  company_id: str,
439
- **params: "Content.DeleteParams",
566
+ **params: Unpack["Content.DeleteParams"],
440
567
  ) -> "Content.DeleteResponse":
441
568
  """
442
569
  Deletes a content by its id or file path.
443
570
  """
571
+ content_id = cls.resolve_content_id_from_file_path(
572
+ user_id,
573
+ company_id,
574
+ params.get("contentId"),
575
+ params.get("filePath"),
576
+ )
577
+ params.pop("contentId", None)
578
+ params.pop("filePath", None)
444
579
 
445
580
  return cast(
446
581
  "Content.DeleteResponse",
447
582
  cls._static_request(
448
583
  "delete",
449
- f"/content/{params.get('contentId')}",
584
+ f"/content/{content_id}",
450
585
  user_id,
451
586
  company_id,
452
587
  params=params,
@@ -458,17 +593,25 @@ class Content(APIResource["Content"]):
458
593
  cls,
459
594
  user_id: str,
460
595
  company_id: str,
461
- **params: "Content.DeleteParams",
596
+ **params: Unpack["Content.DeleteParams"],
462
597
  ) -> "Content.DeleteResponse":
463
598
  """
464
599
  Async deletes a content by its id or file path.
465
600
  """
601
+ content_id = cls.resolve_content_id_from_file_path(
602
+ user_id,
603
+ company_id,
604
+ params.get("contentId"),
605
+ params.get("filePath"),
606
+ )
607
+ params.pop("contentId", None)
608
+ params.pop("filePath", None)
466
609
 
467
610
  return cast(
468
611
  "Content.DeleteResponse",
469
612
  await cls._static_request_async(
470
613
  "delete",
471
- f"/content/{params.get('contentId')}",
614
+ f"/content/{content_id}",
472
615
  user_id,
473
616
  company_id,
474
617
  params=params,
@@ -482,10 +625,14 @@ class Content(APIResource["Content"]):
482
625
  company_id: str,
483
626
  content_id: str | None = None,
484
627
  file_path: str | None = None,
485
- ) -> str:
628
+ ) -> str | None:
486
629
  """
487
630
  Returns the contentId to use: if content_id is provided, returns it;
488
631
  if not, but file_path is provided, resolves and returns the id for that file path.
632
+
633
+ Returns:
634
+ str: The resolved content ID.
635
+ None: Failed to resolve a content ID (e.g., file_path not found or not provided).
489
636
  """
490
637
  if content_id:
491
638
  return content_id
@@ -495,9 +642,12 @@ class Content(APIResource["Content"]):
495
642
  company_id=company_id,
496
643
  filePath=file_path,
497
644
  )
645
+ content_infos = file_info.get("contentInfo")
498
646
  resolved_id = (
499
- file_info.get("contentInfo")[0].get("id")
647
+ content_infos[0].get("id")
500
648
  if file_info.get("totalCount", 0) > 0
649
+ and content_infos is not None
650
+ and len(content_infos) > 0
501
651
  else None
502
652
  )
503
653
  if not resolved_id: