Spaces:
Runtime error
Runtime error
Shaileshshantaram Kadam commited on
Commit ·
eab5ad9
1
Parent(s): c9d8906
Updated app
Browse files- query_data.py +5 -8
- requirements.txt +1 -1
query_data.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from langchain.prompts.prompt import PromptTemplate
|
| 2 |
from langchain.llms import OpenAI
|
| 3 |
-
from langchain.chains import
|
| 4 |
|
| 5 |
_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
|
| 6 |
You can assume the question about the most recent state of the union address.
|
|
@@ -25,13 +25,10 @@ QA_PROMPT = PromptTemplate(template=template, input_variables=["question", "cont
|
|
| 25 |
|
| 26 |
def get_chain(vectorstore):
|
| 27 |
llm = OpenAI(temperature=0)
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
qa_chain = ConversationalRetrievalChain(
|
| 32 |
-
retriever=llm,
|
| 33 |
-
vectorstore=vectorstore,
|
| 34 |
qa_prompt=QA_PROMPT,
|
| 35 |
condense_question_prompt=CONDENSE_QUESTION_PROMPT,
|
| 36 |
)
|
| 37 |
-
return qa_chain
|
|
|
|
| 1 |
from langchain.prompts.prompt import PromptTemplate
|
| 2 |
from langchain.llms import OpenAI
|
| 3 |
+
from langchain.chains import ChatVectorDBChain
|
| 4 |
|
| 5 |
_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
|
| 6 |
You can assume the question about the most recent state of the union address.
|
|
|
|
| 25 |
|
| 26 |
def get_chain(vectorstore):
|
| 27 |
llm = OpenAI(temperature=0)
|
| 28 |
+
qa_chain = ChatVectorDBChain.from_llm(
|
| 29 |
+
llm,
|
| 30 |
+
vectorstore,
|
|
|
|
|
|
|
|
|
|
| 31 |
qa_prompt=QA_PROMPT,
|
| 32 |
condense_question_prompt=CONDENSE_QUESTION_PROMPT,
|
| 33 |
)
|
| 34 |
+
return qa_chain
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
langchain
|
| 2 |
openai
|
| 3 |
unstructured
|
| 4 |
faiss-cpu
|
|
|
|
| 1 |
+
langchain==0.0.124
|
| 2 |
openai
|
| 3 |
unstructured
|
| 4 |
faiss-cpu
|