Skip to main content

SAGE RAG Framework - Document loaders, chunkers, retrievers for RAG pipelines

Project description

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_storeembedding_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

📧 联系

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isage_rag-0.2.0-py2.py3-none-any.whl (77.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file isage_rag-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: isage_rag-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 77.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for isage_rag-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0f479783a62b30b77dc475aa04b33775b7dd9eac4092a46e3bd5b696e8d74ab5
MD5 7d293adf466feef1fa34e649c4d793b7
BLAKE2b-256 829361207c5e3b0f0a13f9874b49f077efc01dacce49ab4346c0cf20d5e4a1f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page