update knowledge_based_chatglm.py

This commit is contained in:
littlepanda0716 2023-04-07 10:11:26 +08:00
parent dfe966ed41
commit 3cbc6aa77c
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,8 @@ from langchain.vectorstores import FAISS
from langchain.document_loaders import UnstructuredFileLoader
from chatglm_llm import ChatGLM
chatglm = ChatGLM()
def init_knowledge_vector_store(filepath):
embeddings = HuggingFaceEmbeddings(model_name="GanymedeNil/text2vec-large-chinese", )
@ -42,7 +44,6 @@ def get_knowledge_based_answer(query, vector_store, chat_history=[]):
----------------
改写后的独立完整的问题"""
new_question_prompt = PromptTemplate.from_template(condese_propmt_template)
chatglm = ChatGLM()
chatglm.history = chat_history
knowledge_chain = ChatVectorDBChain.from_llm(
llm=chatglm,