Skip to main content

SAGE RAG

PyPI version Python 3.10+ License

RAG (Retrieval-Augmented Generation) 组件库,提供文档加载、文本分块、检索和重排序功能。

🧭 边界说明(L3)

sage-rag 作为 L3 算法组件仓库,职责边界如下:

  • In-scope(本仓库负责)
    • 文档加载(loaders)
    • 文本切分(chunkers)
    • 检索与重排实现(retrievers / rerankers)
    • RAG pipeline 组合逻辑(pipelines)
  • Out-of-scope(不在本仓库实现)
    • 中间件/服务绑定能力(例如数据库服务编排、集群调度)
    • L4/L5 运行时和平台层实现
  • Forbidden imports(禁止越层依赖)
    • sage.middleware
    • sage.kernel
    • sage.platform

边界与依赖审计 ADR:

  • docs/adr/0001-l3-boundary-convergence.md
  • docs/adr/0002-pipeline-boundary-cleanup.md
  • docs/adr/0003-retriever-reranker-contracts.md
  • docs/adr/0004-phase1-dependency-audit.md

📦 安装

pip install isage-rag

🚀 快速开始

# 直接导入使用
from sage_rag import TextLoader, SentenceChunker

loader = TextLoader()
documents = loader.load("document.txt")

chunker = SentenceChunker()
chunks = chunker.chunk(documents)

📚 组件

  • Loaders: TextLoader, MarkdownLoader
  • Chunkers: SentenceChunker, TokenChunker
  • Retrievers: DenseRetriever
  • Rerankers: CrossEncoderReranker
  • Pipelines: SimpleRAGPipeline

DenseRetriever 需要显式提供 vector_store 与 embedding_model 后才能执行 index/retrieve/delete_documents。

详细文档请查看 docs/ 目录。

🔌 与 SAGE 集成

本包可以自动注册到 SAGE 框架:

import sage_rag  # 自动注册
from sage.libs.rag import create_loader

loader = create_loader("text")

📄 许可证

MIT License - 详见 LICENSE

📧 联系

Metadata

Release files for isage-rag 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isage-rag 0.3.0
File Size Uploaded
isage_rag-0.3.0.tar.gz 58.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for isage-rag 0.3.0
File Interpreter ABI Platform
isage_rag-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 137.7 kB

Release files / isage_rag-0.3.0.tar.gz

Download URL isage_rag-0.3.0.tar.gz
Size 58.8 kB
Tags Source
SHA-256 checksum
How to use checksums
14394314191702de8921426f36d1aba9c137719378008a385ed23a12ddf83d81
BLAKE2b-256 checksum
How to use checksums
985144e8623d05f3e2e2f8eae01363ac9d2aee8b9a251b1172ec6726ab45af5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / isage_rag-0.3.0-py2.py3-none-any.whl

Download URL isage_rag-0.3.0-py2.py3-none-any.whl
Size 78.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9d6ddf01ad7db564cc5adf501a8da41a1d1f1b8c56a30ca5aebff6a6c0feb2dd
BLAKE2b-256 checksum
How to use checksums
9d8cb959263910ae13364b758264633e258c592ed9415df6345f778fe115d3dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

1 release file

0.1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page