Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ embeddings = HuggingFaceEmbeddings(model_name="BAAI/bge-large-en")
|
|
25 |
docsearch = FAISS.load_local("./faiss_index", embeddings)
|
26 |
|
27 |
|
28 |
-
chain = load_qa_chain(OpenAI(), chain_type="stuff",verbose=True)
|
29 |
|
30 |
prompt = "您是回答所有ANSYS软件使用查询的得力助手,如果所问的内容不在范围内,请回答“您提的问题不在本知识库内,请重新提问”,所有问题必需用中文回答"
|
31 |
|
@@ -36,12 +36,9 @@ def predict(message, history):
|
|
36 |
history_openai_format.append({"role": "user", "content": human })
|
37 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
38 |
history_openai_format.append({"role": "user", "content": message})
|
39 |
-
|
40 |
-
response =
|
41 |
-
|
42 |
-
messages= history_openai_format,
|
43 |
-
temperature=1.0,
|
44 |
-
stream=True
|
45 |
)
|
46 |
|
47 |
partial_message = ""
|
|
|
25 |
docsearch = FAISS.load_local("./faiss_index", embeddings)
|
26 |
|
27 |
|
28 |
+
chain = load_qa_chain(OpenAI(temperature=0,model_name="gpt-3.5-turbo", verbose=True), chain_type="stuff",verbose=True)
|
29 |
|
30 |
prompt = "您是回答所有ANSYS软件使用查询的得力助手,如果所问的内容不在范围内,请回答“您提的问题不在本知识库内,请重新提问”,所有问题必需用中文回答"
|
31 |
|
|
|
36 |
history_openai_format.append({"role": "user", "content": human })
|
37 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
38 |
history_openai_format.append({"role": "user", "content": message})
|
39 |
+
docs = docsearch.similarity_search(message)
|
40 |
+
response = chain.run(input_documents=docs, question=message)
|
41 |
+
|
|
|
|
|
|
|
42 |
)
|
43 |
|
44 |
partial_message = ""
|