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