unique_toolkit 1.1.5__py3-none-any.whl → 1.1.7__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.
- unique_toolkit/agentic/tools/config.py +45 -8
- unique_toolkit/agentic/tools/tool_manager.py +1 -4
- unique_toolkit/chat/service.py +785 -4
- unique_toolkit/content/service.py +137 -1
- unique_toolkit/embedding/service.py +36 -0
- unique_toolkit/language_model/service.py +125 -0
- unique_toolkit/short_term_memory/service.py +36 -0
- {unique_toolkit-1.1.5.dist-info → unique_toolkit-1.1.7.dist-info}/METADATA +9 -2
- {unique_toolkit-1.1.5.dist-info → unique_toolkit-1.1.7.dist-info}/RECORD +11 -11
- {unique_toolkit-1.1.5.dist-info → unique_toolkit-1.1.7.dist-info}/LICENSE +0 -0
- {unique_toolkit-1.1.5.dist-info → unique_toolkit-1.1.7.dist-info}/WHEEL +0 -0
@@ -1,5 +1,6 @@
|
|
1
|
+
import json
|
1
2
|
from enum import StrEnum
|
2
|
-
from typing import Any
|
3
|
+
from typing import Any, Dict
|
3
4
|
|
4
5
|
from pydantic import (
|
5
6
|
BaseModel,
|
@@ -98,10 +99,46 @@ class ToolBuildConfig(BaseModel):
|
|
98
99
|
value["configuration"] = config
|
99
100
|
return value
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
102
|
+
def model_dump(self) -> Dict[str, Any]:
|
103
|
+
"""
|
104
|
+
Returns a dict representation of the tool config that preserves
|
105
|
+
subclass fields from `configuration` by delegating to its own
|
106
|
+
model_dump. This prevents `{}` when `configuration` is typed
|
107
|
+
as `BaseToolConfig` but holds a subclass instance.
|
108
|
+
"""
|
109
|
+
data: Dict[str, Any] = {
|
110
|
+
"name": self.name,
|
111
|
+
"configuration": self.configuration.model_dump()
|
112
|
+
if self.configuration
|
113
|
+
else None,
|
114
|
+
"display_name": self.display_name,
|
115
|
+
"icon": self.icon,
|
116
|
+
"selection_policy": self.selection_policy,
|
117
|
+
"is_exclusive": self.is_exclusive,
|
118
|
+
"is_sub_agent": self.is_sub_agent,
|
119
|
+
"is_enabled": self.is_enabled,
|
120
|
+
}
|
121
|
+
return data
|
122
|
+
|
123
|
+
def model_dump_json(self) -> str:
|
124
|
+
"""
|
125
|
+
Returns a JSON string representation of the tool config.
|
126
|
+
Ensures `configuration` is fully serialized by using the
|
127
|
+
subclass's `model_dump_json()` when available.
|
128
|
+
"""
|
129
|
+
config_json = (
|
130
|
+
self.configuration.model_dump_json() if self.configuration else None
|
131
|
+
)
|
132
|
+
config = json.loads(config_json) if config_json else None
|
133
|
+
|
134
|
+
data: Dict[str, Any] = {
|
135
|
+
"name": self.name,
|
136
|
+
"configuration": config,
|
137
|
+
"display_name": self.display_name,
|
138
|
+
"icon": self.icon,
|
139
|
+
"selection_policy": self.selection_policy,
|
140
|
+
"is_exclusive": self.is_exclusive,
|
141
|
+
"is_sub_agent": self.is_sub_agent,
|
142
|
+
"is_enabled": self.is_enabled,
|
143
|
+
}
|
144
|
+
return json.dumps(data)
|
@@ -6,7 +6,7 @@ from pydantic import BaseModel, Field
|
|
6
6
|
|
7
7
|
from unique_toolkit.agentic.evaluation.schemas import EvaluationMetricName
|
8
8
|
from unique_toolkit.agentic.tools.a2a.manager import A2AManager
|
9
|
-
from unique_toolkit.agentic.tools.config import ToolBuildConfig
|
9
|
+
from unique_toolkit.agentic.tools.config import ToolBuildConfig
|
10
10
|
from unique_toolkit.agentic.tools.factory import ToolFactory
|
11
11
|
from unique_toolkit.agentic.tools.mcp.manager import MCPManager
|
12
12
|
from unique_toolkit.agentic.tools.schemas import ToolCallResponse, ToolPrompts
|
@@ -23,9 +23,6 @@ from unique_toolkit.language_model.schemas import (
|
|
23
23
|
LanguageModelToolDescription,
|
24
24
|
)
|
25
25
|
|
26
|
-
# Rebuild the config model now that all imports are resolved
|
27
|
-
_rebuild_config_model()
|
28
|
-
|
29
26
|
|
30
27
|
class ForcedToolOption:
|
31
28
|
type: str = "function"
|