unique_sdk 0.9.26__py3-none-any.whl → 0.9.28__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.
@@ -65,6 +65,16 @@ class Content(APIResource["Content"]):
65
65
  where: "Content.ContentWhereInput"
66
66
  chatId: NotRequired[str]
67
67
 
68
+ class ContentInfoParams(TypedDict):
69
+ """
70
+ Parameters for the content info endpoint.
71
+ This is used to retrieve information about content based on various filters.
72
+ """
73
+
74
+ metadataFilter: dict
75
+ skip: int | None
76
+ take: int | None
77
+
68
78
  class CustomApiOptions(TypedDict):
69
79
  apiIdentifier: str
70
80
  apiPayload: Optional[str]
@@ -96,6 +106,7 @@ class Content(APIResource["Content"]):
96
106
  ownerId: str
97
107
  byteSize: Optional[int]
98
108
  ingestionConfig: "Content.IngestionConfig"
109
+ metadata: dict[str, any] | None = None
99
110
 
100
111
  class UpsertParams(RequestOptions):
101
112
  input: "Content.Input"
@@ -112,6 +123,30 @@ class Content(APIResource["Content"]):
112
123
  endPage: Optional[int]
113
124
  order: Optional[int]
114
125
 
126
+ class ContentInfo(TypedDict):
127
+ """
128
+ Partial representation of the content containing only the base information.
129
+ This is used for the content info endpoint.
130
+ """
131
+
132
+ id: str
133
+ key: str
134
+ url: str | None
135
+ title: str | None
136
+ metadata: Dict[str, Any] | None
137
+ mimeType: str
138
+ byteSize: int
139
+ ownerId: str
140
+ createdAt: str
141
+ updatedAt: str
142
+ expiresAt: str | None
143
+ deletedAt: str | None
144
+ expiredAt: str | None
145
+
146
+ class PaginatedContentInfo(TypedDict):
147
+ contentInfo: List["Content.ContentInfo"]
148
+ totalCount: int
149
+
115
150
  id: str
116
151
  key: str
117
152
  url: Optional[str]
@@ -156,6 +191,42 @@ class Content(APIResource["Content"]):
156
191
  ),
157
192
  )
158
193
 
194
+ @classmethod
195
+ def get_info(
196
+ cls,
197
+ user_id: str,
198
+ company_id: str,
199
+ **params: Unpack["Content.ContentInfoParams"],
200
+ ) -> PaginatedContentInfo:
201
+ return cast(
202
+ Content.PaginatedContentInfo,
203
+ cls._static_request(
204
+ "post",
205
+ "/content/info",
206
+ user_id,
207
+ company_id,
208
+ params=params,
209
+ ),
210
+ )
211
+
212
+ @classmethod
213
+ async def get_info_async(
214
+ cls,
215
+ user_id: str,
216
+ company_id: str,
217
+ **params: Unpack["Content.ContentInfoParams"],
218
+ ) -> PaginatedContentInfo:
219
+ return cast(
220
+ Content.PaginatedContentInfo,
221
+ await cls._static_request_async(
222
+ "post",
223
+ "/content/info",
224
+ user_id,
225
+ company_id,
226
+ params=params,
227
+ ),
228
+ )
229
+
159
230
  @classmethod
160
231
  def upsert(
161
232
  cls,
@@ -41,6 +41,7 @@ def upload_file(
41
41
  scope_or_unique_path=None,
42
42
  chat_id=None,
43
43
  ingestion_config: Optional[Content.IngestionConfig] = None,
44
+ metadata: dict[str, any] | None = None,
44
45
  ):
45
46
  # check that chatid or scope_or_unique_path is provided
46
47
  if not chat_id and not scope_or_unique_path:
@@ -54,7 +55,8 @@ def upload_file(
54
55
  "key": displayed_filename,
55
56
  "title": displayed_filename,
56
57
  "mimeType": mime_type,
57
- "ingestionConfig": ingestion_config, # Pass ingestionConfig here
58
+ "ingestionConfig": ingestion_config,
59
+ "metadata": metadata,
58
60
  },
59
61
  scopeId=scope_or_unique_path,
60
62
  chatId=chat_id,
@@ -83,6 +85,7 @@ def upload_file(
83
85
  "mimeType": mime_type,
84
86
  "byteSize": size,
85
87
  "ingestionConfig": ingestion_config,
88
+ "metadata": metadata,
86
89
  },
87
90
  fileUrl=createdContent.readUrl,
88
91
  chatId=chat_id,
@@ -97,6 +100,7 @@ def upload_file(
97
100
  "mimeType": mime_type,
98
101
  "byteSize": size,
99
102
  "ingestionConfig": ingestion_config,
103
+ "metadata": metadata,
100
104
  },
101
105
  fileUrl=createdContent.readUrl,
102
106
  scopeId=scope_or_unique_path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.9.26
3
+ Version: 0.9.28
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -10,6 +10,7 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
13
14
  Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
14
15
  Description-Content-Type: text/markdown
15
16
 
@@ -282,6 +283,73 @@ unique_sdk.Content.search(
282
283
  )
283
284
  ```
284
285
 
286
+ #### `unique_sdk.Content.get_info`
287
+
288
+ Allows you to get content info. To filter the results you can define a metadata filter in UniqueQL language. Find out more about it in the UniqueQL section. An example of a metadata filter defined with UniqueQL is the following:
289
+
290
+ ```python
291
+ metadataFilter: {
292
+ "or": [
293
+ {
294
+ "and": [
295
+ {
296
+ "operator": "contains",
297
+ "path": [
298
+ "folderIdPath"
299
+ ],
300
+ "value": "uniquepathid://test_id"
301
+ },
302
+ {
303
+ "operator": "contains",
304
+ "path": [
305
+ "title"
306
+ ],
307
+ "value": "ai"
308
+ }
309
+ ]
310
+ }
311
+ ]
312
+ },
313
+ ```
314
+
315
+ Pagination is also enabled for this functionality, and the default number of returned results is 50 with no entries skipped. Use the following paramteres to get the desired page:`
316
+
317
+ - `skip`
318
+ - `take`
319
+
320
+ Here is an example of retrieving the first 3 content infos that contain the value `uniquepathid://scope_abcdibgznc4bkdcx120zm5d` in the `folderIdPath` metadata and the value `ai` for the `tile` metadata.
321
+
322
+ ```python
323
+ content_info_result = unique_sdk.Content.get_info(
324
+ user_id=user_id,
325
+ company_id=company_id,
326
+ metadataFilter={
327
+ "or": [
328
+ {
329
+ "and": [
330
+ {
331
+ "operator": "contains",
332
+ "path": [
333
+ "folderIdPath"
334
+ ],
335
+ "value": "uniquepathid://scope_abcdibgznc4bkdcx120zm5d"
336
+ },
337
+ {
338
+ "operator": "contains",
339
+ "path": [
340
+ "title"
341
+ ],
342
+ "value": "ai"
343
+ }
344
+ ]
345
+ }
346
+ ]
347
+ },
348
+ skip=0,
349
+ take=3,
350
+ )
351
+ ```
352
+
285
353
  #### `unique_sdk.Content.upsert`
286
354
 
287
355
  Enables upload of a new Content into the Knowledge base of unique into a specific scope with `scopeId` or a specific `chatId`. One of the two must be set.
@@ -302,6 +370,9 @@ createdContent = upload_file(
302
370
  "chunkStrategy": "default",
303
371
  "uniqueIngestionMode": "standard",
304
372
  },
373
+ metadata={
374
+ "folderIdPath": "uniquepathid://scope_id"
375
+ }
305
376
  )
306
377
 
307
378
  def upload_file(
@@ -312,6 +383,7 @@ def upload_file(
312
383
  mimeType,
313
384
  scope_or_unique_path,
314
385
  ingestion_config=None,
386
+ metadata=None,
315
387
  ):
316
388
  size = os.path.getsize(path_to_file)
317
389
  createdContent = unique_sdk.Content.upsert(
@@ -322,6 +394,7 @@ def upload_file(
322
394
  "title": displayed_filename,
323
395
  "mimeType": mimeType,
324
396
  "ingestionConfig": ingestionConfig,
397
+ "metadata": metadata,
325
398
  },
326
399
  scopeId=scope_or_unique_path,
327
400
  )
@@ -348,6 +421,7 @@ def upload_file(
348
421
  "mimeType": mimeType,
349
422
  "byteSize": size,
350
423
  "ingestionConfig": ingestionConfig,
424
+ "metadata": metadata,
351
425
  },
352
426
  scopeId=scope_or_unique_path,
353
427
  readUrl=createdContent.readUrl,
@@ -949,6 +1023,12 @@ All notable changes to this project will be documented in this file.
949
1023
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
950
1024
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
951
1025
 
1026
+ ## [0.9.28] - 2025-05-20
1027
+ - Add function to search content info. This also allows filtering content info by metadata info.
1028
+
1029
+ ## [0.9.27] - 2025-05-14
1030
+ - Add the possibility to specify metadata when creating or updating a Content.
1031
+
952
1032
  ## [0.9.26] - 2025-05-13
953
1033
  - Add the possibility to specify ingestionConfig when creating or updating a Content.
954
1034
 
@@ -16,7 +16,7 @@ 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/_chat_completion.py,sha256=hAPPHxoljcoHeTboxoJkcXgpqA2hNBu6a6vamdxag58,2000
19
- unique_sdk/api_resources/_content.py,sha256=y8LU7H7GNh6R5uowRHP6u1Yq-bQZF-5tNdsz_GLRcIA,5713
19
+ unique_sdk/api_resources/_content.py,sha256=GWCiJMjbiNQFvo8RZ9cnCnTbWMo4NiUxLx-WgTzssc4,7589
20
20
  unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUElqDJJ8dG10,1281
21
21
  unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
22
22
  unique_sdk/api_resources/_integrated.py,sha256=l1vS8kJiSLie61mqDO3KI2MNmYwFydmCIoJpP_tPhSI,2956
@@ -26,10 +26,10 @@ unique_sdk/api_resources/_search.py,sha256=pAVMXL2AdJNP5JG-7LlaU2Uw1152iUaMZ2YO7
26
26
  unique_sdk/api_resources/_search_string.py,sha256=4Idw6exgZdA8qksz9WkiA68k1hTU-7yFkgT_OLU_GkE,1662
27
27
  unique_sdk/api_resources/_short_term_memory.py,sha256=vPRN-Y0WPx74E6y-A3LocGc0TxJdzT-xGL66WzZwKRg,2820
28
28
  unique_sdk/utils/chat_history.py,sha256=5UqL9hF1O9pV7skbNOlEibF5rHdYsmG3m5-YEPUowOs,3037
29
- unique_sdk/utils/file_io.py,sha256=28Edm3g1xvW7FWAvAmmG0K63o6XbTY2aCZkIviTQOI4,4176
29
+ unique_sdk/utils/file_io.py,sha256=jR1sj1SxOvqmCoLfYkevgTktcTZId0ORoqYjmwVoyJw,4301
30
30
  unique_sdk/utils/sources.py,sha256=wfboE-neMKa0Wuq9QzfAEFMkNLrIrmm0v-QF33sLo6k,4952
31
31
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
32
- unique_sdk-0.9.26.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
33
- unique_sdk-0.9.26.dist-info/METADATA,sha256=qm0wVfwhtgQICr-3iOYgpwE0OaJSYQ39ZEXcXqGmru8,30967
34
- unique_sdk-0.9.26.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
35
- unique_sdk-0.9.26.dist-info/RECORD,,
32
+ unique_sdk-0.9.28.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
33
+ unique_sdk-0.9.28.dist-info/METADATA,sha256=xYS1uF8nf68oCH1Q8veoEejLG5jkDtIuo5NIzy2PDS0,33458
34
+ unique_sdk-0.9.28.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
35
+ unique_sdk-0.9.28.dist-info/RECORD,,