Metadata-Version: 2.4
Name: rag-pypi-copy
Version: 0.1.0
Summary: 一个可插拔的模块化 RAG 检索工具包（基于 LangChain + Chroma + BM25）
Author: HD
License: MIT License
        
        Copyright (c) 2026 HD
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: rag,langchain,chroma,bm25,jieba
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jieba>=0.42.1
Requires-Dist: rank-bm25>=0.2.2
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: dashscope>=1.20.0
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: langchain-community>=0.3.0
Requires-Dist: langchain-classic>=1.0.0
Requires-Dist: langchain-chroma>=0.1.0
Requires-Dist: langchain-openai>=0.2.0
Dynamic: license-file

# rag-pypi-copy

<!-- TODO: 修改标题、简介和安装命令里的包名，与 pyproject.toml 中的 name 保持一致 -->

一个可插拔的模块化 RAG 检索工具包，支持查询改写、HyDE、向量检索、BM25 检索、RRF 融合、去重、重排序、相似度阈值筛选、上下文压缩与长上下文重排。

## 安装

```bash
pip install rag-pypi-copy
```

## 快速开始


使用前请准备好环境变量（如 `DASHSCOPE_API_KEY`、`DASHSCOPE_BASE_URL`）：

```python
from rag_pypi_copy import ModularRAG

config = {
    "persist_directory": "./chroma_db",
    "collection_name": "study",
    "embedding_model": "text-embedding-v4",
    "top_k": 5,
    "recall_top_k": 20,
    "pre_retrieval": {
        "enable": True,
        "rewrite_query": False,
        "hyde": False,
    },
    "hybrid_retrieval": {
        "enable": True,
    },
    "post_retrieval": {
        "enable": True,
        "deduplicate": True,
        "rerank": False,
        "similarity_filter": False,
        "compress_context": False,
        "reorder": False,
    },
}

rag = ModularRAG(config)
docs = rag.search("你的问题", top_k=5)
for doc in docs:
    print(doc.page_content)
```


```bash
# 1. 安装打包与上传工具
pip install build twine

# 2. 在 RAG_pypi_copy 目录下构建 .whl 和 .tar.gz
python -m build

# 3. 检查打包产物是否符合 PyPI 规范
twine check dist/*

# 4. 上传到 TestPyPI 测试（推荐先测）
twine upload --repository testpypi dist/*

# 5. 正式上传到 PyPI
twine upload dist/*
```
