update knowledge_based_chatglm.py
This commit is contained in:
parent
dfe966ed41
commit
3cbc6aa77c
|
|
@ -10,6 +10,8 @@ from langchain.vectorstores import FAISS
|
||||||
from langchain.document_loaders import UnstructuredFileLoader
|
from langchain.document_loaders import UnstructuredFileLoader
|
||||||
from chatglm_llm import ChatGLM
|
from chatglm_llm import ChatGLM
|
||||||
|
|
||||||
|
chatglm = ChatGLM()
|
||||||
|
|
||||||
|
|
||||||
def init_knowledge_vector_store(filepath):
|
def init_knowledge_vector_store(filepath):
|
||||||
embeddings = HuggingFaceEmbeddings(model_name="GanymedeNil/text2vec-large-chinese", )
|
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)
|
new_question_prompt = PromptTemplate.from_template(condese_propmt_template)
|
||||||
chatglm = ChatGLM()
|
|
||||||
chatglm.history = chat_history
|
chatglm.history = chat_history
|
||||||
knowledge_chain = ChatVectorDBChain.from_llm(
|
knowledge_chain = ChatVectorDBChain.from_llm(
|
||||||
llm=chatglm,
|
llm=chatglm,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue