digitalkin 0.3.2.dev23__py3-none-any.whl → 0.3.2.dev25__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/models/module/tool_reference.py +34 -46
- {digitalkin-0.3.2.dev23.dist-info → digitalkin-0.3.2.dev25.dist-info}/METADATA +2 -2
- {digitalkin-0.3.2.dev23.dist-info → digitalkin-0.3.2.dev25.dist-info}/RECORD +7 -7
- {digitalkin-0.3.2.dev23.dist-info → digitalkin-0.3.2.dev25.dist-info}/WHEEL +1 -1
- {digitalkin-0.3.2.dev23.dist-info → digitalkin-0.3.2.dev25.dist-info}/licenses/LICENSE +0 -0
- {digitalkin-0.3.2.dev23.dist-info → digitalkin-0.3.2.dev25.dist-info}/top_level.txt +0 -0
digitalkin/__version__.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Annotated
|
|
4
4
|
|
|
5
|
-
from pydantic import AfterValidator, BaseModel,
|
|
5
|
+
from pydantic import AfterValidator, BaseModel, Field
|
|
6
6
|
from pydantic.annotated_handlers import GetJsonSchemaHandler
|
|
7
7
|
from pydantic.json_schema import JsonSchemaValue
|
|
8
8
|
from pydantic_core import CoreSchema
|
|
@@ -22,7 +22,8 @@ class ToolReference(BaseModel):
|
|
|
22
22
|
selected_tools: list[SelectedTool] = Field(default=[], description="Tools selected by the user.")
|
|
23
23
|
setup_ids: list[str] = Field(default=[], description="Setup IDs for the user to choose from.")
|
|
24
24
|
module_ids: list[str] = Field(default=[], description="Module IDs for the user to choose from.")
|
|
25
|
-
|
|
25
|
+
tag_ids: list[str] = Field(default=[], description="Tag IDs for the user to choose from.")
|
|
26
|
+
categories: list[str] = Field(default=[], description="Categories for the user to choose from.")
|
|
26
27
|
max_tools: int = Field(default=0, description="Maximum tools to select. 0 for unlimited.")
|
|
27
28
|
min_tools: int = Field(default=0, description="Minimum tools to select. 0 for no minimum.")
|
|
28
29
|
|
|
@@ -57,57 +58,60 @@ class _ToolReferenceInputSchema:
|
|
|
57
58
|
self,
|
|
58
59
|
setup_ids: list[str],
|
|
59
60
|
module_ids: list[str],
|
|
60
|
-
|
|
61
|
+
tag_ids: list[str],
|
|
62
|
+
categories: list[str],
|
|
61
63
|
max_tools: int = 0,
|
|
62
64
|
min_tools: int = 0,
|
|
63
65
|
) -> None:
|
|
64
66
|
self.setup_ids = setup_ids
|
|
65
67
|
self.module_ids = module_ids
|
|
66
|
-
self.
|
|
68
|
+
self.tag_ids = tag_ids
|
|
67
69
|
self.max_tools = max_tools
|
|
68
70
|
self.min_tools = min_tools
|
|
71
|
+
self.categories = categories
|
|
69
72
|
|
|
70
73
|
def __get_pydantic_json_schema__( # noqa: PLW3201
|
|
71
74
|
self,
|
|
72
75
|
schema: CoreSchema,
|
|
73
76
|
handler: GetJsonSchemaHandler,
|
|
74
77
|
) -> JsonSchemaValue:
|
|
75
|
-
"""Generate JSON schema
|
|
78
|
+
"""Generate JSON schema for ToolReference with ui:options.
|
|
76
79
|
|
|
77
80
|
Args:
|
|
78
81
|
schema: The core schema from Pydantic.
|
|
79
82
|
handler: Handler to generate JSON schema from core schema.
|
|
80
83
|
|
|
81
84
|
Returns:
|
|
82
|
-
JSON schema
|
|
85
|
+
JSON schema for ToolReference with ui:options.
|
|
83
86
|
"""
|
|
84
87
|
json_schema = handler(schema)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
array_option["minItems"] = self.min_tools
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
"anyOf": [
|
|
94
|
-
array_option,
|
|
95
|
-
json_schema,
|
|
96
|
-
],
|
|
97
|
-
"ui:options": {
|
|
98
|
-
"setup_ids": self.setup_ids,
|
|
99
|
-
"module_ids": self.module_ids,
|
|
100
|
-
"tags": self.tags,
|
|
101
|
-
"max_tools": self.max_tools,
|
|
102
|
-
"min_tools": self.min_tools,
|
|
103
|
-
},
|
|
88
|
+
ui_options: dict[str, object] = {
|
|
89
|
+
"setupIds": self.setup_ids,
|
|
90
|
+
"moduleIds": self.module_ids,
|
|
91
|
+
"tagIds": self.tag_ids,
|
|
92
|
+
"categories": self.categories,
|
|
104
93
|
}
|
|
94
|
+
if self.max_tools > 0:
|
|
95
|
+
ui_options["maxTools"] = self.max_tools
|
|
96
|
+
if self.min_tools > 0:
|
|
97
|
+
ui_options["minTools"] = self.min_tools
|
|
98
|
+
json_schema["ui:options"] = ui_options
|
|
99
|
+
json_schema["ui:widget"] = "toolSelect"
|
|
100
|
+
if self.max_tools > 0 or self.min_tools > 0:
|
|
101
|
+
resolved = handler.resolve_ref_schema(json_schema)
|
|
102
|
+
selected_tools_schema = resolved["properties"]["selected_tools"]
|
|
103
|
+
if self.max_tools > 0:
|
|
104
|
+
selected_tools_schema["maxItems"] = self.max_tools
|
|
105
|
+
if self.min_tools > 0:
|
|
106
|
+
selected_tools_schema["minItems"] = self.min_tools
|
|
107
|
+
return json_schema
|
|
105
108
|
|
|
106
109
|
|
|
107
110
|
def tool_reference_input(
|
|
108
111
|
setup_ids: list[str] = [],
|
|
109
112
|
module_ids: list[str] = [],
|
|
110
|
-
|
|
113
|
+
tag_ids: list[str] = [],
|
|
114
|
+
categories: list[str] = [],
|
|
111
115
|
max_tools: int = 0,
|
|
112
116
|
min_tools: int = 0,
|
|
113
117
|
) -> type[ToolReference]:
|
|
@@ -116,7 +120,8 @@ def tool_reference_input(
|
|
|
116
120
|
Args:
|
|
117
121
|
setup_ids: Setup IDs for the user to choose from.
|
|
118
122
|
module_ids: Module IDs for the user to choose from.
|
|
119
|
-
|
|
123
|
+
tag_ids: Tag IDs for the user to choose from.
|
|
124
|
+
categories: Categories for the user to choose from.
|
|
120
125
|
max_tools: Maximum tools allowed. 0 for unlimited.
|
|
121
126
|
min_tools: Minimum tools required. 0 for no minimum.
|
|
122
127
|
|
|
@@ -124,23 +129,6 @@ def tool_reference_input(
|
|
|
124
129
|
Annotated type for use in Pydantic models.
|
|
125
130
|
"""
|
|
126
131
|
|
|
127
|
-
def convert_to_tool_reference(v: object) -> ToolReference | object:
|
|
128
|
-
"""Convert list of setup IDs to ToolReference with config preserved.
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
ToolReference if input is list, otherwise original value.
|
|
132
|
-
"""
|
|
133
|
-
if isinstance(v, list):
|
|
134
|
-
return ToolReference(
|
|
135
|
-
selected_tools=[SelectedTool(setup_id=sid, slug=sid) for sid in v],
|
|
136
|
-
setup_ids=setup_ids,
|
|
137
|
-
module_ids=module_ids,
|
|
138
|
-
tags=tags,
|
|
139
|
-
max_tools=max_tools,
|
|
140
|
-
min_tools=min_tools,
|
|
141
|
-
)
|
|
142
|
-
return v
|
|
143
|
-
|
|
144
132
|
def validate_tools_count(v: ToolReference) -> ToolReference:
|
|
145
133
|
"""Validate selected_tools count against min/max constraints.
|
|
146
134
|
|
|
@@ -161,12 +149,12 @@ def tool_reference_input(
|
|
|
161
149
|
|
|
162
150
|
return Annotated[ # type: ignore[return-value]
|
|
163
151
|
ToolReference,
|
|
164
|
-
BeforeValidator(convert_to_tool_reference),
|
|
165
152
|
AfterValidator(validate_tools_count),
|
|
166
153
|
_ToolReferenceInputSchema(
|
|
167
154
|
setup_ids=setup_ids,
|
|
168
155
|
module_ids=module_ids,
|
|
169
|
-
|
|
156
|
+
tag_ids=tag_ids,
|
|
157
|
+
categories=categories,
|
|
170
158
|
max_tools=max_tools,
|
|
171
159
|
min_tools=min_tools,
|
|
172
160
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: digitalkin
|
|
3
|
-
Version: 0.3.2.
|
|
3
|
+
Version: 0.3.2.dev25
|
|
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
|
|
@@ -434,8 +434,8 @@ License: Attribution-NonCommercial-ShareAlike 4.0 International
|
|
|
434
434
|
Creative Commons may be contacted at creativecommons.org.
|
|
435
435
|
https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
436
436
|
|
|
437
|
-
Project-URL: Homepage, https://github.com/DigitalKin-ai/digitalkin
|
|
438
437
|
Project-URL: Documentation, https://github.com/DigitalKin-ai/digitalkin
|
|
438
|
+
Project-URL: Homepage, https://github.com/DigitalKin-ai/digitalkin
|
|
439
439
|
Project-URL: Issues, https://github.com/DigitalKin-ai/digitalkin/issues
|
|
440
440
|
Keywords: agent,digitalkin,gprc,kin,sdk
|
|
441
441
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -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=wLv3PwvKkCiyENoAcO49sz7loFxjdKXH6j76y0dSfiM,196
|
|
11
11
|
digitalkin/logger.py,sha256=8ze_tjt2G6mDTuQcsf7-UTXWP3UHZ7LZVSs_iqF4rX4,4685
|
|
12
12
|
digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
digitalkin/core/__init__.py,sha256=FJRcJ-B1Viyn-38L8XpOpZ8KOnf1I7PCDOAmKXLQhqc,71
|
|
@@ -57,7 +57,7 @@ digitalkin/models/module/module_context.py,sha256=kwaAobsA82Du6L0XH9Is9u6Qj1rEjh
|
|
|
57
57
|
digitalkin/models/module/module_types.py,sha256=C9azCNBk76xMa-Mww8_6AiwQR8MLAsEyUOvBYxytovI,739
|
|
58
58
|
digitalkin/models/module/setup_types.py,sha256=8xEI6DvCYBHSOsuoeuZjtBL5rPsR_7DwWFxQnn2bo3c,19249
|
|
59
59
|
digitalkin/models/module/tool_cache.py,sha256=xAMSyY73aduYGPz6C54g0YMAa2OnXPN6QRS-W4TK_js,6568
|
|
60
|
-
digitalkin/models/module/tool_reference.py,sha256=
|
|
60
|
+
digitalkin/models/module/tool_reference.py,sha256=L2wh6-Am7pQTUSVFL9gQtTIagscAWnBcc1zcDGgt0Co,5968
|
|
61
61
|
digitalkin/models/module/utility.py,sha256=gnbYfWpXGbomUI0fWf7T-Qm_VvT-LXDv1OuA9zObwVg,5589
|
|
62
62
|
digitalkin/models/services/__init__.py,sha256=jhfVw6egq0OcHmos_fypH9XFehbHTBw09wluVFVFEyw,226
|
|
63
63
|
digitalkin/models/services/cost.py,sha256=9PXvd5RrIk9vCrRjcUGQ9ZyAokEbwLg4s0RfnE-aLP4,1616
|
|
@@ -123,7 +123,7 @@ digitalkin/utils/dynamic_schema.py,sha256=y5csxjuqVHjWDpnTUzxbcUuI_wou9-ibRVHQlB
|
|
|
123
123
|
digitalkin/utils/llm_ready_schema.py,sha256=JjMug_lrQllqFoanaC091VgOqwAd-_YzcpqFlS7p778,2375
|
|
124
124
|
digitalkin/utils/package_discover.py,sha256=sa6Zp5Kape1Zr4iYiNrnZxiHDnqM06ODk6yfWHom53w,13465
|
|
125
125
|
digitalkin/utils/schema_splitter.py,sha256=f1RGzs0wSRPn8oydO9Ojo8mYTF4TFDkRFeGUt5jbPt4,11132
|
|
126
|
-
digitalkin-0.3.2.
|
|
126
|
+
digitalkin-0.3.2.dev25.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
|
|
127
127
|
modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
128
|
modules/archetype_with_tools_module.py,sha256=kJkVhAFWG0aDDqzupOXOnV3l8j3z5bEdWos_6Z9rUP8,7303
|
|
129
129
|
modules/cpu_intensive_module.py,sha256=GZlirQDZdYuXrI46sv1q4RNAHZjL4EptHVQTvgK9zz8,8363
|
|
@@ -138,7 +138,7 @@ monitoring/digitalkin_observability/prometheus.py,sha256=gDmM9ySaVwPAe7Yg84pLxmE
|
|
|
138
138
|
monitoring/tests/test_metrics.py,sha256=ugnYfAwqBPO6zA8z4afKTlyBWECTivacYSN-URQCn2E,5856
|
|
139
139
|
services/filesystem_module.py,sha256=U4dgqtuDadaXz8PJ1d_uQ_1EPncBqudAQCLUICF9yL4,7421
|
|
140
140
|
services/storage_module.py,sha256=Wz2MzLvqs2D_bnBBgtnujYcAKK2V2KFMk8K21RoepSE,6972
|
|
141
|
-
digitalkin-0.3.2.
|
|
142
|
-
digitalkin-0.3.2.
|
|
143
|
-
digitalkin-0.3.2.
|
|
144
|
-
digitalkin-0.3.2.
|
|
141
|
+
digitalkin-0.3.2.dev25.dist-info/METADATA,sha256=FeGGqntwyyBCHErF6Zov6ymQi5T9TSj48EN3BNAxFCk,29725
|
|
142
|
+
digitalkin-0.3.2.dev25.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
143
|
+
digitalkin-0.3.2.dev25.dist-info/top_level.txt,sha256=AYVIesKrO0jnedQ-Muog9JBehG81WeTCNeOFoJgwsgE,51
|
|
144
|
+
digitalkin-0.3.2.dev25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|