unique_toolkit 1.45.6__py3-none-any.whl → 1.45.8__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.
- unique_toolkit/agentic/evaluation/hallucination/constants.py +2 -2
- unique_toolkit/agentic/evaluation/tests/test_hallucination_constants.py +34 -0
- unique_toolkit/chat/responses_api.py +49 -45
- {unique_toolkit-1.45.6.dist-info → unique_toolkit-1.45.8.dist-info}/METADATA +10 -2
- {unique_toolkit-1.45.6.dist-info → unique_toolkit-1.45.8.dist-info}/RECORD +7 -7
- {unique_toolkit-1.45.6.dist-info → unique_toolkit-1.45.8.dist-info}/LICENSE +0 -0
- {unique_toolkit-1.45.6.dist-info → unique_toolkit-1.45.8.dist-info}/WHEEL +0 -0
|
@@ -34,10 +34,10 @@ class HallucinationPromptsConfig(EvaluationMetricPromptsConfig):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class HallucinationConfig(EvaluationMetricConfig):
|
|
37
|
-
source_selection_mode: SourceSelectionMode = Field(
|
|
37
|
+
source_selection_mode: SkipJsonSchema[SourceSelectionMode] = Field(
|
|
38
38
|
default=SourceSelectionMode.FROM_ORIGINAL_RESPONSE
|
|
39
39
|
)
|
|
40
|
-
reference_pattern: str = Field(default=r"[\[<]?source(\d+)[>\]]?")
|
|
40
|
+
reference_pattern: SkipJsonSchema[str] = Field(default=r"[\[<]?source(\d+)[>\]]?")
|
|
41
41
|
enabled: SkipJsonSchema[bool] = False
|
|
42
42
|
name: SkipJsonSchema[EvaluationMetricName] = EvaluationMetricName.HALLUCINATION
|
|
43
43
|
language_model: LMI = LanguageModelInfo.from_name(
|
|
@@ -598,3 +598,37 @@ def test_hallucination_required_input_fields__contains_only_valid_enum_values__f
|
|
|
598
598
|
# Act & Assert
|
|
599
599
|
for field in hallucination_required_input_fields:
|
|
600
600
|
assert isinstance(field, EvaluationMetricInputFieldName)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
@pytest.mark.ai
|
|
604
|
+
def test_hallucination_config__excludes_source_selection_mode__from_json_schema() -> (
|
|
605
|
+
None
|
|
606
|
+
):
|
|
607
|
+
"""
|
|
608
|
+
Purpose: Verify that source_selection_mode is not included in JSON schema.
|
|
609
|
+
Why this matters: SkipJsonSchema annotation should exclude internal fields from schema.
|
|
610
|
+
Setup summary: Generate JSON schema, assert source_selection_mode is not present.
|
|
611
|
+
"""
|
|
612
|
+
# Arrange - No setup needed
|
|
613
|
+
|
|
614
|
+
# Act
|
|
615
|
+
schema: dict = HallucinationConfig.model_json_schema()
|
|
616
|
+
|
|
617
|
+
# Assert
|
|
618
|
+
assert "source_selection_mode" not in schema.get("properties", {})
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
@pytest.mark.ai
|
|
622
|
+
def test_hallucination_config__excludes_reference_pattern__from_json_schema() -> None:
|
|
623
|
+
"""
|
|
624
|
+
Purpose: Verify that reference_pattern is not included in JSON schema.
|
|
625
|
+
Why this matters: SkipJsonSchema annotation should exclude internal fields from schema.
|
|
626
|
+
Setup summary: Generate JSON schema, assert reference_pattern is not present.
|
|
627
|
+
"""
|
|
628
|
+
# Arrange - No setup needed
|
|
629
|
+
|
|
630
|
+
# Act
|
|
631
|
+
schema: dict = HallucinationConfig.model_json_schema()
|
|
632
|
+
|
|
633
|
+
# Assert
|
|
634
|
+
assert "reference_pattern" not in schema.get("properties", {})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import logging
|
|
2
3
|
from typing import Any, NamedTuple, Sequence
|
|
3
4
|
|
|
@@ -196,12 +197,23 @@ def _prepare_responses_params_util(
|
|
|
196
197
|
log_exc_info=False,
|
|
197
198
|
logger=logger,
|
|
198
199
|
)
|
|
199
|
-
def _attempt_extract_reasoning_from_options(
|
|
200
|
-
|
|
200
|
+
def _attempt_extract_reasoning_from_options(
|
|
201
|
+
options: dict[str, Any],
|
|
202
|
+
) -> Reasoning | None:
|
|
203
|
+
reasoning: dict[str, Any] | str | None = None
|
|
201
204
|
|
|
202
205
|
# Responses API
|
|
203
206
|
if "reasoning" in options:
|
|
204
207
|
reasoning = options["reasoning"]
|
|
208
|
+
# Handle case where reasoning is stored as JSON string (UI limitation)
|
|
209
|
+
if isinstance(reasoning, str):
|
|
210
|
+
try:
|
|
211
|
+
reasoning = json.loads(reasoning)
|
|
212
|
+
except (json.JSONDecodeError, TypeError):
|
|
213
|
+
logger.warning(
|
|
214
|
+
f"Failed to parse reasoning as JSON string: {reasoning}. "
|
|
215
|
+
"Continuing with raw value."
|
|
216
|
+
)
|
|
205
217
|
|
|
206
218
|
# Completions API
|
|
207
219
|
elif "reasoning_effort" in options:
|
|
@@ -222,20 +234,28 @@ def _attempt_extract_reasoning_from_options(options: dict) -> Reasoning | None:
|
|
|
222
234
|
logger=logger,
|
|
223
235
|
)
|
|
224
236
|
def _attempt_extract_verbosity_from_options(
|
|
225
|
-
options: dict,
|
|
237
|
+
options: dict[str, Any],
|
|
226
238
|
) -> ResponseTextConfigParam | None:
|
|
227
|
-
|
|
239
|
+
if "verbosity" in options:
|
|
240
|
+
return TypeAdapter(ResponseTextConfigParam).validate_python(
|
|
241
|
+
{"verbosity": options["verbosity"]}
|
|
242
|
+
)
|
|
228
243
|
|
|
229
244
|
# Responses API
|
|
230
245
|
if "text" in options:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
text_config: dict[str, Any] | str = options["text"]
|
|
247
|
+
# Handle case where text is stored as JSON string (UI limitation)
|
|
248
|
+
if isinstance(text_config, str):
|
|
249
|
+
try:
|
|
250
|
+
text_config = json.loads(text_config)
|
|
251
|
+
return TypeAdapter(ResponseTextConfigParam).validate_python(text_config)
|
|
252
|
+
except (json.JSONDecodeError, TypeError):
|
|
253
|
+
logger.warning(
|
|
254
|
+
f"Failed to parse text as JSON string: {text_config}. "
|
|
255
|
+
"Continuing with raw value."
|
|
256
|
+
)
|
|
257
|
+
if isinstance(text_config, dict):
|
|
258
|
+
return TypeAdapter(ResponseTextConfigParam).validate_python(text_config)
|
|
239
259
|
|
|
240
260
|
return None
|
|
241
261
|
|
|
@@ -283,42 +303,26 @@ def _prepare_responses_args(
|
|
|
283
303
|
|
|
284
304
|
openai_options: unique_sdk.Integrated.CreateStreamResponsesOpenaiParams = {}
|
|
285
305
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if max_output_tokens is not None:
|
|
302
|
-
openai_options["max_output_tokens"] = max_output_tokens
|
|
303
|
-
|
|
304
|
-
if metadata is not None:
|
|
305
|
-
openai_options["metadata"] = metadata
|
|
306
|
-
|
|
307
|
-
if parallel_tool_calls is not None:
|
|
308
|
-
openai_options["parallel_tool_calls"] = parallel_tool_calls
|
|
309
|
-
|
|
310
|
-
if tool_choice is not None:
|
|
311
|
-
openai_options["tool_choice"] = tool_choice
|
|
312
|
-
|
|
313
|
-
if params.tools is not None:
|
|
314
|
-
openai_options["tools"] = params.tools
|
|
315
|
-
|
|
316
|
-
if top_p is not None:
|
|
317
|
-
openai_options["top_p"] = top_p
|
|
306
|
+
explicit_options = {
|
|
307
|
+
"temperature": params.temperature,
|
|
308
|
+
"reasoning": params.reasoning,
|
|
309
|
+
"text": params.text,
|
|
310
|
+
"include": include,
|
|
311
|
+
"instructions": instructions,
|
|
312
|
+
"max_output_tokens": max_output_tokens,
|
|
313
|
+
"metadata": metadata,
|
|
314
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
315
|
+
"tool_choice": tool_choice,
|
|
316
|
+
"tools": params.tools,
|
|
317
|
+
"top_p": top_p,
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
openai_options.update({k: v for k, v in explicit_options.items() if v is not None}) # type: ignore[arg-type]
|
|
318
321
|
|
|
319
322
|
# allow any other openai.resources.responses.Response.create options
|
|
320
323
|
if other_options is not None:
|
|
321
|
-
|
|
324
|
+
for k, v in other_options.items():
|
|
325
|
+
openai_options.setdefault(k, v) # type: ignore
|
|
322
326
|
|
|
323
327
|
options["options"] = openai_options
|
|
324
328
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_toolkit
|
|
3
|
-
Version: 1.45.
|
|
3
|
+
Version: 1.45.8
|
|
4
4
|
Summary:
|
|
5
5
|
License: Proprietary
|
|
6
6
|
Author: Cedric Klinkert
|
|
@@ -125,8 +125,16 @@ All notable changes to this project will be documented in this file.
|
|
|
125
125
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
126
126
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
127
127
|
|
|
128
|
+
## [1.45.8] - 2026-02-02
|
|
129
|
+
- Hallucination: Hide Source Selection Mode and Reference pattern from schema
|
|
130
|
+
|
|
131
|
+
## [1.45.7] - 2026-01-30
|
|
132
|
+
- Add JSON string parsing support for reasoning and text parameters in responses API (UI compatibility)
|
|
133
|
+
- Fix variable name bug in `_attempt_extract_verbosity_from_options` function
|
|
134
|
+
- Improve `other_options` handling to prevent overwriting explicitly set parameters
|
|
135
|
+
|
|
128
136
|
## [1.45.6] - 2026-01-30
|
|
129
|
-
- hallucination evaluator: Use original response to retrieve referenced chunk
|
|
137
|
+
- hallucination evaluator: Use original response to retrieve referenced chunk
|
|
130
138
|
|
|
131
139
|
## [1.45.5] - 2026-01-29
|
|
132
140
|
- Add HTML rendering support for code interpreter generated files
|
|
@@ -77,7 +77,7 @@ unique_toolkit/agentic/evaluation/context_relevancy/schema.py,sha256=lZd0TPzH43i
|
|
|
77
77
|
unique_toolkit/agentic/evaluation/context_relevancy/service.py,sha256=dsgpfKRSg9B4kjLhHJD_Kath4GVhHE-ZOVAGRkiCz20,8729
|
|
78
78
|
unique_toolkit/agentic/evaluation/evaluation_manager.py,sha256=wDN_Uuut9kEGek8JY3QeInKpF-ukbvOSKOVd7DHFT3Q,8121
|
|
79
79
|
unique_toolkit/agentic/evaluation/exception.py,sha256=7lcVbCyoN4Md1chNJDFxpUYyWbVrcr9dcc3TxWykJTc,115
|
|
80
|
-
unique_toolkit/agentic/evaluation/hallucination/constants.py,sha256
|
|
80
|
+
unique_toolkit/agentic/evaluation/hallucination/constants.py,sha256=Ed08BS6BUzxwP4ezpqk5Fu3YxbnoinCJc28Bh5MghI4,2505
|
|
81
81
|
unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py,sha256=x5ta2Fum4fE5ySgIXPKlnbTtmV140z0IazSATd0-REg,4092
|
|
82
82
|
unique_toolkit/agentic/evaluation/hallucination/prompts/__init__.py,sha256=4KFYMZsB3fJUKzoiUJE1npZ0gueWgvceB32EUrN-v7A,343
|
|
83
83
|
unique_toolkit/agentic/evaluation/hallucination/prompts/system_prompt.j2,sha256=sDUX6G645Ba40D_qKu4cUI8g-sJOfG8JpZreTNFgf7M,2616
|
|
@@ -89,7 +89,7 @@ unique_toolkit/agentic/evaluation/schemas.py,sha256=m9JMCUmeqP8KhsJOVEzsz6dRXUe1
|
|
|
89
89
|
unique_toolkit/agentic/evaluation/tests/fixtures.py,sha256=Q-ughTfDiAdsMKbBVGzFiBucFdAx-FXgJ9iqp5xMyPs,2801
|
|
90
90
|
unique_toolkit/agentic/evaluation/tests/test_config.py,sha256=p7xFQ7KE_yU8jGpqYA7ntAYe5Vln33wd6nwv3FM9XfI,8327
|
|
91
91
|
unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py,sha256=NcSOyBJ_lqYehtlraZPo9RLutCitTP76kvkuyogSD2A,9477
|
|
92
|
-
unique_toolkit/agentic/evaluation/tests/test_hallucination_constants.py,sha256=
|
|
92
|
+
unique_toolkit/agentic/evaluation/tests/test_hallucination_constants.py,sha256=A77nRcniI7hUf640f1sTvCAibQbJE30ikbz1RX4fltw,20478
|
|
93
93
|
unique_toolkit/agentic/evaluation/tests/test_hallucination_utils.py,sha256=PKyGR073HxT0J_g8626kCURbMSlrMgkg-xPP7dPHD-0,31838
|
|
94
94
|
unique_toolkit/agentic/evaluation/tests/test_output_parser.py,sha256=KfltytmvqnPWLhmZpBXqcRmnlYorw_USwM5rkLVv8so,5179
|
|
95
95
|
unique_toolkit/agentic/evaluation/tests/test_prompt_loaders.py,sha256=zBREdlKf5tdDyB8XSaNgpQv3-tuZJoYteeJrp6WMWDM,11897
|
|
@@ -195,7 +195,7 @@ unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r
|
|
|
195
195
|
unique_toolkit/chat/deprecated/service.py,sha256=CYwzXi7OB0RjHd73CO2jq8SlpdBmDYLatzPFkb5sA0k,6529
|
|
196
196
|
unique_toolkit/chat/functions.py,sha256=rF-WGMW1TXqeatHJSD5uGKwO7BGSEIFlS0VJwfE60O0,47874
|
|
197
197
|
unique_toolkit/chat/rendering.py,sha256=c8YiV9oADRrJQ5A_QBJ4_UFc0NZ-2vVaa7tupoMusso,880
|
|
198
|
-
unique_toolkit/chat/responses_api.py,sha256=
|
|
198
|
+
unique_toolkit/chat/responses_api.py,sha256=r_jywsfVI-Kyzm6R-jFmSQQoFdUSel9mmoNnQYe9cls,15156
|
|
199
199
|
unique_toolkit/chat/schemas.py,sha256=FJGFkTw7SKU_R9l_vWbcANMfBo978KH2X9psq6OIFfg,7048
|
|
200
200
|
unique_toolkit/chat/service.py,sha256=6D00OL4QrGafbOhTaC5zNXaNgg7gS5W_2ePVa4LhqpE,4439
|
|
201
201
|
unique_toolkit/chat/state.py,sha256=Cjgwv_2vhDFbV69xxsn7SefhaoIAEqLx3ferdVFCnOg,1445
|
|
@@ -254,7 +254,7 @@ unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBu
|
|
|
254
254
|
unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
255
255
|
unique_toolkit/smart_rules/compile.py,sha256=Ozhh70qCn2yOzRWr9d8WmJeTo7AQurwd3tStgBMPFLA,1246
|
|
256
256
|
unique_toolkit/test_utilities/events.py,sha256=_mwV2bs5iLjxS1ynDCjaIq-gjjKhXYCK-iy3dRfvO3g,6410
|
|
257
|
-
unique_toolkit-1.45.
|
|
258
|
-
unique_toolkit-1.45.
|
|
259
|
-
unique_toolkit-1.45.
|
|
260
|
-
unique_toolkit-1.45.
|
|
257
|
+
unique_toolkit-1.45.8.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
|
258
|
+
unique_toolkit-1.45.8.dist-info/METADATA,sha256=y8-QbF2LcCdVQbM40ldn9IaBWwOoUdhGxhnYfYEhcyQ,49638
|
|
259
|
+
unique_toolkit-1.45.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
260
|
+
unique_toolkit-1.45.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|