unique_toolkit 1.14.8__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,
@@ -637,6 +637,8 @@ class KnowledgeBaseService:
637
637
  ) -> ContentInfo:
638
638
  """
639
639
  Removes the specified keys irreversibly from the content metadata.
640
+
641
+ Note: Keys are camelized before being removed as metadata keys are stored in camelCase.
640
642
  """
641
643
 
642
644
  if content_info.metadata is None:
@@ -644,7 +646,7 @@ class KnowledgeBaseService:
644
646
  return content_info
645
647
 
646
648
  for key in keys_to_remove:
647
- content_info.metadata.pop(key, None)
649
+ content_info.metadata[humps.camelize(key)] = None
648
650
 
649
651
  return update_content(
650
652
  user_id=self._user_id,
@@ -673,6 +675,11 @@ class KnowledgeBaseService:
673
675
  metadata_filter: dict[str, Any] | None = None,
674
676
  content_infos: list[ContentInfo] | None = None,
675
677
  ) -> list[ContentInfo]:
678
+ """Update the metadata of the contents matching the metadata filter.
679
+
680
+ Note: Keys are camelized before being updated as metadata keys are stored in camelCase.
681
+ """
682
+
676
683
  additional_metadata_camelized = humps.camelize(additional_metadata)
677
684
  additional_metadata_camelized = self._pop_forbidden_metadata_keys(
678
685
  additional_metadata_camelized
@@ -710,6 +717,12 @@ class KnowledgeBaseService:
710
717
  metadata_filter: dict[str, Any] | None = None,
711
718
  content_infos: list[ContentInfo] | None = None,
712
719
  ) -> list[ContentInfo]:
720
+ """Remove the specified keys irreversibly from the content metadata.
721
+
722
+ Note: Keys are camelized before being removed as metadata keys are stored in camelCase.
723
+
724
+ """
725
+
713
726
  if content_infos is None:
714
727
  content_infos = self.get_paginated_content_infos(
715
728
  metadata_filter=metadata_filter,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.14.8
3
+ Version: 1.14.10
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,12 @@ 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
+
124
+ ## [1.14.9] - 2025-10-13
125
+ - Fix removal of metadata
126
+
121
127
  ## [1.14.8] - 2025-10-13
122
128
  - Use default tool icon on validation error
123
129
 
@@ -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
@@ -143,7 +143,7 @@ unique_toolkit/language_model/service.py,sha256=JkYGtCug8POQskTv_aoYkzTMOaPCWRM9
143
143
  unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
144
144
  unique_toolkit/protocols/support.py,sha256=V15WEIFKVMyF1QCnR8vIi4GrJy4dfTCB6d6JlqPZ58o,2341
145
145
  unique_toolkit/services/chat_service.py,sha256=bSrsN_7jsBW_BiuIWvtwkJ57AmlKLKz_cWlc0t0Q0P8,54621
146
- unique_toolkit/services/knowledge_base.py,sha256=WFeLnFf23AWHsAweDGrKIMI93HPE720fC_SaNh7mLNU,27183
146
+ unique_toolkit/services/knowledge_base.py,sha256=N6_PocSG6EW5hm6cKf7D8auc63dAWhcJat643OFPZJM,27668
147
147
  unique_toolkit/short_term_memory/__init__.py,sha256=2mI3AUrffgH7Yt-xS57EGqnHf7jnn6xquoKEhJqk3Wg,185
148
148
  unique_toolkit/short_term_memory/constants.py,sha256=698CL6-wjup2MvU19RxSmQk3gX7aqW_OOpZB7sbz_Xg,34
149
149
  unique_toolkit/short_term_memory/functions.py,sha256=3WiK-xatY5nh4Dr5zlDUye1k3E6kr41RiscwtTplw5k,4484
@@ -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.8.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
156
- unique_toolkit-1.14.8.dist-info/METADATA,sha256=mlJzRy6deKc1zvJAXK0r-fBejCBqf0ewEiTwb2ebdMc,36985
157
- unique_toolkit-1.14.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
158
- unique_toolkit-1.14.8.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,,