digitalkin 0.2.5__py3-none-any.whl → 0.2.6__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 +1 -1
- digitalkin/services/filesystem/grpc_filesystem.py +4 -4
- digitalkin/services/storage/grpc_storage.py +38 -5
- {digitalkin-0.2.5.dist-info → digitalkin-0.2.6.dist-info}/METADATA +1 -1
- {digitalkin-0.2.5.dist-info → digitalkin-0.2.6.dist-info}/RECORD +10 -10
- {digitalkin-0.2.5.dist-info → digitalkin-0.2.6.dist-info}/WHEEL +1 -1
- modules/minimal_llm_module.py +4 -5
- modules/text_transform_module.py +8 -5
- {digitalkin-0.2.5.dist-info → digitalkin-0.2.6.dist-info}/licenses/LICENSE +0 -0
- {digitalkin-0.2.5.dist-info → digitalkin-0.2.6.dist-info}/top_level.txt +0 -0
digitalkin/__version__.py
CHANGED
|
@@ -10,7 +10,7 @@ from digitalkin_proto.digitalkin.filesystem.v2.filesystem_pb2 import FileType as
|
|
|
10
10
|
|
|
11
11
|
from digitalkin.grpc_servers.utils.exceptions import ServerError
|
|
12
12
|
from digitalkin.grpc_servers.utils.grpc_client_wrapper import GrpcClientWrapper
|
|
13
|
-
from digitalkin.grpc_servers.utils.models import
|
|
13
|
+
from digitalkin.grpc_servers.utils.models import ClientConfig
|
|
14
14
|
from digitalkin.services.filesystem.filesystem_strategy import (
|
|
15
15
|
FilesystemData,
|
|
16
16
|
FilesystemServiceError,
|
|
@@ -28,7 +28,7 @@ class GrpcFilesystem(FilesystemStrategy, GrpcClientWrapper):
|
|
|
28
28
|
self,
|
|
29
29
|
mission_id: str,
|
|
30
30
|
config: dict[str, str],
|
|
31
|
-
|
|
31
|
+
client_config: ClientConfig,
|
|
32
32
|
**kwargs, # noqa: ANN003, ARG002
|
|
33
33
|
) -> None:
|
|
34
34
|
"""Initialize the default filesystem strategy.
|
|
@@ -36,11 +36,11 @@ class GrpcFilesystem(FilesystemStrategy, GrpcClientWrapper):
|
|
|
36
36
|
Args:
|
|
37
37
|
mission_id: The ID of the mission this strategy is associated with
|
|
38
38
|
config: A dictionary mapping names to Pydantic model classes
|
|
39
|
-
|
|
39
|
+
client_config: The client configuration object
|
|
40
40
|
kwargs: other optional arguments to pass to the parent class constructor
|
|
41
41
|
"""
|
|
42
42
|
super().__init__(mission_id, config)
|
|
43
|
-
channel = self._init_channel(
|
|
43
|
+
channel = self._init_channel(client_config)
|
|
44
44
|
self.stub = filesystem_service_pb2_grpc.FilesystemServiceStub(channel)
|
|
45
45
|
logger.info("Channel client 'Filesystem' initialized succesfully")
|
|
46
46
|
|
|
@@ -8,8 +8,8 @@ from google.protobuf.struct_pb2 import Struct
|
|
|
8
8
|
from pydantic import BaseModel
|
|
9
9
|
|
|
10
10
|
from digitalkin.grpc_servers.utils.grpc_client_wrapper import GrpcClientWrapper
|
|
11
|
-
from digitalkin.grpc_servers.utils.models import
|
|
12
|
-
from digitalkin.services.storage.storage_strategy import StorageRecord, StorageServiceError, StorageStrategy
|
|
11
|
+
from digitalkin.grpc_servers.utils.models import ClientConfig
|
|
12
|
+
from digitalkin.services.storage.storage_strategy import DataType, StorageRecord, StorageServiceError, StorageStrategy
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
@@ -21,13 +21,13 @@ class GrpcStorage(StorageStrategy, GrpcClientWrapper):
|
|
|
21
21
|
self,
|
|
22
22
|
mission_id: str,
|
|
23
23
|
config: dict[str, type[BaseModel]],
|
|
24
|
-
|
|
24
|
+
client_config: ClientConfig,
|
|
25
25
|
**kwargs, # noqa: ANN003, ARG002
|
|
26
26
|
) -> None:
|
|
27
27
|
"""Initialize the storage."""
|
|
28
28
|
super().__init__(mission_id=mission_id, config=config)
|
|
29
29
|
|
|
30
|
-
channel = self._init_channel(
|
|
30
|
+
channel = self._init_channel(client_config)
|
|
31
31
|
self.stub = storage_service_pb2_grpc.StorageServiceStub(channel)
|
|
32
32
|
logger.info("Channel client 'storage' initialized succesfully")
|
|
33
33
|
|
|
@@ -98,7 +98,7 @@ class GrpcStorage(StorageStrategy, GrpcClientWrapper):
|
|
|
98
98
|
|
|
99
99
|
request = data_pb2.ModifyRecordRequest(data=data_struct, mission_id=self.mission_id, name=name)
|
|
100
100
|
response: data_pb2.ModifyRecordResponse = self.exec_grpc_query("ModifyRecord", request)
|
|
101
|
-
return
|
|
101
|
+
return self._build_record_from_proto(response.stored_data, name)
|
|
102
102
|
except Exception:
|
|
103
103
|
msg = f"Error while modifing record {name}"
|
|
104
104
|
logger.exception(msg)
|
|
@@ -121,3 +121,36 @@ class GrpcStorage(StorageStrategy, GrpcClientWrapper):
|
|
|
121
121
|
logger.exception(msg)
|
|
122
122
|
return False
|
|
123
123
|
return True
|
|
124
|
+
|
|
125
|
+
def _build_record_from_proto(self, stored_data: data_pb2.StorageRecord, default_name: str) -> StorageRecord:
|
|
126
|
+
"""Helper to construire un StorageRecord complet à partir du message gRPC.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
stored_data: Le message gRPC contenant les données stockées.
|
|
130
|
+
default_name: Le nom par défaut à utiliser si le nom n'est pas présent dans les données.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
StorageRecord: Un objet StorageRecord construit à partir des données stockées.
|
|
134
|
+
"""
|
|
135
|
+
# Converti en dict, avec tous les champs même s'ils sont absents
|
|
136
|
+
raw = json_format.MessageToDict(
|
|
137
|
+
stored_data,
|
|
138
|
+
preserving_proto_field_name=True,
|
|
139
|
+
always_print_fields_with_no_presence=True,
|
|
140
|
+
)
|
|
141
|
+
# On récupère ou on complète les champs obligatoires
|
|
142
|
+
name = raw.get("name", default_name)
|
|
143
|
+
dtype = raw.get("data_type", DataType.OUTPUT.name)
|
|
144
|
+
payload = raw.get("data", {})
|
|
145
|
+
|
|
146
|
+
# Valide le modèle pydantic pour le champ `data`
|
|
147
|
+
validated = self._validate_data(name, payload)
|
|
148
|
+
|
|
149
|
+
return StorageRecord(
|
|
150
|
+
mission_id=self.mission_id,
|
|
151
|
+
name=name,
|
|
152
|
+
data_type=DataType[dtype],
|
|
153
|
+
data=validated,
|
|
154
|
+
creation_date=raw.get("creation_date"),
|
|
155
|
+
update_date=raw.get("update_date"),
|
|
156
|
+
)
|
|
@@ -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=
|
|
10
|
+
digitalkin/__version__.py,sha256=oM4jNCAYWlE0yUk_rpWiJCYE3Pyq4cZrXpraEmj9p-E,190
|
|
11
11
|
digitalkin/logger.py,sha256=9cDgyJV2QXXT8F--xRODFlZyDgjuTTXNdpCU3GdqCsk,382
|
|
12
12
|
digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
digitalkin/grpc_servers/__init__.py,sha256=0cJBlwipSmFdXkyH3T0i6OJ1WpAtNsZgYX7JaSnkbtg,804
|
|
@@ -48,7 +48,7 @@ digitalkin/services/cost/grpc_cost.py,sha256=k0Df_41dwrowBjtz11eqYQyWCMIjY-wEPEy
|
|
|
48
48
|
digitalkin/services/filesystem/__init__.py,sha256=BhwMl_BUvM0d65fmglkp0SVwn3RfYiUOKJgIMnOCaGM,381
|
|
49
49
|
digitalkin/services/filesystem/default_filesystem.py,sha256=tTOsBt0MSjexKgWm657y8BLppMYJtmJIVdqzsSRRaYk,7264
|
|
50
50
|
digitalkin/services/filesystem/filesystem_strategy.py,sha256=VH93jkijFtyVA6XaH_rsfdSyeEpkqea54NAvHFLJDjM,2216
|
|
51
|
-
digitalkin/services/filesystem/grpc_filesystem.py,sha256=
|
|
51
|
+
digitalkin/services/filesystem/grpc_filesystem.py,sha256=KifdA_1evYA19rib5ZR5WMIrm9_jzr3PF5Sq3s2uI3Q,8180
|
|
52
52
|
digitalkin/services/identity/__init__.py,sha256=InkeyLgFYYwItx8mePA8HpfacOMWZwwuc0G4pWtKq9s,270
|
|
53
53
|
digitalkin/services/identity/default_identity.py,sha256=Y2auZHrGSZTIN5D8HyjLvLcNbYFM1CNUE23x7p5VIGw,386
|
|
54
54
|
digitalkin/services/identity/identity_strategy.py,sha256=skappBbds1_qa0Gr24FGrNX1N0_OYhYT1Lh7dUaAirE,429
|
|
@@ -63,16 +63,16 @@ digitalkin/services/snapshot/default_snapshot.py,sha256=Mb8QwWRsHh9I_tN0ln_ZiFa1
|
|
|
63
63
|
digitalkin/services/snapshot/snapshot_strategy.py,sha256=B1TU3V_k9A-OdqBkdyc41-ihnrW5Btcwd1KyQdHT46A,898
|
|
64
64
|
digitalkin/services/storage/__init__.py,sha256=T-ocYLLphudkQgzvG47jBOm5GQsRFRIGA88y7Ur4akg,341
|
|
65
65
|
digitalkin/services/storage/default_storage.py,sha256=bHNPm8nLvytKqKP2ntLkikvqH1qDKOwofrStVJH6PJg,7765
|
|
66
|
-
digitalkin/services/storage/grpc_storage.py,sha256=
|
|
66
|
+
digitalkin/services/storage/grpc_storage.py,sha256=eSadiI3JuveItx8LdiC3GbjbjnB8GmPqTVxw1uA1-9E,5809
|
|
67
67
|
digitalkin/services/storage/storage_strategy.py,sha256=vGo4aYkEp_GZV11m7vd-xY_Z3gVa5K0gMTzbj2Au_3o,6600
|
|
68
68
|
digitalkin/utils/__init__.py,sha256=sJnY-ZUgsjMfojAjONC1VN14mhgIDnzyOlGkw21rRnM,28
|
|
69
69
|
digitalkin/utils/arg_parser.py,sha256=3YyI6oZhhrlTmPTrzlwpQzbCNWDFAT3pggcLxNtJoc0,4388
|
|
70
|
-
digitalkin-0.2.
|
|
70
|
+
digitalkin-0.2.6.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
|
|
71
71
|
modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
|
-
modules/minimal_llm_module.py,sha256=
|
|
72
|
+
modules/minimal_llm_module.py,sha256=W-E3OrRbAsRJ6hvSeTU8pzmacdJC_PbcWfDapRv5A1A,5617
|
|
73
73
|
modules/storage_module.py,sha256=bu52lW4RFcWB8VFDhrpBFfCaTSkVL6so3zrkfW4LO9E,6270
|
|
74
|
-
modules/text_transform_module.py,sha256=
|
|
75
|
-
digitalkin-0.2.
|
|
76
|
-
digitalkin-0.2.
|
|
77
|
-
digitalkin-0.2.
|
|
78
|
-
digitalkin-0.2.
|
|
74
|
+
modules/text_transform_module.py,sha256=1KaA7abwxltKKtbmiW1rkkIK3BTYFPegUq54px0LOQs,7277
|
|
75
|
+
digitalkin-0.2.6.dist-info/METADATA,sha256=MSrxM2ATU0easkm4lkbVJdPbUzoH0xDgbmQ622ACwfM,29125
|
|
76
|
+
digitalkin-0.2.6.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
77
|
+
digitalkin-0.2.6.dist-info/top_level.txt,sha256=5_5e35inSM5YfWNZE21p5wGBojiVtQQML_WzbEk4BRU,31
|
|
78
|
+
digitalkin-0.2.6.dist-info/RECORD,,
|
modules/minimal_llm_module.py
CHANGED
|
@@ -8,7 +8,7 @@ import grpc
|
|
|
8
8
|
import openai
|
|
9
9
|
from pydantic import BaseModel
|
|
10
10
|
|
|
11
|
-
from digitalkin.grpc_servers.utils.models import SecurityMode,
|
|
11
|
+
from digitalkin.grpc_servers.utils.models import SecurityMode, ClientConfig, ServerMode
|
|
12
12
|
from digitalkin.modules._base_module import BaseModule
|
|
13
13
|
from digitalkin.services.setup.setup_strategy import SetupData
|
|
14
14
|
|
|
@@ -45,12 +45,11 @@ class OpenAIToolSecret(BaseModel):
|
|
|
45
45
|
"""Secret model defining module configuration parameters."""
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
client_config = ClientConfig(
|
|
49
49
|
host="[::]",
|
|
50
50
|
port=50151,
|
|
51
51
|
mode=ServerMode.ASYNC,
|
|
52
52
|
security=SecurityMode.INSECURE,
|
|
53
|
-
max_workers=10,
|
|
54
53
|
credentials=None,
|
|
55
54
|
)
|
|
56
55
|
|
|
@@ -81,11 +80,11 @@ class OpenAIToolModule(BaseModule[OpenAIToolInput, OpenAIToolOutput, OpenAIToolS
|
|
|
81
80
|
services_config_params = {
|
|
82
81
|
"storage": {
|
|
83
82
|
"config": {"setups": OpenAIToolSetup},
|
|
84
|
-
"
|
|
83
|
+
"client_config": client_config,
|
|
85
84
|
},
|
|
86
85
|
"filesystem": {
|
|
87
86
|
"config": {},
|
|
88
|
-
"
|
|
87
|
+
"client_config": client_config,
|
|
89
88
|
},
|
|
90
89
|
}
|
|
91
90
|
|
modules/text_transform_module.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Any, ClassVar
|
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
|
|
9
|
-
from digitalkin.grpc_servers.utils.models import SecurityMode,
|
|
9
|
+
from digitalkin.grpc_servers.utils.models import SecurityMode, ClientConfig, ServerMode
|
|
10
10
|
from digitalkin.modules._base_module import BaseModule
|
|
11
11
|
from digitalkin.services.setup.setup_strategy import SetupData
|
|
12
12
|
from digitalkin.services.storage.storage_strategy import DataType, StorageRecord
|
|
@@ -54,12 +54,11 @@ class TextTransformStorage(BaseModel):
|
|
|
54
54
|
ended: bool = False
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
client_config = ClientConfig(
|
|
58
58
|
host="[::]",
|
|
59
59
|
port=50151,
|
|
60
60
|
mode=ServerMode.ASYNC,
|
|
61
61
|
security=SecurityMode.INSECURE,
|
|
62
|
-
max_workers=10,
|
|
63
62
|
credentials=None,
|
|
64
63
|
)
|
|
65
64
|
|
|
@@ -91,8 +90,12 @@ class TextTransformModule(BaseModule[TextTransformInput, TextTransformOutput, Te
|
|
|
91
90
|
services_config_params = {
|
|
92
91
|
"storage": {
|
|
93
92
|
"config": {"monitor": TextTransformStorage, "setups": TextTransformStorage},
|
|
94
|
-
"
|
|
95
|
-
}
|
|
93
|
+
"client_config": client_config,
|
|
94
|
+
},
|
|
95
|
+
"filesystem": {
|
|
96
|
+
"config": {},
|
|
97
|
+
"client_config": client_config,
|
|
98
|
+
},
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
async def initialize(self, setup_data: SetupData) -> None:
|
|
File without changes
|
|
File without changes
|