unique_toolkit 1.4.2__py3-none-any.whl → 1.4.3__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.
@@ -9,6 +9,10 @@ DEFAULT_PARAM_DESCRIPTION_SUB_AGENT_USER_MESSAGE = """
9
9
  This is the message that will be sent to the sub-agent.
10
10
  """.strip()
11
11
 
12
+ DEFAULT_FORMAT_INFORMATION_SUB_AGENT_SYSTEM_MESSAGE = """
13
+ NEVER mention any references from sub-agent answers in your response.
14
+ """
15
+
12
16
 
13
17
  class ResponseDisplayMode(StrEnum):
14
18
  HIDDEN = "hidden"
@@ -40,7 +44,9 @@ class SubAgentToolConfig(BaseToolConfig):
40
44
  param_description_sub_agent_user_message: str = (
41
45
  DEFAULT_PARAM_DESCRIPTION_SUB_AGENT_USER_MESSAGE
42
46
  )
43
- tool_format_information_for_system_prompt: str = ""
47
+ tool_format_information_for_system_prompt: str = (
48
+ DEFAULT_FORMAT_INFORMATION_SUB_AGENT_SYSTEM_MESSAGE
49
+ )
44
50
  tool_description_for_user_prompt: str = ""
45
51
  tool_format_information_for_user_prompt: str = ""
46
52
 
@@ -182,23 +182,45 @@ def _consolidate_references_in_place(
182
182
 
183
183
  references = list(sorted(references, key=lambda ref: ref["sequenceNumber"]))
184
184
 
185
+ ref_map = {}
186
+
185
187
  message_new_refs = []
186
188
  for reference in references:
187
189
  source_id = reference["sourceId"]
188
190
 
189
191
  if source_id not in existing_refs:
190
192
  message_new_refs.append(reference)
193
+
191
194
  existing_refs[source_id] = start_index
192
195
  start_index += 1
193
196
 
194
197
  reference_num = existing_refs[source_id]
195
-
196
198
  seq_num = reference["sequenceNumber"]
197
- message["text"] = re.sub(
198
- rf"<sup>{seq_num}</sup>",
199
- f"<sup>{reference_num}</sup>",
200
- message["text"],
201
- )
199
+
200
+ ref_map[seq_num] = reference_num
201
+
202
202
  reference["sequenceNumber"] = reference_num
203
203
 
204
+ message["text"] = _replace_references_in_text(message["text"], ref_map)
204
205
  message["references"] = message_new_refs
206
+
207
+
208
+ def _replace_references_in_text_non_overlapping(
209
+ text: str, ref_map: dict[int, int]
210
+ ) -> str:
211
+ for orig, repl in ref_map.items():
212
+ text = re.sub(rf"<sup>{orig}</sup>", f"<sup>{repl}</sup>", text)
213
+ return text
214
+
215
+
216
+ def _replace_references_in_text(text: str, ref_map: dict[int, int]) -> str:
217
+ # 2 phase replacement, since the map keys and values can overlap
218
+ max_ref = max(ref_map.keys(), default=0) + 1
219
+ unique_refs = range(max_ref, max_ref + len(ref_map))
220
+
221
+ text = _replace_references_in_text_non_overlapping(
222
+ text, dict(zip(ref_map.keys(), unique_refs))
223
+ )
224
+ return _replace_references_in_text_non_overlapping(
225
+ text, dict(zip(unique_refs, ref_map.values()))
226
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.4.2
3
+ Version: 1.4.3
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.4.3] - 2025-09-30
122
+ - Fix bug with sub-agent post-processing reference numbers.
123
+
121
124
  ## [1.4.2] - 2025-09-30
122
125
  - Adding litellm models `litellm:anthropic-claude-sonnet-4-5` and `litellm:anthropic-claude-opus-4-1`
123
126
 
@@ -51,7 +51,7 @@ unique_toolkit/agentic/short_term_memory_manager/persistent_short_term_memory_ma
51
51
  unique_toolkit/agentic/thinking_manager/thinking_manager.py,sha256=41QWFsdRrbWlQHBfYCFv726UDom4WbcvaRfjCmoUOQI,4183
52
52
  unique_toolkit/agentic/tools/__init__.py,sha256=-ToY9-Xiz0K7qCUydH1h1yG6n4h1hQS8sBuSVPNEq2Y,43
53
53
  unique_toolkit/agentic/tools/a2a/__init__.py,sha256=NdY0J33b1G4sbx6UWwNS74JVSAeEtu8u_iEXOT64Uq0,187
54
- unique_toolkit/agentic/tools/a2a/config.py,sha256=exKyR-RyQ3RDJcEAKwfOdyj1flfbBaRhcdn5ROnmNB4,1513
54
+ unique_toolkit/agentic/tools/a2a/config.py,sha256=3Rp5myYQgPwOq-qmM0OaZDFkovXh9a1YJc8TnieN-K0,1711
55
55
  unique_toolkit/agentic/tools/a2a/evaluation/__init__.py,sha256=H9YhT22w8EadV9b-6IDqYqKQa41qcA3m6ADzmP7g6Cc,246
56
56
  unique_toolkit/agentic/tools/a2a/evaluation/config.py,sha256=o1Xj2H4175C1ALT8-wIfks69Xez3pgY77PFyPBYS4Hs,1692
57
57
  unique_toolkit/agentic/tools/a2a/evaluation/evaluator.py,sha256=V3y72yAZ5ynDnzp8V7UxMpnwa1Xyw7gvjPqfgHCeMkU,7660
@@ -60,7 +60,7 @@ unique_toolkit/agentic/tools/a2a/manager.py,sha256=yuuQuBrAcsT3gAWEdxf6EvRnL_iWt
60
60
  unique_toolkit/agentic/tools/a2a/memory.py,sha256=4VFBzITCv5E_8YCc4iF4Y6FhzplS2C-FZaZHdeC7DyA,1028
61
61
  unique_toolkit/agentic/tools/a2a/postprocessing/__init__.py,sha256=9M5RRSO4gmQVI1gfve6MGEfVktT9WcELQFZ8Sv6xu4Y,160
62
62
  unique_toolkit/agentic/tools/a2a/postprocessing/display.py,sha256=rlBWO2M8Lr5Kx-vmvwlV-vEu33BZE4votP-TMr3-3Dw,3366
63
- unique_toolkit/agentic/tools/a2a/postprocessing/postprocessor.py,sha256=BWXFsv5akPhkNxRQ3JLktrBkoT1_66joTel_uM4BgRY,6963
63
+ unique_toolkit/agentic/tools/a2a/postprocessing/postprocessor.py,sha256=MGOQJ2bcBEv8v8mI5ZOgsv_J8hPFFLQ2RLODXzJ6eVc,7652
64
64
  unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display.py,sha256=UVOd5tVTltngVfsdOn6cuyvG7QmRBkfgUj_SruTgmHI,15279
65
65
  unique_toolkit/agentic/tools/a2a/schema.py,sha256=T1l5z6trtPE5nhqPzt5tvfRNDhqL_ST1Wj7_lBWJ58g,304
66
66
  unique_toolkit/agentic/tools/a2a/service.py,sha256=ySgCZZ_3APPZ8j0sz-7_1CYxfFTvGCSpu0qsUG1YShQ,7916
@@ -137,7 +137,7 @@ unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJ
137
137
  unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBuE9sI2o9Aajqjxg,8884
138
138
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  unique_toolkit/smart_rules/compile.py,sha256=cxWjb2dxEI2HGsakKdVCkSNi7VK9mr08w5sDcFCQyWI,9553
140
- unique_toolkit-1.4.2.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
141
- unique_toolkit-1.4.2.dist-info/METADATA,sha256=aIA-PciV6Tv8mVFR3uJFxGXqFAQ_-mtJ8-1X-he1ehQ,34076
142
- unique_toolkit-1.4.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
143
- unique_toolkit-1.4.2.dist-info/RECORD,,
140
+ unique_toolkit-1.4.3.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
141
+ unique_toolkit-1.4.3.dist-info/METADATA,sha256=kqVo0uCpxe7VLrBCbbENvk2O7lCBBA8PxNVb9J-VcQE,34161
142
+ unique_toolkit-1.4.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
143
+ unique_toolkit-1.4.3.dist-info/RECORD,,