Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -625,14 +625,16 @@ texts = text_splitter.split_text(state_of_the_union)
|
|
625 |
|
626 |
embeddings = OpenAIEmbeddings()
|
627 |
vectorstore = FAISS.from_texts(texts, embeddings)
|
628 |
-
qa = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=vectorstore)
|
|
|
|
|
629 |
|
630 |
from langchain.chains import load_chain
|
631 |
|
632 |
chain = load_chain("lc://chains/vector-db-qa/stuff/chain.json", vectorstore=vectorstore)
|
633 |
|
634 |
def run_chain(query):
|
635 |
-
return chain.run(query
|
636 |
|
637 |
inputs = gr.inputs.Textbox(lines=1, label="Enter your Question:")
|
638 |
outputs = gr.outputs.Textbox(label="Answer:")
|
|
|
625 |
|
626 |
embeddings = OpenAIEmbeddings()
|
627 |
vectorstore = FAISS.from_texts(texts, embeddings)
|
628 |
+
qa = VectorDBQA.from_chain_type(llm=OpenAI(model_name="text-davinci-003", temperature=0, max_tokens=256), chain_type="stuff", vectorstore=vectorstore)
|
629 |
+
#llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0, max_tokens=256) # Modify model_name if you have access to GPT-4
|
630 |
+
|
631 |
|
632 |
from langchain.chains import load_chain
|
633 |
|
634 |
chain = load_chain("lc://chains/vector-db-qa/stuff/chain.json", vectorstore=vectorstore)
|
635 |
|
636 |
def run_chain(query):
|
637 |
+
return chain.run(query)
|
638 |
|
639 |
inputs = gr.inputs.Textbox(lines=1, label="Enter your Question:")
|
640 |
outputs = gr.outputs.Textbox(label="Answer:")
|