Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from PyPDF2 import PdfReader
|
2 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
3 |
from langchain.embeddings import HuggingFaceEmbeddings
|
4 |
from langchain.text_splitter import CharacterTextSplitter
|
@@ -23,9 +22,10 @@ pinecone.init(
|
|
23 |
index_name="text-index"
|
24 |
|
25 |
embeddings = OpenAIEmbeddings()
|
|
|
26 |
# 加载数据
|
27 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
28 |
-
chain = load_qa_chain(
|
29 |
|
30 |
def predict(message, history):
|
31 |
history_langchain_format = []
|
|
|
|
|
1 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
2 |
from langchain.embeddings import HuggingFaceEmbeddings
|
3 |
from langchain.text_splitter import CharacterTextSplitter
|
|
|
22 |
index_name="text-index"
|
23 |
|
24 |
embeddings = OpenAIEmbeddings()
|
25 |
+
llm = OpenAI(temperature=0,model_name="gpt-3.5-turbo", verbose=True)
|
26 |
# 加载数据
|
27 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
28 |
+
chain = load_qa_chain(llm, chain_type="stuff")
|
29 |
|
30 |
def predict(message, history):
|
31 |
history_langchain_format = []
|