jybae commited on
Commit
06f91b0
1 Parent(s): b7ba7a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -16,7 +16,11 @@ from langchain_openai import OpenAIEmbeddings
16
  from langchain_openai import ChatOpenAI
17
 
18
  # Load the FAISS index from the .pkl file
19
- embeddings = OpenAIEmbeddings()
 
 
 
 
20
  db = FAISS.load_local("faiss_index", embeddings,allow_dangerous_deserialization=True)
21
 
22
  def get_response_from_query(db, query, k=3):
 
16
  from langchain_openai import ChatOpenAI
17
 
18
  # Load the FAISS index from the .pkl file
19
+ openai_api_key = os.getenv("OPENAI_API_KEY")
20
+ if not openai_api_key:
21
+ raise ValueError("OPENAI_API_KEY environment variable is not set.")
22
+
23
+ embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
24
  db = FAISS.load_local("faiss_index", embeddings,allow_dangerous_deserialization=True)
25
 
26
  def get_response_from_query(db, query, k=3):