Spaces:
Runtime error
Runtime error
DiamondYin
commited on
Commit
•
7230323
1
Parent(s):
550e253
Update app_utils.py
Browse files- app_utils.py +2 -2
app_utils.py
CHANGED
@@ -13,7 +13,7 @@ from langchain.chains import RetrievalQA # RetrievalQA is a class in the langch
|
|
13 |
from langchain.vectorstores import Chroma # Chroma is a class in the langchain.vectorstores module that can be used to store vectors.
|
14 |
from langchain.document_loaders import DirectoryLoader #
|
15 |
from langchain.embeddings.openai import OpenAIEmbeddings # OpenAIGPTEmbeddings
|
16 |
-
from langchain.embeddings import
|
17 |
from langchain.text_splitter import CharacterTextSplitter # CharacterTextSplitter is a class in the langchain.text_splitter module that can be used to split text into chunks.
|
18 |
#import streamlit as st
|
19 |
from langchain.indexes import VectorstoreIndexCreator #导入向量存储索引创建器
|
@@ -76,7 +76,7 @@ def initialize_knowledge_base():
|
|
76 |
# embeddings.append(embedding)
|
77 |
|
78 |
#vStore = np.concatenate(embeddings, axis=0)
|
79 |
-
embedding =
|
80 |
#openAI_embeddings = OpenAIEmbeddings()
|
81 |
vStore = Chroma.from_documents(doc_texts, embedding) #Chroma是一个类,用于存储向量,from_documents是一个方法,用于从文档中创建向量存储器,openAI_embeddings是一个类,用于将文本转换为向量
|
82 |
|
|
|
13 |
from langchain.vectorstores import Chroma # Chroma is a class in the langchain.vectorstores module that can be used to store vectors.
|
14 |
from langchain.document_loaders import DirectoryLoader #
|
15 |
from langchain.embeddings.openai import OpenAIEmbeddings # OpenAIGPTEmbeddings
|
16 |
+
from langchain.embeddings import HuggingFaceEmbeddings
|
17 |
from langchain.text_splitter import CharacterTextSplitter # CharacterTextSplitter is a class in the langchain.text_splitter module that can be used to split text into chunks.
|
18 |
#import streamlit as st
|
19 |
from langchain.indexes import VectorstoreIndexCreator #导入向量存储索引创建器
|
|
|
76 |
# embeddings.append(embedding)
|
77 |
|
78 |
#vStore = np.concatenate(embeddings, axis=0)
|
79 |
+
embedding = HuggingFaceEmbeddings(model_name='shibing624/text2vec-base-chinese')
|
80 |
#openAI_embeddings = OpenAIEmbeddings()
|
81 |
vStore = Chroma.from_documents(doc_texts, embedding) #Chroma是一个类,用于存储向量,from_documents是一个方法,用于从文档中创建向量存储器,openAI_embeddings是一个类,用于将文本转换为向量
|
82 |
|