@@ -32,8 +32,8 @@ def create_payload(self, context, user_query, user_instructions, generated_text)
32
32
}
33
33
34
34
aimon_payload ['publish' ] = self .react_configuration .publish
35
- aimon_payload ['config' ] = { 'hallucination' : {'detector_name' : 'default' },
36
- 'instruction_adherence' : {'detector_name' : 'default' },}
35
+ aimon_payload ['config' ] = { 'hallucination' : {'detector_name' : 'default' },}
36
+ # 'instruction_adherence': {'detector_name': 'default'},}
37
37
38
38
if self .react_configuration .publish :
39
39
aimon_payload ['application_name' ] = self .react_configuration .application_name
@@ -84,16 +84,19 @@ def react(self, user_query, user_instructions,):
84
84
85
85
for _ in range (self .react_configuration .max_attempts ):
86
86
87
- failed_instructions = []
88
- ## Loop to check for failed instructions
89
- for x in detect_response .instruction_adherence ['results' ]:
90
- if x ['adherence' ] == False :
91
- failed_instructions .append (x ['instruction' ])
87
+ # failed_instructions = []
88
+ # # # Loop to check for failed instructions
89
+ # for x in detect_response.instruction_adherence['results']:
90
+ # if x['adherence'] == False:
91
+ # failed_instructions.append(x['instruction'])
92
92
93
93
## Check whether the hallucination score is greater than the required threshold OR if any of the supplied instructions are not complied with
94
- if self .react_configuration .hallucination_threshold > 0 and \
95
- (hallucination_score > self .react_configuration .hallucination_threshold or len (failed_instructions )> 0 ):
94
+ # if self.react_configuration.hallucination_threshold > 0 and \
95
+ # (hallucination_score > self.react_configuration.hallucination_threshold or len(failed_instructions)>0):
96
96
97
+ if self .react_configuration .hallucination_threshold > 0 and \
98
+ hallucination_score > self .react_configuration .hallucination_threshold :
99
+
97
100
llm_response = self .llm_app (user_query , user_instructions , reprompted_flag = True , hallucination_score = hallucination_score )
98
101
99
102
context = self .context_extractor (user_query , user_instructions , llm_response )
0 commit comments