feat: build
This commit is contained in:
parent
0ad204747c
commit
8b27dda8ee
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from base_rag import BaseRAG
|
from base_rag import BaseRAG
|
||||||
|
|
||||||
|
|
||||||
class SimpleRAG(BaseRAG):
|
class SimpleRAG(BaseRAG):
|
||||||
def ingest(self, file_path: str):
|
def ingest(self, file_path: str):
|
||||||
documents = self.load_and_split_documents(file_path)
|
documents = self.load_and_split_documents(file_path)
|
||||||
|
@ -12,12 +13,10 @@ class SimpleRAG(BaseRAG):
|
||||||
docs = self.similarity_search(question)
|
docs = self.similarity_search(question)
|
||||||
return f"找到 {len(docs)} 个相关文档"
|
return f"找到 {len(docs)} 个相关文档"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# 本地模型配置
|
# 本地模型配置
|
||||||
config = {
|
config = {"type": "local", "model_name": "sentence-transformers/all-MiniLM-L6-v2"}
|
||||||
"type": "local",
|
|
||||||
"model_name": "sentence-transformers/all-MiniLM-L6-v2"
|
|
||||||
}
|
|
||||||
|
|
||||||
rag = SimpleRAG(embedding_config=config)
|
rag = SimpleRAG(embedding_config=config)
|
||||||
print("RAG初始化完成!")
|
print("RAG初始化完成!")
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
echo "检查并安装构建依赖..."
|
||||||
|
pip install --upgrade pip build twine
|
||||||
|
|
||||||
echo "清理..."
|
echo "清理..."
|
||||||
rm -rf build/ dist/ *.egg-info/
|
rm -rf build/ dist/ *.egg-info/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue