unique_toolkit 1.17.0__py3-none-any.whl → 1.17.1__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.

Potentially problematic release.


This version of unique_toolkit might be problematic. Click here for more details.

@@ -1,3 +1,5 @@
1
+ import regex as re
2
+
1
3
  from unique_toolkit.agentic.evaluation.evaluation_manager import Evaluation
2
4
  from unique_toolkit.agentic.evaluation.hallucination.constants import (
3
5
  HallucinationConfig,
@@ -40,13 +42,20 @@ class HallucinationEvaluation(Evaluation):
40
42
  async def run(
41
43
  self, loop_response: LanguageModelStreamResponse
42
44
  ) -> EvaluationMetricResult: # type: ignore
43
- chunks = self._reference_manager.get_latest_referenced_chunks()
45
+ all_chunks = self._reference_manager.get_chunks()
46
+ # source numbers from original text
47
+ ref_pattern = r"\[source(\d+)\]"
48
+ original_text = loop_response.message.original_text
49
+ source_number_matches = re.findall(ref_pattern, original_text)
50
+ source_numbers = {int(num) for num in source_number_matches}
51
+
52
+ referenced_chunks = [all_chunks[idx] for idx in source_numbers]
44
53
 
45
54
  evaluation_result: EvaluationMetricResult = await check_hallucination(
46
55
  company_id=self._company_id,
47
56
  input=EvaluationMetricInput(
48
57
  input_text=self._user_message,
49
- context_texts=[context.text for context in chunks],
58
+ context_texts=[context.text for context in referenced_chunks],
50
59
  history_messages=[], # TODO include loop_history messages
51
60
  output_text=loop_response.message.text,
52
61
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.17.0
3
+ Version: 1.17.1
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,8 @@ 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.17.1] - 2025-10-23
122
+ - Fix hallucination check input with all cited reference chunks.
121
123
  ## [1.17.0] - 2025-10-22
122
124
  - Add more options to display sub agent answers in the chat.
123
125
 
@@ -35,7 +35,7 @@ unique_toolkit/agentic/evaluation/context_relevancy/service.py,sha256=2NM1_PCP6f
35
35
  unique_toolkit/agentic/evaluation/evaluation_manager.py,sha256=IPx4BVUgkjFOP1BGLi0BlB6UujpXlZ0KGuSXDRemQhY,8143
36
36
  unique_toolkit/agentic/evaluation/exception.py,sha256=7lcVbCyoN4Md1chNJDFxpUYyWbVrcr9dcc3TxWykJTc,115
37
37
  unique_toolkit/agentic/evaluation/hallucination/constants.py,sha256=SoGmoYti2J33tSmmOC1BSF6Pkh8DQvbQAU9xIZFQZRs,2070
38
- unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py,sha256=yMcfA7iMNXkneNrFxJuoDIoB37mK8IRXEKnPsK_UDOk,3454
38
+ unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py,sha256=JPSBr9JvufeKpIyiscaWCUqpJB5E7Z8ftKUPdbdp6XE,3829
39
39
  unique_toolkit/agentic/evaluation/hallucination/prompts.py,sha256=O3Hi_rOzZlujvnO2wn2jhoPmrYLjzVtRWwxn5Q81m9Y,3405
40
40
  unique_toolkit/agentic/evaluation/hallucination/service.py,sha256=Ut-f768HY4E9zEhfMoKYnGTFRZVkxWGiSTGOpgfZWYM,2447
41
41
  unique_toolkit/agentic/evaluation/hallucination/utils.py,sha256=QLsYvgAyQ5XnKEzn7ko7bXfzePD4De99TWnMKglMpds,8178
@@ -165,7 +165,7 @@ unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBu
165
165
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  unique_toolkit/smart_rules/compile.py,sha256=Ozhh70qCn2yOzRWr9d8WmJeTo7AQurwd3tStgBMPFLA,1246
167
167
  unique_toolkit/test_utilities/events.py,sha256=_mwV2bs5iLjxS1ynDCjaIq-gjjKhXYCK-iy3dRfvO3g,6410
168
- unique_toolkit-1.17.0.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
169
- unique_toolkit-1.17.0.dist-info/METADATA,sha256=PYwLfd-0CZuOMVJF-0qHp8eJMT0hH50fVHrIFAWwNLI,37929
170
- unique_toolkit-1.17.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
171
- unique_toolkit-1.17.0.dist-info/RECORD,,
168
+ unique_toolkit-1.17.1.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
169
+ unique_toolkit-1.17.1.dist-info/METADATA,sha256=D7xtrTsj4TmyJ0beu7DX3LgK1mPLQG2Iyr0aOVO_Fh4,38019
170
+ unique_toolkit-1.17.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
171
+ unique_toolkit-1.17.1.dist-info/RECORD,,