unique_toolkit 2026.40.0.dev1__py3-none-any.whl → 2026.40.0.dev2__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.
@@ -203,7 +203,8 @@ def _compose_msgs(
203
203
  )
204
204
  system_msg = LanguageModelSystemMessage(content=system_msg_content)
205
205
 
206
- # Render user message
206
+ # Render user message. Pass history text only when history exists so the
207
+ # template can omit an empty conversation section.
207
208
  user_msg_content = render_template(
208
209
  user_template,
209
210
  input_text=input.input_text,
@@ -211,7 +212,7 @@ def _compose_msgs(
211
212
  if has_context
212
213
  else None,
213
214
  history_messages_text=input.get_joined_history_texts(tag_name="conversation")
214
- if has_context
215
+ if has_context and input.history_messages
215
216
  else None,
216
217
  output_text=input.output_text,
217
218
  )
@@ -1224,3 +1224,67 @@ def test_get_msgs__ignores_context_images__when_model_lacks_vision() -> None:
1224
1224
  # Assert
1225
1225
  assert result.root[0].content == no_context_result.root[0].content
1226
1226
  assert isinstance(result.root[1].content, str)
1227
+
1228
+
1229
+ @pytest.mark.unit
1230
+ def test_compose_msgs__omits_conversation_section__when_history_is_empty():
1231
+ """A single-turn evaluation must not be shown an empty conversation.
1232
+
1233
+ The template guards the section with `{% if history_messages_text %}`,
1234
+ and the getter returns a truthy placeholder when there is no history, so
1235
+ the guard used to never fire: every caller evaluating one turn shipped a
1236
+ `Conversation:` section whose body said there was no conversation, while
1237
+ the system prompt announced one.
1238
+ """
1239
+ msgs = _compose_msgs(
1240
+ EvaluationMetricInput(
1241
+ input_text="What is the policy rate?",
1242
+ context_texts=["The policy rate is 0.25%."],
1243
+ history_messages=[],
1244
+ output_text="0.25%.",
1245
+ ),
1246
+ HallucinationConfig(),
1247
+ has_context=True,
1248
+ )
1249
+
1250
+ user_content = msgs.root[-1].content
1251
+ assert isinstance(user_content, str)
1252
+ assert "Conversation:" not in user_content
1253
+ assert "<No conversation texts provided>" not in user_content
1254
+ # The references the model does have must still be there.
1255
+ assert "The policy rate is 0.25%." in user_content
1256
+
1257
+
1258
+ @pytest.mark.unit
1259
+ def test_compose_msgs__keeps_conversation_section__when_history_is_present():
1260
+ msgs = _compose_msgs(
1261
+ EvaluationMetricInput(
1262
+ input_text="And in March?",
1263
+ context_texts=["The March rate was 0.50%."],
1264
+ history_messages=[
1265
+ ChatMessage(
1266
+ id="msg_1",
1267
+ chat_id="chat_1",
1268
+ previous_message_id=None,
1269
+ role=LanguageModelMessageRole.USER,
1270
+ text="What is the policy rate?",
1271
+ ),
1272
+ ChatMessage(
1273
+ id="msg_2",
1274
+ chat_id="chat_1",
1275
+ previous_message_id="msg_1",
1276
+ role=LanguageModelMessageRole.ASSISTANT,
1277
+ text="0.25%.",
1278
+ ),
1279
+ ],
1280
+ output_text="0.50%.",
1281
+ ),
1282
+ HallucinationConfig(),
1283
+ has_context=True,
1284
+ )
1285
+
1286
+ user_content = msgs.root[-1].content
1287
+ assert isinstance(user_content, str)
1288
+ assert "Conversation:" in user_content
1289
+ assert "What is the policy rate?" in user_content
1290
+ assert "<No conversation texts provided>" not in user_content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: unique-toolkit
3
- Version: 2026.40.0.dev1
3
+ Version: 2026.40.0.dev2
4
4
  Summary:
5
5
  Author: Cedric Klinkert, Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri, Ejiroghene Oki-Peter, Rami Azouz, Ricardo Visini, Sanzio Monti
6
6
  Author-email: Cedric Klinkert <cedric.klinkert@unique.ch>, Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>, Ejiroghene Oki-Peter <oki-peter.ejiroghene@unique.ai>, Rami Azouz <rami.ext@unique.ch>, Ricardo Visini <ricardo.visini@unique.ch>, Sanzio Monti <sanzio.monti@unique.ai>
@@ -99,7 +99,7 @@ unique_toolkit/agentic/evaluation/hallucination/prompts/__init__.py,sha256=4KFYM
99
99
  unique_toolkit/agentic/evaluation/hallucination/prompts/system_prompt.j2,sha256=sDUX6G645Ba40D_qKu4cUI8g-sJOfG8JpZreTNFgf7M,2616
100
100
  unique_toolkit/agentic/evaluation/hallucination/prompts/user_prompt.j2,sha256=mD_qE9fOkyc1XXrebFt097ddx8bTlA6lbY04hKSQmWs,273
101
101
  unique_toolkit/agentic/evaluation/hallucination/service.py,sha256=QSPsRxx2H-YpSR2Jn7zJKtwZfZ7elTPAFQiYvM3gYfs,2618
102
- unique_toolkit/agentic/evaluation/hallucination/utils.py,sha256=QVXO0hFrsGxvbgTwC40RSfrLhE_1of1oBrrfcafk10Y,15531
102
+ unique_toolkit/agentic/evaluation/hallucination/utils.py,sha256=maiMxlUjT9_U0GAH9HvemMIUE-47MCGtwm2XMwDAShQ,15664
103
103
  unique_toolkit/agentic/evaluation/output_parser.py,sha256=0FDo8YY_Dc4qlTNeYyQkznzIFj9aX9wMrLOTbhhTl6g,1418
104
104
  unique_toolkit/agentic/evaluation/schemas.py,sha256=RT0O-AXSOf1zV3fDbUfn7V6bOIA01pkzui02Uad9E3Y,3815
105
105
  unique_toolkit/agentic/evaluation/tests/fixtures.py,sha256=Q-ughTfDiAdsMKbBVGzFiBucFdAx-FXgJ9iqp5xMyPs,2801
@@ -107,7 +107,7 @@ unique_toolkit/agentic/evaluation/tests/test_config.py,sha256=p7xFQ7KE_yU8jGpqYA
107
107
  unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py,sha256=-GRxH70vzvrZG6Hz0igH6i2CqM7Z9jjKt3396xWDh84,12011
108
108
  unique_toolkit/agentic/evaluation/tests/test_hallucination_constants.py,sha256=A77nRcniI7hUf640f1sTvCAibQbJE30ikbz1RX4fltw,20478
109
109
  unique_toolkit/agentic/evaluation/tests/test_hallucination_external_context.py,sha256=3JR9WfBWazX7a1h3uq77Q6kSKm8Mt-aAW8KUYxJUw14,4303
110
- unique_toolkit/agentic/evaluation/tests/test_hallucination_utils.py,sha256=JzFXSH3k1qnSDbZEQy5ftKiVnVL_jS1PTpp3H3DjewI,39218
110
+ unique_toolkit/agentic/evaluation/tests/test_hallucination_utils.py,sha256=TJcJf9SZcH1dsSq38NkvSBM0VZfBRkan49Una3UPQB0,41546
111
111
  unique_toolkit/agentic/evaluation/tests/test_output_parser.py,sha256=KfltytmvqnPWLhmZpBXqcRmnlYorw_USwM5rkLVv8so,5179
112
112
  unique_toolkit/agentic/evaluation/tests/test_prompt_loaders.py,sha256=zBREdlKf5tdDyB8XSaNgpQv3-tuZJoYteeJrp6WMWDM,11897
113
113
  unique_toolkit/agentic/evaluation/utils.py,sha256=HmyPaDV8wdW-_gOjjW-wDaMKgdrsP5-SHP7OqTmGI_A,264
@@ -423,6 +423,6 @@ unique_toolkit/short_term_memory/service.py,sha256=2JMBEBn6GoyK-a0xvdcWpPft-3C74
423
423
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
424
424
  unique_toolkit/smart_rules/compile.py,sha256=vRe0aMJWuVIK-VsqomgxQImzke7MDmwgSxxJfYCa7zw,1386
425
425
  unique_toolkit/test_utilities/events.py,sha256=FLrhMh0A_mQutAUjoD0FdMcVQ4Gq31r35OVGzRjvLro,6760
426
- unique_toolkit-2026.40.0.dev1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
427
- unique_toolkit-2026.40.0.dev1.dist-info/METADATA,sha256=BfWkREvwGUnak2qn1etchW2-YJZloIknxqqA_bOd-jA,7821
428
- unique_toolkit-2026.40.0.dev1.dist-info/RECORD,,
426
+ unique_toolkit-2026.40.0.dev2.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
427
+ unique_toolkit-2026.40.0.dev2.dist-info/METADATA,sha256=1pYHcXpwHT_qaRtAktnTjSmPc8LuO6poU0Z1UiLbaRI,7821
428
+ unique_toolkit-2026.40.0.dev2.dist-info/RECORD,,