unique_toolkit 1.14.9__py3-none-any.whl → 1.14.11__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.
@@ -266,7 +266,9 @@ class LoopTokenReducer:
266
266
  selected_messages = []
267
267
  token_count = 0
268
268
  for msg in messages[::-1]:
269
- msg_token_count = self._count_tokens(str(msg.content))
269
+ msg_token_count = self._count_message_tokens(
270
+ LanguageModelMessages(root=[msg])
271
+ )
270
272
  if token_count + msg_token_count > token_limit:
271
273
  break
272
274
  selected_messages.append(msg)
@@ -293,9 +295,6 @@ class LoopTokenReducer:
293
295
  )
294
296
  return messages
295
297
 
296
- def _count_tokens(self, text: str) -> int:
297
- return len(self._encoder.encode(text))
298
-
299
298
  def ensure_last_message_is_user_message(self, limited_history_messages):
300
299
  """
301
300
  As the token limit can be reached in the middle of a gpt_request,
@@ -34,7 +34,7 @@ class ToolSelectionPolicy(StrEnum):
34
34
  BY_USER = "ByUser"
35
35
 
36
36
 
37
- def handle_undefinded_icon(value: Any) -> ToolIcon:
37
+ def handle_undefined_icon(value: Any) -> ToolIcon:
38
38
  try:
39
39
  if isinstance(value, str):
40
40
  return ToolIcon(value)
@@ -51,7 +51,7 @@ class ToolBuildConfig(BaseModel):
51
51
  name: str
52
52
  configuration: BaseToolConfig
53
53
  display_name: str = ""
54
- icon: Annotated[ToolIcon, BeforeValidator(handle_undefinded_icon)] = Field(
54
+ icon: Annotated[ToolIcon, BeforeValidator(handle_undefined_icon)] = Field(
55
55
  default=ToolIcon.BOOK,
56
56
  description="The icon name that will be used to display the tool in the user interface.",
57
57
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.14.9
3
+ Version: 1.14.11
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,13 @@ All notable changes to this project will be documented in this file.
118
118
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
119
119
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
120
120
 
121
+ ## [1.14.11] - 2025-10-13
122
+ - Introduce testing guidelines for AI
123
+ - Add AI tests to `tool_config` and `tool_factory.py`
124
+
125
+ ## [1.14.10] - 2025-10-13
126
+ - Fix token counter if images in history
127
+
121
128
  ## [1.14.9] - 2025-10-13
122
129
  - Fix removal of metadata
123
130
 
@@ -44,7 +44,7 @@ unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py,sha256
44
44
  unique_toolkit/agentic/evaluation/tests/test_output_parser.py,sha256=RN_HcBbU6qy_e_PoYyUFcjWnp3ymJ6-gLj6TgEOupAI,3107
45
45
  unique_toolkit/agentic/history_manager/history_construction_with_contents.py,sha256=c8Zy3erSbHGT8AdICRRlSK91T_FN6tNpTznvUzpLbWk,9023
46
46
  unique_toolkit/agentic/history_manager/history_manager.py,sha256=xWA8w5CWrzueGW05ekIhc_Y_-_380hFfIB4rB5wlito,9470
47
- unique_toolkit/agentic/history_manager/loop_token_reducer.py,sha256=3QSDXZ9M12-cDhYr7-UgDYGEMySkXENt1OkfD0CruQ8,18538
47
+ unique_toolkit/agentic/history_manager/loop_token_reducer.py,sha256=4XUX2-yVBnaYthV8p0zj2scVBUdK_3IhxBgoNlrytyQ,18498
48
48
  unique_toolkit/agentic/history_manager/utils.py,sha256=NDSSz0Jp3oVJU3iKlVScmM1AOe-6hTiVjLr16DUPsV0,5656
49
49
  unique_toolkit/agentic/postprocessor/postprocessor_manager.py,sha256=GDzJhaoOUwxZ37IINkQ7au4CHmAOFS5miP2lqv8ZwZA,4277
50
50
  unique_toolkit/agentic/reference_manager/reference_manager.py,sha256=x51CT0D8HHu2LzgXdHGy0leOYpjnsxVbPZ2nc28G9mA,4005
@@ -74,7 +74,7 @@ unique_toolkit/agentic/tools/a2a/tool/_schema.py,sha256=wMwyunViTnxaURvenkATEvyf
74
74
  unique_toolkit/agentic/tools/a2a/tool/config.py,sha256=07W8cZFc32yRvIeUFEQXi8R1cSGqlXL4pZb7UlB3Rvs,2490
75
75
  unique_toolkit/agentic/tools/a2a/tool/service.py,sha256=6Eru-jqlt13lIBVC26LhH0Oxb3qVdDQIUWRoChf8ysw,10525
76
76
  unique_toolkit/agentic/tools/agent_chunks_hanlder.py,sha256=x32Dp1Z8cVW5i-XzXbaMwX2KHPcNGmqEU-FB4AV9ZGo,1909
77
- unique_toolkit/agentic/tools/config.py,sha256=gVqstCMkeBGT4U6D87Rvsesm8q3hHYaTVWw1-33OQtw,5389
77
+ unique_toolkit/agentic/tools/config.py,sha256=QD83iy2xAJFyoPggYyLWq-MaSGSq00yS9iI31My1NBc,5387
78
78
  unique_toolkit/agentic/tools/factory.py,sha256=Wt0IGSbLg8ZTq5PU9p_JTW0LtNATWLpc3336irJKXlM,1277
79
79
  unique_toolkit/agentic/tools/mcp/__init__.py,sha256=RLF_p-LDRC7GhiB3fdCi4u3bh6V9PY_w26fg61BLyco,122
80
80
  unique_toolkit/agentic/tools/mcp/manager.py,sha256=DPYwwDe6RSZyuPaxn-je49fP_qOOs0ZV46EM6GZcV4c,2748
@@ -152,7 +152,7 @@ unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBu
152
152
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
153
153
  unique_toolkit/smart_rules/compile.py,sha256=Ozhh70qCn2yOzRWr9d8WmJeTo7AQurwd3tStgBMPFLA,1246
154
154
  unique_toolkit/test_utilities/events.py,sha256=_mwV2bs5iLjxS1ynDCjaIq-gjjKhXYCK-iy3dRfvO3g,6410
155
- unique_toolkit-1.14.9.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
156
- unique_toolkit-1.14.9.dist-info/METADATA,sha256=PSio0oBtbLTzEzKGGDd7Oe2sGyWnDYYB4XUEqG85Ra4,37037
157
- unique_toolkit-1.14.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
- unique_toolkit-1.14.9.dist-info/RECORD,,
155
+ unique_toolkit-1.14.11.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
156
+ unique_toolkit-1.14.11.dist-info/METADATA,sha256=0Vy2yKAM4d6rUAmlhOQT4Jx4Ssk3QLCxbdEnkiR-Hz8,37225
157
+ unique_toolkit-1.14.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
+ unique_toolkit-1.14.11.dist-info/RECORD,,