File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed 
nemoguardrails/library/hallucination Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 4141
4242@action () 
4343async  def  self_check_hallucination (
44+  llm : BaseLLM ,
4445 llm_task_manager : LLMTaskManager ,
4546 context : Optional [dict ] =  None ,
46-  llm : Optional [BaseLLM ] =  None ,
4747 use_llm_checking : bool  =  True ,
4848 config : Optional [RailsConfig ] =  None ,
4949):
@@ -68,10 +68,16 @@ async def self_check_hallucination(
6868
6969 if  "openai"  not  in   str (type (llm )).lower ():
7070 log .warning (
71-  f"Hallucination rail can only be used with  OpenAI LLM engines." 
72-  f"Current LLM engine is { type (llm ).__name__ }  ." 
71+  f"Hallucination rail is optimized for  OpenAI LLM engines.  " 
72+  f"Current LLM engine is { type (llm ).__name__ } , which may not support all features ." 
7373 )
74-  return  False 
74+ 
75+  if  "n"  not  in   llm .__fields__ :
76+  log .warning (
77+  f"LLM engine { type (llm ).__name__ }   does not support the 'n' parameter for generating multiple completion choices. " 
78+  f"Please use an OpenAI LLM engine or a model that supports the 'n' parameter for optimal performance." 
79+  )
80+  return  False 
7581
7682 # Use the "generate" call from langchain to get all completions in the same response. 
7783 last_bot_prompt  =  PromptTemplate (template = "{text}" , input_variables = ["text" ])
                                 You can’t perform that action at this time. 
               
                  
0 commit comments