Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,12 @@ from llama_index.legacy.llms import OpenAI
|
|
15 |
import sqlite3
|
16 |
|
17 |
# Set up OpenAI API Key
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Function to load database and LLM
|
21 |
def load_db_llm():
|
|
|
15 |
import sqlite3
|
16 |
|
17 |
# Set up OpenAI API Key
|
18 |
+
# Load the OpenAI API key from the environment variable
|
19 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
20 |
+
|
21 |
+
# Check if the API key is set
|
22 |
+
if not openai.api_key:
|
23 |
+
raise ValueError("OPENAI_API_KEY environment variable is not set")
|
24 |
|
25 |
# Function to load database and LLM
|
26 |
def load_db_llm():
|