unique_toolkit 1.4.4__py3-none-any.whl → 1.5.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.
@@ -215,3 +215,22 @@ class HistoryManager:
215
215
  remove_from_text=remove_from_text,
216
216
  )
217
217
  return messages
218
+
219
+ async def get_user_visible_chat_history(
220
+ self, assistant_message_text: str | None = None
221
+ ) -> LanguageModelMessages:
222
+ """Get the user visible chat history.
223
+
224
+ Args:
225
+ assistant_message_text (str | None): The latest assistant message to append to the history, as this is not extracted from the history.
226
+ If None, the history will be returned without the latest assistant message.
227
+
228
+ Returns:
229
+ LanguageModelMessages: The user visible chat history.
230
+ """
231
+ history = await self._token_reducer._get_history_from_db()
232
+ if assistant_message_text:
233
+ history.append(
234
+ LanguageModelAssistantMessage(content=assistant_message_text)
235
+ )
236
+ return LanguageModelMessages(history)
@@ -113,6 +113,21 @@ 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
+
116
131
  def _exceeds_token_limit(self, token_count: int) -> bool:
117
132
  """Check if token count exceeds the maximum allowed limit and if at least one tool call has more than one source."""
118
133
  # At least one tool call should have more than one chunk as answer
@@ -223,7 +238,7 @@ class LoopTokenReducer:
223
238
  return history
224
239
 
225
240
  async def _get_history_from_db(
226
- self, remove_from_text: Callable[[str], Awaitable[str]]
241
+ self, remove_from_text: Callable[[str], Awaitable[str]] | None = None
227
242
  ) -> list[LanguageModelMessage]:
228
243
  """
229
244
  Get the history of the conversation. The function will retrieve a subset of the full history based on the configuration.
@@ -242,10 +257,10 @@ class LoopTokenReducer:
242
257
  else FileContentSerialization.FILE_NAME
243
258
  ),
244
259
  )
245
-
246
- full_history.root = await self._clean_messages(
247
- full_history.root, remove_from_text
248
- )
260
+ if remove_from_text is not None:
261
+ full_history.root = await self._clean_messages(
262
+ full_history.root, remove_from_text
263
+ )
249
264
 
250
265
  limited_history_messages = self._limit_to_token_window(
251
266
  full_history.root, self._max_history_tokens
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.4.4
3
+ Version: 1.5.0
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.5.0] - 2025-10-01
122
+ - Allow history manager to fetch only ui visible text
123
+
121
124
  ## [1.4.4] - 2025-09-30
122
125
  - Fix bugs with display of sub-agent answers and evaluations when multiple sub-agent from the same assistant run concurrently.
123
126
 
@@ -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=qo6vjEXueCXUxHSrawYeMmFn7tuTEXGTWnBVb0H8bDY,8423
46
- unique_toolkit/agentic/history_manager/loop_token_reducer.py,sha256=9ZWh3dfs7SGsU33bxzKo9x94haEhc7Rerk9PtfFzcxg,18474
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
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.4.4.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
142
- unique_toolkit-1.4.4.dist-info/METADATA,sha256=lJl2z2t_r5J6gUHPisAQgBbdAf15Oh3fuR9pnric08E,34313
143
- unique_toolkit-1.4.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
144
- unique_toolkit-1.4.4.dist-info/RECORD,,
141
+ unique_toolkit-1.5.0.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
142
+ unique_toolkit-1.5.0.dist-info/METADATA,sha256=521VJV6pIIEKtepXsgoCfdRj8QLH62E6tHz4js9cjVA,34392
143
+ unique_toolkit-1.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
144
+ unique_toolkit-1.5.0.dist-info/RECORD,,