unique_toolkit 1.5.1__py3-none-any.whl → 1.7.0__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.
@@ -217,18 +217,21 @@ class HistoryManager:
217
217
  return messages
218
218
 
219
219
  async def get_user_visible_chat_history(
220
- self, assistant_message_text: str | None = None
220
+ self,
221
+ assistant_message_text: str | None = None,
222
+ remove_from_text: Callable[[str], Awaitable[str]] | None = None,
221
223
  ) -> LanguageModelMessages:
222
224
  """Get the user visible chat history.
223
225
 
224
226
  Args:
225
227
  assistant_message_text (str | None): The latest assistant message to append to the history, as this is not extracted from the history.
226
228
  If None, the history will be returned without the latest assistant message.
229
+ remove_from_text (Callable[[str], Awaitable[str]] | None): A function to remove text from the history before returning it.
227
230
 
228
231
  Returns:
229
232
  LanguageModelMessages: The user visible chat history.
230
233
  """
231
- history = await self._token_reducer._get_history_from_db()
234
+ history = await self._token_reducer.get_history_from_db(remove_from_text)
232
235
  if assistant_message_text:
233
236
  history.append(
234
237
  LanguageModelAssistantMessage(content=assistant_message_text)
@@ -113,21 +113,6 @@ class LoopTokenReducer:
113
113
 
114
114
  return messages
115
115
 
116
- async def get_user_visible_chat_history(
117
- self, message: LanguageModelAssistantMessage
118
- ) -> LanguageModelMessages:
119
- """Get the user visible chat history.
120
-
121
- Args:
122
- message (LanguageModelAssistantMessage): The latest assistant message to append to the history, as this is not extracted from the history.
123
-
124
- Returns:
125
- LanguageModelMessages: The user visible chat history.
126
- """
127
- history = await self._get_history_from_db()
128
- history.append(message)
129
- return LanguageModelMessages(history)
130
-
131
116
  def _exceeds_token_limit(self, token_count: int) -> bool:
132
117
  """Check if token count exceeds the maximum allowed limit and if at least one tool call has more than one source."""
133
118
  # At least one tool call should have more than one chunk as answer
@@ -165,7 +150,7 @@ class LoopTokenReducer:
165
150
  rendered_system_message_string: str,
166
151
  remove_from_text: Callable[[str], Awaitable[str]],
167
152
  ) -> list[LanguageModelMessage]:
168
- history_from_db = await self._get_history_from_db(remove_from_text)
153
+ history_from_db = await self.get_history_from_db(remove_from_text)
169
154
  history_from_db = self._replace_user_message(
170
155
  history_from_db, original_user_message, rendered_user_message_string
171
156
  )
@@ -237,7 +222,7 @@ class LoopTokenReducer:
237
222
  ]
238
223
  return history
239
224
 
240
- async def _get_history_from_db(
225
+ async def get_history_from_db(
241
226
  self, remove_from_text: Callable[[str], Awaitable[str]] | None = None
242
227
  ) -> list[LanguageModelMessage]:
243
228
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.5.1
3
+ Version: 1.7.0
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,11 @@ 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.7.0] - 2025-10-01
122
+ - Add functionality to remove text in `get_user_visible_chat_history`
123
+
124
+ ## [1.6.0] - 2025-10-01
125
+ - revert and simplify 1.5.0
121
126
 
122
127
  ## [1.5.1] - 2025-10-01
123
128
  - Fix filtering logic to raise a ConfigurationException if chat event filters are not specified
@@ -42,8 +42,8 @@ unique_toolkit/agentic/evaluation/schemas.py,sha256=m9JMCUmeqP8KhsJOVEzsz6dRXUe1
42
42
  unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py,sha256=4tDxHTApbaTMxN1sNS8WCqj2BweRk6YqZ5_zHP45jto,7977
43
43
  unique_toolkit/agentic/evaluation/tests/test_output_parser.py,sha256=RN_HcBbU6qy_e_PoYyUFcjWnp3ymJ6-gLj6TgEOupAI,3107
44
44
  unique_toolkit/agentic/history_manager/history_construction_with_contents.py,sha256=c8Zy3erSbHGT8AdICRRlSK91T_FN6tNpTznvUzpLbWk,9023
45
- unique_toolkit/agentic/history_manager/history_manager.py,sha256=klUtDtcddUI7pdZIhIedl7YIOaZJBRp0N5O_Yh-nrqk,9217
46
- unique_toolkit/agentic/history_manager/loop_token_reducer.py,sha256=RH97HV2EiShsnw1C5USqAZ3vQxcoRjzxDZf_CibQ7GU,19109
45
+ unique_toolkit/agentic/history_manager/history_manager.py,sha256=1MSFEQtw7jYrcFVEgnTIe6LrGo36WVlutzqTwcFJq5w,9449
46
+ unique_toolkit/agentic/history_manager/loop_token_reducer.py,sha256=3QSDXZ9M12-cDhYr7-UgDYGEMySkXENt1OkfD0CruQ8,18538
47
47
  unique_toolkit/agentic/history_manager/utils.py,sha256=NDSSz0Jp3oVJU3iKlVScmM1AOe-6hTiVjLr16DUPsV0,5656
48
48
  unique_toolkit/agentic/postprocessor/postprocessor_manager.py,sha256=GDzJhaoOUwxZ37IINkQ7au4CHmAOFS5miP2lqv8ZwZA,4277
49
49
  unique_toolkit/agentic/reference_manager/reference_manager.py,sha256=1GeoFX1-RLdTcns1358GJADDSAcTAM2J0jJJpln08qo,4005
@@ -138,7 +138,7 @@ unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJ
138
138
  unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBuE9sI2o9Aajqjxg,8884
139
139
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
140
140
  unique_toolkit/smart_rules/compile.py,sha256=cxWjb2dxEI2HGsakKdVCkSNi7VK9mr08w5sDcFCQyWI,9553
141
- unique_toolkit-1.5.1.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
142
- unique_toolkit-1.5.1.dist-info/METADATA,sha256=1jL7EK6jc2i-l7G1fRUBjmFTxsrp_I43P3d6Yx_zF0w,34514
143
- unique_toolkit-1.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
144
- unique_toolkit-1.5.1.dist-info/RECORD,,
141
+ unique_toolkit-1.7.0.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
142
+ unique_toolkit-1.7.0.dist-info/METADATA,sha256=EayzMLYA56Chqh20xTaaWz3cSLOY5lk6dkvvxa9tHZA,34662
143
+ unique_toolkit-1.7.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
144
+ unique_toolkit-1.7.0.dist-info/RECORD,,