Update app.py
Browse files
app.py
CHANGED
@@ -43,13 +43,9 @@ docsearch = FAISS.load_local("./faiss_index", embeddings)
|
|
43 |
|
44 |
|
45 |
|
46 |
-
template="您是回答ANSYS软件使用查询的得力助手,所有回复必需用中文
|
47 |
-
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
|
48 |
-
human_template="{text}"
|
49 |
-
human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)
|
50 |
|
51 |
-
|
52 |
-
chain = load_qa_chain(OpenAI(temperature=0,model_name="gpt-3.5-turbo",prompt=chat_prompt), chain_type="stuff",verbose=True)
|
53 |
|
54 |
|
55 |
def predict(message, history):
|
@@ -60,7 +56,7 @@ def predict(message, history):
|
|
60 |
history_langchain_format.append(AIMessage(content=ai))
|
61 |
history_langchain_format.append(HumanMessage(content=message))
|
62 |
docs = docsearch.similarity_search(message)
|
63 |
-
response = chain.run(input_documents=docs, question=message)
|
64 |
|
65 |
|
66 |
partial_message = ""
|
|
|
43 |
|
44 |
|
45 |
|
46 |
+
template="您是回答ANSYS软件使用查询的得力助手,所有回复必需用中文"
|
|
|
|
|
|
|
47 |
|
48 |
+
chain = load_qa_chain(OpenAI(temperature=0,model_name="gpt-3.5-turbo"), chain_type="stuff",verbose=True)
|
|
|
49 |
|
50 |
|
51 |
def predict(message, history):
|
|
|
56 |
history_langchain_format.append(AIMessage(content=ai))
|
57 |
history_langchain_format.append(HumanMessage(content=message))
|
58 |
docs = docsearch.similarity_search(message)
|
59 |
+
response = chain.run(input_documents=docs, question=message+template)
|
60 |
|
61 |
|
62 |
partial_message = ""
|