File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
nemoguardrails/library/hallucination Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 36
36
37
37
log = logging .getLogger (__name__ )
38
38
39
- try :
40
- from langchain_openai import OpenAI
41
- except ImportError :
42
- log .warning (
43
- "The langchain_openai module is not installed. Please install it using pip: pip install langchain_openai"
44
- )
45
-
46
39
HALLUCINATION_NUM_EXTRA_RESPONSES = 2
47
40
48
41
@@ -58,6 +51,12 @@ async def check_hallucination(
58
51
59
52
:return: True if hallucination is detected, False otherwise.
60
53
"""
54
+ try :
55
+ from langchain_openai import OpenAI
56
+ except ImportError :
57
+ log .warning (
58
+ "The langchain_openai module is not installed. Please install it using pip: pip install langchain_openai"
59
+ )
61
60
62
61
bot_response = context .get ("bot_message" )
63
62
last_bot_prompt_string = context .get ("_last_bot_prompt" )
You can’t perform that action at this time.
0 commit comments