unique_toolkit 1.14.9__py3-none-any.whl → 1.14.10__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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.14.9
3
+ Version: 1.14.10
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,9 @@ 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.10] - 2025-10-13
122
+ - Fix token counter if images in history
123
+
121
124
  ## [1.14.9] - 2025-10-13
122
125
  - Fix removal of metadata
123
126
 
@@ -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
@@ -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.10.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
156
+ unique_toolkit-1.14.10.dist-info/METADATA,sha256=ZlADlKRP2Wi9SJ6ElhiIiKP85J_pWSgZxWE9ZgFb5yo,37106
157
+ unique_toolkit-1.14.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
+ unique_toolkit-1.14.10.dist-info/RECORD,,