digitalkin 0.2.15__py3-none-any.whl → 0.2.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.
digitalkin/__version__.py CHANGED
@@ -5,4 +5,4 @@ from importlib.metadata import PackageNotFoundError, version
5
5
  try:
6
6
  __version__ = version("digitalkin")
7
7
  except PackageNotFoundError:
8
- __version__ = "0.2.15"
8
+ __version__ = "0.2.16"
@@ -5,7 +5,7 @@ import os
5
5
  import tempfile
6
6
  import uuid
7
7
  from pathlib import Path
8
- from typing import Any
8
+ from typing import Any, Literal
9
9
 
10
10
  from digitalkin.logger import logger
11
11
  from digitalkin.services.filesystem.filesystem_strategy import (
@@ -259,7 +259,17 @@ class DefaultFilesystem(FilesystemStrategy):
259
259
  self,
260
260
  file_id: str,
261
261
  content: bytes | None = None,
262
- file_type: str | None = None,
262
+ file_type: Literal[
263
+ "UNSPECIFIED",
264
+ "DOCUMENT",
265
+ "IMAGE",
266
+ "VIDEO",
267
+ "AUDIO",
268
+ "ARCHIVE",
269
+ "CODE",
270
+ "OTHER",
271
+ ]
272
+ | None = None,
263
273
  content_type: str | None = None,
264
274
  metadata: dict[str, Any] | None = None,
265
275
  new_name: str | None = None,
@@ -2,7 +2,7 @@
2
2
 
3
3
  from abc import ABC, abstractmethod
4
4
  from datetime import datetime
5
- from typing import Any
5
+ from typing import Any, Literal
6
6
 
7
7
  from pydantic import BaseModel, Field
8
8
 
@@ -34,7 +34,21 @@ class FileFilter(BaseModel):
34
34
 
35
35
  names: list[str] | None = Field(default=None, description="Filter by file names (exact matches)")
36
36
  file_ids: list[str] | None = Field(default=None, description="Filter by file IDs")
37
- file_types: list[str] | None = Field(default=None, description="Filter by file types")
37
+ file_types: (
38
+ list[
39
+ Literal[
40
+ "UNSPECIFIED",
41
+ "DOCUMENT",
42
+ "IMAGE",
43
+ "AUDIO",
44
+ "VIDEO",
45
+ "ARCHIVE",
46
+ "CODE",
47
+ "OTHER",
48
+ ]
49
+ ]
50
+ | None
51
+ ) = Field(default=None, description="Filter by file types")
38
52
  created_after: datetime | None = Field(default=None, description="Filter files created after this timestamp")
39
53
  created_before: datetime | None = Field(default=None, description="Filter files created before this timestamp")
40
54
  updated_after: datetime | None = Field(default=None, description="Filter files updated after this timestamp")
@@ -52,7 +66,16 @@ class UploadFileData(BaseModel):
52
66
 
53
67
  content: bytes = Field(description="The content of the file")
54
68
  name: str = Field(description="The name of the file")
55
- file_type: str = Field(description="The type of the file")
69
+ file_type: Literal[
70
+ "UNSPECIFIED",
71
+ "DOCUMENT",
72
+ "IMAGE",
73
+ "AUDIO",
74
+ "VIDEO",
75
+ "ARCHIVE",
76
+ "CODE",
77
+ "OTHER",
78
+ ] = Field(description="The type of the file")
56
79
  content_type: str | None = Field(default=None, description="The content type of the file")
57
80
  metadata: dict[str, Any] | None = Field(default=None, description="The metadata of the file")
58
81
  replace_if_exists: bool = Field(default=False, description="Whether to replace the file if it already exists")
@@ -153,7 +176,17 @@ class FilesystemStrategy(BaseStrategy, ABC):
153
176
  self,
154
177
  file_id: str,
155
178
  content: bytes | None = None,
156
- file_type: str | None = None,
179
+ file_type: Literal[
180
+ "UNSPECIFIED",
181
+ "DOCUMENT",
182
+ "IMAGE",
183
+ "VIDEO",
184
+ "AUDIO",
185
+ "ARCHIVE",
186
+ "CODE",
187
+ "OTHER",
188
+ ]
189
+ | None = None,
157
190
  content_type: str | None = None,
158
191
  metadata: dict[str, Any] | None = None,
159
192
  new_name: str | None = None,
@@ -2,7 +2,7 @@
2
2
 
3
3
  from collections.abc import Generator
4
4
  from contextlib import contextmanager
5
- from typing import Any
5
+ from typing import Any, Literal
6
6
 
7
7
  from digitalkin_proto.digitalkin.filesystem.v1 import filesystem_pb2, filesystem_service_pb2_grpc
8
8
  from google.protobuf import struct_pb2
@@ -103,12 +103,11 @@ class GrpcFilesystem(FilesystemStrategy, GrpcClientWrapper):
103
103
  status=self._file_status_to_enum(filters.status) if filters.status else None,
104
104
  )
105
105
 
106
- def _file_proto_to_data(self, file: filesystem_pb2.File, content: bytes | None = None) -> FilesystemRecord:
106
+ def _file_proto_to_data(self, file: filesystem_pb2.File) -> FilesystemRecord:
107
107
  """Convert a File proto message to FilesystemRecord.
108
108
 
109
109
  Args:
110
110
  file: The File proto message to convert
111
- content: The content of the file
112
111
 
113
112
  Returns:
114
113
  FilesystemRecord: The converted data
@@ -124,7 +123,7 @@ class GrpcFilesystem(FilesystemStrategy, GrpcClientWrapper):
124
123
  metadata=MessageToDict(file.metadata),
125
124
  storage_url=file.storage_url,
126
125
  status=filesystem_pb2.FileStatus.Name(file.status),
127
- content=content,
126
+ content=file.content,
128
127
  )
129
128
 
130
129
  def __init__(
@@ -213,13 +212,23 @@ class GrpcFilesystem(FilesystemStrategy, GrpcClientWrapper):
213
212
 
214
213
  response: filesystem_pb2.GetFileResponse = self.exec_grpc_query("GetFile", request)
215
214
 
216
- return self._file_proto_to_data(response.file, response.content)
215
+ return self._file_proto_to_data(response.file)
217
216
 
218
217
  def update_file(
219
218
  self,
220
219
  file_id: str,
221
220
  content: bytes | None = None,
222
- file_type: str | None = None,
221
+ file_type: Literal[
222
+ "UNSPECIFIED",
223
+ "DOCUMENT",
224
+ "IMAGE",
225
+ "VIDEO",
226
+ "AUDIO",
227
+ "ARCHIVE",
228
+ "CODE",
229
+ "OTHER",
230
+ ]
231
+ | None = None,
223
232
  content_type: str | None = None,
224
233
  metadata: dict[str, Any] | None = None,
225
234
  new_name: str | None = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: digitalkin
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: SDK to build kin used in DigitalKin
5
5
  Author-email: "DigitalKin.ai" <contact@digitalkin.ai>
6
6
  License: Attribution-NonCommercial-ShareAlike 4.0 International
@@ -7,7 +7,7 @@ base_server/mock/__init__.py,sha256=YZFT-F1l_TpvJYuIPX-7kTeE1CfOjhx9YmNRXVoi-jQ,
7
7
  base_server/mock/mock_pb2.py,sha256=sETakcS3PAAm4E-hTCV1jIVaQTPEAIoVVHupB8Z_k7Y,1843
8
8
  base_server/mock/mock_pb2_grpc.py,sha256=BbOT70H6q3laKgkHfOx1QdfmCS_HxCY4wCOX84YAdG4,3180
9
9
  digitalkin/__init__.py,sha256=7LLBAba0th-3SGqcpqFO-lopWdUkVLKzLZiMtB-mW3M,162
10
- digitalkin/__version__.py,sha256=GxhXo6zJ5Xxw-pyzgpQ5JGuE2pD4yvOoWCyz8hiyjwU,191
10
+ digitalkin/__version__.py,sha256=M-XK8XT3lEHqZRrh1JSvDJX8Ri-RXYjKzp3zOM-qaDA,191
11
11
  digitalkin/logger.py,sha256=cFbIAZHOFx3nddOssRNYLXyqUPzR4CgDR_c-5wmB-og,1685
12
12
  digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  digitalkin/grpc_servers/__init__.py,sha256=0cJBlwipSmFdXkyH3T0i6OJ1WpAtNsZgYX7JaSnkbtg,804
@@ -50,9 +50,9 @@ digitalkin/services/cost/cost_strategy.py,sha256=VhHeqi9WnE1yoDBBVp5qmqwIt5tTZHU
50
50
  digitalkin/services/cost/default_cost.py,sha256=mEd0VL_tMcGU41q0f9MFeBYeKZBenv0mIHuwgXlQ7uQ,3869
51
51
  digitalkin/services/cost/grpc_cost.py,sha256=p_5mG72N7e4bxwBOD9DNokvLtinBILiqCfllmkqpmhw,6253
52
52
  digitalkin/services/filesystem/__init__.py,sha256=BhwMl_BUvM0d65fmglkp0SVwn3RfYiUOKJgIMnOCaGM,381
53
- digitalkin/services/filesystem/default_filesystem.py,sha256=RATQqhdlujaTZNGbYtIstUSVSoahioghdzXFvv1X11Y,14771
54
- digitalkin/services/filesystem/filesystem_strategy.py,sha256=CJTjCz0eDikeTSFlL_YMwdHpIPxBSO9Yx3fDTgfYSTM,8405
55
- digitalkin/services/filesystem/grpc_filesystem.py,sha256=9Zw6SUbQNDV7B4rwgU5qG0b1v-2qBFElfLnjnpZ8qhA,12331
53
+ digitalkin/services/filesystem/default_filesystem.py,sha256=kyNoxnzIAQ-hrBgushwV6GUqtcpno77wUI3qaP7Ge1c,14981
54
+ digitalkin/services/filesystem/filesystem_strategy.py,sha256=-0oad7P0wqL47DJY30snlnGh7RrruFTZT-G9iFmbAk4,9047
55
+ digitalkin/services/filesystem/grpc_filesystem.py,sha256=0U9n4CjTkzscwvFLKYdA0StyHRuV9lCjGbwr7OFrRxI,12453
56
56
  digitalkin/services/identity/__init__.py,sha256=InkeyLgFYYwItx8mePA8HpfacOMWZwwuc0G4pWtKq9s,270
57
57
  digitalkin/services/identity/default_identity.py,sha256=Y2auZHrGSZTIN5D8HyjLvLcNbYFM1CNUE23x7p5VIGw,386
58
58
  digitalkin/services/identity/identity_strategy.py,sha256=skappBbds1_qa0Gr24FGrNX1N0_OYhYT1Lh7dUaAirE,429
@@ -74,14 +74,14 @@ digitalkin/utils/__init__.py,sha256=sJnY-ZUgsjMfojAjONC1VN14mhgIDnzyOlGkw21rRnM,
74
74
  digitalkin/utils/arg_parser.py,sha256=nvjI1pKDY1HfS0oGcMQPtdTQcggXLtpxXMbnMxNEKRU,3109
75
75
  digitalkin/utils/development_mode_action.py,sha256=TqRuAF_A7bDD4twRB4PnZcRoNeaiAnEdxM5kvy4aoaA,1511
76
76
  digitalkin/utils/llm_ready_schema.py,sha256=JjMug_lrQllqFoanaC091VgOqwAd-_YzcpqFlS7p778,2375
77
- digitalkin-0.2.15.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
77
+ digitalkin-0.2.16.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
78
78
  modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
79
  modules/cpu_intensive_module.py,sha256=ejB9XPnFfA0uCuFUQbM3fy5UYfqqAlF36rv_P5Ri8ho,8363
80
80
  modules/minimal_llm_module.py,sha256=Ijld__ZnhzfLwpXD1XVkLZ7jyKZKyOFZczOpiPttJZc,11216
81
81
  modules/text_transform_module.py,sha256=bwPSnEUthZQyfLwcTLo52iAxItAoknkLh8Y3m5aywaY,7251
82
82
  services/filesystem_module.py,sha256=71Mcja8jCQqiqFHPdsIXplFIHTvgkxRhp0TRXuCfgkk,7430
83
83
  services/storage_module.py,sha256=ybTMqmvGaTrR8PqJ4FU0cwxaDjT36TskVrGoetTGmno,6955
84
- digitalkin-0.2.15.dist-info/METADATA,sha256=c9lkB9hRvwrBAGVvaQ-n7EQME-w-qt21ER2lutKgWbg,30580
85
- digitalkin-0.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
- digitalkin-0.2.15.dist-info/top_level.txt,sha256=gcjqlyrZuLjIyxrOIavCQM_olpr6ND5kPKkZd2j0xGo,40
87
- digitalkin-0.2.15.dist-info/RECORD,,
84
+ digitalkin-0.2.16.dist-info/METADATA,sha256=6KBLCX9EMfGWt8ZpkbRDrs9CFD5FtKoAmPa_zwX4fNU,30580
85
+ digitalkin-0.2.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
+ digitalkin-0.2.16.dist-info/top_level.txt,sha256=gcjqlyrZuLjIyxrOIavCQM_olpr6ND5kPKkZd2j0xGo,40
87
+ digitalkin-0.2.16.dist-info/RECORD,,