Merge pull request #28 from lastrei/master

根据4.7日更新代码,解决冲突
This commit is contained in:
imClumsyPanda 2023-04-07 12:22:22 +08:00 committed by GitHub
commit 9bb7c219ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -10,11 +10,16 @@ from langchain.vectorstores import FAISS
from langchain.document_loaders import UnstructuredFileLoader
from chatglm_llm import ChatGLM
embedding_model_dict = {
"ernie-tiny": "nghuyong/ernie-3.0-nano-zh",
"ernie-base": "nghuyong/ernie-3.0-base-zh",
"text2vec": "GanymedeNil/text2vec-large-chinese"
}
chatglm = ChatGLM()
def init_knowledge_vector_store(filepath):
embeddings = HuggingFaceEmbeddings(model_name="GanymedeNil/text2vec-large-chinese", )
embeddings = HuggingFaceEmbeddings(model_name=embedding_model_dict["text2vec"], )
loader = UnstructuredFileLoader(filepath, mode="elements")
docs = loader.load()