File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed 
nemoguardrails/library/hallucination Expand file tree Collapse file tree 1 file changed +8
-1
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):
@@ -72,6 +72,13 @@ async def self_check_hallucination(
7272 f"Current LLM engine is { type (llm ).__name__ }  , which may not support all features." 
7373 )
7474
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 
81+ 
7582 # Use the "generate" call from langchain to get all completions in the same response. 
7683 last_bot_prompt  =  PromptTemplate (template = "{text}" , input_variables = ["text" ])
7784 chain  =  LLMChain (prompt = last_bot_prompt , llm = llm )
                                 You can’t perform that action at this time. 
               
                  
0 commit comments