unique_toolkit 0.8.55__py3-none-any.whl → 0.8.57__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/_common/utils/write_configuration.py +51 -0
- unique_toolkit/history_manager/history_manager.py +2 -2
- unique_toolkit/history_manager/utils.py +3 -3
- {unique_toolkit-0.8.55.dist-info → unique_toolkit-0.8.57.dist-info}/METADATA +7 -1
- {unique_toolkit-0.8.55.dist-info → unique_toolkit-0.8.57.dist-info}/RECORD +7 -6
- {unique_toolkit-0.8.55.dist-info → unique_toolkit-0.8.57.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.8.55.dist-info → unique_toolkit-0.8.57.dist-info}/WHEEL +0 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
import json
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
from humps import kebabize, pascalize
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
|
8
|
+
def write_module_configuration_schema(
|
9
|
+
service_folderpath: Path,
|
10
|
+
write_folderpath: Path,
|
11
|
+
config: BaseModel,
|
12
|
+
sub_name: str = "",
|
13
|
+
):
|
14
|
+
filename_prefix = pascalize(service_folderpath.name)
|
15
|
+
|
16
|
+
filepath = (
|
17
|
+
write_folderpath
|
18
|
+
/ f"{filename_prefix}{f'-{sub_name}' if sub_name else ''}Schema.json"
|
19
|
+
)
|
20
|
+
|
21
|
+
with open(filepath, "w") as f:
|
22
|
+
json.dump(config.model_json_schema(by_alias=True), f, indent=4)
|
23
|
+
|
24
|
+
|
25
|
+
def write_service_configuration(
|
26
|
+
service_folderpath: Path,
|
27
|
+
write_folderpath: Path,
|
28
|
+
config: BaseModel,
|
29
|
+
sub_name: str = "",
|
30
|
+
):
|
31
|
+
filename_prefix = kebabize(service_folderpath.name)
|
32
|
+
|
33
|
+
filepath = (
|
34
|
+
write_folderpath
|
35
|
+
/ f"{filename_prefix}{f'-{sub_name}' if sub_name else ''}-configuration-schema.json"
|
36
|
+
)
|
37
|
+
|
38
|
+
with open(filepath, "w") as f:
|
39
|
+
json.dump(config.model_json_schema(by_alias=True), f, indent=4)
|
40
|
+
filepath = (
|
41
|
+
write_folderpath
|
42
|
+
/ f"{filename_prefix}{f'-{sub_name}' if sub_name else ''}-default-configuration.json"
|
43
|
+
)
|
44
|
+
|
45
|
+
# We exclude language_model_info as it is infered from language_model_name
|
46
|
+
with open(filepath, "w") as f:
|
47
|
+
f.write(
|
48
|
+
config.model_dump_json(
|
49
|
+
by_alias=True, indent=4, exclude=set(["language_model_info"])
|
50
|
+
)
|
51
|
+
)
|
@@ -170,7 +170,7 @@ class HistoryManager:
|
|
170
170
|
) # it can be that the tool response does not have content chunks
|
171
171
|
|
172
172
|
# Transform content chunks into sources to be appended to tool result
|
173
|
-
sources = transform_chunks_to_string(
|
173
|
+
stringified_sources, sources = transform_chunks_to_string(
|
174
174
|
content_chunks,
|
175
175
|
self._source_enumerator,
|
176
176
|
None, # Use None for SourceFormatConfig
|
@@ -183,7 +183,7 @@ class HistoryManager:
|
|
183
183
|
|
184
184
|
# Append the result to the history
|
185
185
|
return LanguageModelToolMessage(
|
186
|
-
content=
|
186
|
+
content=stringified_sources,
|
187
187
|
tool_call_id=tool_response.id, # type: ignore
|
188
188
|
name=tool_response.name,
|
189
189
|
)
|
@@ -64,7 +64,7 @@ def transform_chunks_to_string(
|
|
64
64
|
max_source_number: int,
|
65
65
|
cfg: SourceFormatConfig | None,
|
66
66
|
full_sources_serialize_dump: bool = False,
|
67
|
-
) -> str:
|
67
|
+
) -> tuple[str, list[Source]]:
|
68
68
|
"""Transform content chunks into a string of sources.
|
69
69
|
|
70
70
|
Args:
|
@@ -76,7 +76,7 @@ def transform_chunks_to_string(
|
|
76
76
|
str: String for the tool call response
|
77
77
|
"""
|
78
78
|
if not content_chunks:
|
79
|
-
return "No relevant sources found."
|
79
|
+
return "No relevant sources found.", []
|
80
80
|
if full_sources_serialize_dump:
|
81
81
|
sources = [
|
82
82
|
Source(
|
@@ -114,7 +114,7 @@ def transform_chunks_to_string(
|
|
114
114
|
}
|
115
115
|
for i, chunk in enumerate(content_chunks)
|
116
116
|
]
|
117
|
-
return json.dumps(sources)
|
117
|
+
return json.dumps(sources), sources
|
118
118
|
|
119
119
|
|
120
120
|
def load_sources_from_string(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unique_toolkit
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.57
|
4
4
|
Summary:
|
5
5
|
License: Proprietary
|
6
6
|
Author: Cedric Klinkert
|
@@ -119,6 +119,12 @@ All notable changes to this project will be documented in this file.
|
|
119
119
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
120
120
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
121
121
|
|
122
|
+
## [0.8.57] - 2025-09-14
|
123
|
+
- Added more utils to commons
|
124
|
+
|
125
|
+
## [0.8.56] - 2025-09-12
|
126
|
+
- Fixed token counter in utils
|
127
|
+
|
122
128
|
## [0.8.55] - 2025-09-10
|
123
129
|
- Update documentation with agentic managers
|
124
130
|
|
@@ -16,6 +16,7 @@ unique_toolkit/_common/pydantic_helpers.py,sha256=4a8LPey31k4dCztYag1OBhYnGHREN0
|
|
16
16
|
unique_toolkit/_common/token/image_token_counting.py,sha256=VpFfZyY0GIH27q_Wy4YNjk2algqvbCtJyzuuROoFQPw,2189
|
17
17
|
unique_toolkit/_common/token/token_counting.py,sha256=gM4B_aUqKqEPvmStFNcvCWNMNNNNKbVaywBDxlbgIps,7121
|
18
18
|
unique_toolkit/_common/utils/structured_output/schema.py,sha256=Tp7kDYcmKtnUhcuRkH86TSYhylRff0ZZJYb2dLkISts,131
|
19
|
+
unique_toolkit/_common/utils/write_configuration.py,sha256=fzvr4C-XBL3OSM3Od9TbqIxeeDS9_d9CLEyTq6DDknY,1409
|
19
20
|
unique_toolkit/_common/validate_required_values.py,sha256=Y_M1ub9gIKP9qZ45F6Zq3ZHtuIqhmOjl8Z2Vd3avg8w,588
|
20
21
|
unique_toolkit/_common/validators.py,sha256=aZwbMho7XszN7lT5RtemaiXgC0WJ4u40oeVgsNGhF4U,2803
|
21
22
|
unique_toolkit/app/__init__.py,sha256=ETxYDpEizg_PKmi4JPX_P76ySq-us-xypfAIdKQ1QZU,1284
|
@@ -70,9 +71,9 @@ unique_toolkit/framework_utilities/openai/client.py,sha256=ct1cqPcIK1wPl11G9sJV3
|
|
70
71
|
unique_toolkit/framework_utilities/openai/message_builder.py,sha256=VU6mJm_upLcarJQKFft_t1RlLRncWDxDuLC5LIJ5lQQ,4339
|
71
72
|
unique_toolkit/framework_utilities/utils.py,sha256=JK7g2yMfEx3eMprug26769xqNpS5WJcizf8n2zWMBng,789
|
72
73
|
unique_toolkit/history_manager/history_construction_with_contents.py,sha256=c8Zy3erSbHGT8AdICRRlSK91T_FN6tNpTznvUzpLbWk,9023
|
73
|
-
unique_toolkit/history_manager/history_manager.py,sha256=
|
74
|
+
unique_toolkit/history_manager/history_manager.py,sha256=GVz6G_Ys_3_v7N4Ts4jNh7H1fYI8lKOlkyJfuBdhX04,8383
|
74
75
|
unique_toolkit/history_manager/loop_token_reducer.py,sha256=PJlC2PQnKPMkyazN_wBsCjO3Bl0I-HJoJ_YRUCeolv0,18458
|
75
|
-
unique_toolkit/history_manager/utils.py,sha256=
|
76
|
+
unique_toolkit/history_manager/utils.py,sha256=pzIt8npHA3vhOe-wIBiiMPaKk6hQSjMRhkK0pkxwF1k,5640
|
76
77
|
unique_toolkit/language_model/__init__.py,sha256=lRQyLlbwHbNFf4-0foBU13UGb09lwEeodbVsfsSgaCk,1971
|
77
78
|
unique_toolkit/language_model/builder.py,sha256=4OKfwJfj3TrgO1ezc_ewIue6W7BCQ2ZYQXUckWVPPTA,3369
|
78
79
|
unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qzIHUCBS7YJ0-1U,119
|
@@ -122,7 +123,7 @@ unique_toolkit/tools/utils/source_handling/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
122
123
|
unique_toolkit/tools/utils/source_handling/schema.py,sha256=vzAyf6ZWNexjMO0OrnB8y2glGkvAilmGGQXd6zcDaKw,870
|
123
124
|
unique_toolkit/tools/utils/source_handling/source_formatting.py,sha256=C7uayNbdkNVJdEARA5CENnHtNY1SU6etlaqbgHNyxaQ,9152
|
124
125
|
unique_toolkit/tools/utils/source_handling/tests/test_source_formatting.py,sha256=oM5ZxEgzROrnX1229KViCAFjRxl9wCTzWZoinYSHleM,6979
|
125
|
-
unique_toolkit-0.8.
|
126
|
-
unique_toolkit-0.8.
|
127
|
-
unique_toolkit-0.8.
|
128
|
-
unique_toolkit-0.8.
|
126
|
+
unique_toolkit-0.8.57.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
127
|
+
unique_toolkit-0.8.57.dist-info/METADATA,sha256=1_R9STXImn9ikILyet9NHbiZACcY1V_RDn4HDHVMBJw,31933
|
128
|
+
unique_toolkit-0.8.57.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
129
|
+
unique_toolkit-0.8.57.dist-info/RECORD,,
|
File without changes
|
File without changes
|