Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,8 @@ import os, logging
|
|
17 |
print("LOGGING")
|
18 |
|
19 |
embeddings = OpenAIEmbeddings()
|
20 |
-
|
|
|
21 |
# vectordb = Chroma.from_documents(documents=documents,
|
22 |
# embedding=embeddings,
|
23 |
# persist_directory=persist_directory)
|
@@ -25,12 +26,16 @@ persist_directory = "vector_db"
|
|
25 |
# vectordb = None
|
26 |
vectordb = Chroma(persist_directory=persist_directory,
|
27 |
embedding_function=embeddings)
|
|
|
28 |
|
29 |
llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo")
|
|
|
30 |
doc_retriever = vectordb.as_retriever()
|
|
|
31 |
hp_qa = RetrievalQA.from_chain_type(llm=llm,
|
32 |
chain_type="stuff",
|
33 |
retriever=doc_retriever)
|
|
|
34 |
|
35 |
def answer_question(query):
|
36 |
return(hp_qa.run(query))
|
|
|
17 |
print("LOGGING")
|
18 |
|
19 |
embeddings = OpenAIEmbeddings()
|
20 |
+
print("Got Embeddings")
|
21 |
+
persist_directory = "./vector_db"
|
22 |
# vectordb = Chroma.from_documents(documents=documents,
|
23 |
# embedding=embeddings,
|
24 |
# persist_directory=persist_directory)
|
|
|
26 |
# vectordb = None
|
27 |
vectordb = Chroma(persist_directory=persist_directory,
|
28 |
embedding_function=embeddings)
|
29 |
+
print("Loaded vector db")
|
30 |
|
31 |
llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo")
|
32 |
+
print("Instatiated OpenAI LLM")
|
33 |
doc_retriever = vectordb.as_retriever()
|
34 |
+
print("Retrieved Docs")
|
35 |
hp_qa = RetrievalQA.from_chain_type(llm=llm,
|
36 |
chain_type="stuff",
|
37 |
retriever=doc_retriever)
|
38 |
+
print("Made hp_qa")
|
39 |
|
40 |
def answer_question(query):
|
41 |
return(hp_qa.run(query))
|