Spaces:
Runtime error
Runtime error
Update Rag_conversation.py
Browse files- Rag_conversation.py +5 -0
Rag_conversation.py
CHANGED
@@ -12,6 +12,11 @@ from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
|
12 |
|
13 |
# Load environment variables from .env
|
14 |
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# Define the persistent directory
|
17 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
12 |
|
13 |
# Load environment variables from .env
|
14 |
load_dotenv()
|
15 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
16 |
+
|
17 |
+
if not OPENAI_API_KEY:
|
18 |
+
raise ValueError("OPENAI_API_KEY is not set. Please add it via Hugging Face Secrets.")
|
19 |
+
|
20 |
|
21 |
# Define the persistent directory
|
22 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|