Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,10 @@ from langchain.vectorstores import FAISS
|
|
| 16 |
from langchain.chains import RetrievalQA
|
| 17 |
import gradio as gr
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Step 1: Load the System Prompt
|
| 20 |
prompt_path = "system_prompt.txt" # Ensure this file is in the same directory
|
| 21 |
if not os.path.exists(prompt_path):
|
|
@@ -56,9 +60,7 @@ if len(texts) != len(metadatas):
|
|
| 56 |
raise ValueError("Mismatch between texts and metadata after preprocessing.")
|
| 57 |
|
| 58 |
|
| 59 |
-
|
| 60 |
-
openai_api_key = os.getenv("tauhid")
|
| 61 |
-
print(f"API key retrieved: {'[NOT FOUND]' if not openai_api_key else '[FOUND - first 4 chars: ' + openai_api_key[:4] + ']'}")
|
| 62 |
|
| 63 |
# Step 4: Create the Vector Store
|
| 64 |
embeddings = OpenAIEmbeddings()
|
|
|
|
| 16 |
from langchain.chains import RetrievalQA
|
| 17 |
import gradio as gr
|
| 18 |
|
| 19 |
+
# Step 5: Initialize the LLM
|
| 20 |
+
openai_api_key = os.getenv("tauhid")
|
| 21 |
+
print(f"API key retrieved: {'[NOT FOUND]' if not openai_api_key else '[FOUND - first 4 chars: ' + openai_api_key[:4] + ']'}")
|
| 22 |
+
|
| 23 |
# Step 1: Load the System Prompt
|
| 24 |
prompt_path = "system_prompt.txt" # Ensure this file is in the same directory
|
| 25 |
if not os.path.exists(prompt_path):
|
|
|
|
| 60 |
raise ValueError("Mismatch between texts and metadata after preprocessing.")
|
| 61 |
|
| 62 |
|
| 63 |
+
|
|
|
|
|
|
|
| 64 |
|
| 65 |
# Step 4: Create the Vector Store
|
| 66 |
embeddings = OpenAIEmbeddings()
|