diff --git a/examples/quick_start.py b/examples/quick_start.py index 2d704dc..3274c09 100644 --- a/examples/quick_start.py +++ b/examples/quick_start.py @@ -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) diff --git a/scripts/build.sh b/scripts/build.sh index cdbe652..d0c4d46 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -3,6 +3,9 @@ set -e +echo "检查并安装构建依赖..." +pip install --upgrade pip build twine + echo "清理..." rm -rf build/ dist/ *.egg-info/