Skip to content

Commit e3beac6

Browse files
passing hallucination score to modify the new prompt dynamically
1 parent 12cc161 commit e3beac6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

aimon/extensions/react.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ def react( llm_app,
4444
if x['adherence'] == False:
4545
failed_instructions.append(x['instruction'])
4646

47+
hallucination_score = aimon_response.detect_response.hallucination['score']
48+
4749
## Check whether the hallucination score is greater than the required threshold OR if any of the supplied instructions are not complied with
4850
if react_configuration.hallucination_threshold > 0 and \
49-
(aimon_response.detect_response.hallucination['score'] > react_configuration.hallucination_threshold or len(failed_instructions)>0):
51+
(hallucination_score > react_configuration.hallucination_threshold or len(failed_instructions)>0):
5052

51-
llm_response = llm_app(user_query, user_instructions, reprompted_flag=True)
53+
llm_response = llm_app(user_query, user_instructions, reprompted_flag=True, hallucination_score=hallucination_score)
5254

5355
_, _, _, query_result, aimon_response = context_extractor(user_query, user_instructions, llm_response)
5456

0 commit comments

Comments
 (0)