rag-pypi-copy
一个可插拔的模块化 RAG 检索工具包,支持查询改写、HyDE、向量检索、BM25 检索、RRF 融合、去重、重排序、相似度阈值筛选、上下文压缩与长上下文重排。
安装
pip install rag-pypi-copy
快速开始
使用前请准备好环境变量(如 DASHSCOPE_API_KEY、DASHSCOPE_BASE_URL):
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)
# 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/*
Metadata
Release files for rag-pypi-copy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rag_pypi_copy-0.1.0.tar.gz | 9.9 kB | Without provenance | Details for rag_pypi_copy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rag_pypi_copy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rag_pypi_copy-0.1.0-py3-none-any.whl |
Total release size: 19.0 kB
Release files / rag_pypi_copy-0.1.0.tar.gz
| Download URL | rag_pypi_copy-0.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b02797d2ce6ad6a39a266e2418f1435600d0e796a9a5f66059d2d4ec8c152165
|
|
BLAKE2b-256 checksum How to use checksums |
35d209ad5ea1f7357009f2f7e91ad1c8a1bf3c0d6b7b425b3635d527ac71acd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rag_pypi_copy-0.1.0-py3-none-any.whl
| Download URL | rag_pypi_copy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce86c71d9321bc526203c7ec5b4001c03e6d202c425ed5aecb187ab101fd16e3
|
|
BLAKE2b-256 checksum How to use checksums |
a8c90dd816003a0ce60b4488f5274c6505d80e71e7ae0e52d2373708d9950077
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for rag-pypi-copy 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.