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 Distribution

isage_rag-0.3.0.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

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

isage_rag-0.3.0-py2.py3-none-any.whl (78.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file isage_rag-0.3.0.tar.gz.

File metadata

  • Download URL: isage_rag-0.3.0.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for isage_rag-0.3.0.tar.gz
Algorithm Hash digest
SHA256 14394314191702de8921426f36d1aba9c137719378008a385ed23a12ddf83d81
MD5 a498bbdf9fd34aa9f6449b5b1d93bc7e
BLAKE2b-256 985144e8623d05f3e2e2f8eae01363ac9d2aee8b9a251b1172ec6726ab45af5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: isage_rag-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 78.8 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.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9d6ddf01ad7db564cc5adf501a8da41a1d1f1b8c56a30ca5aebff6a6c0feb2dd
MD5 07eec93bd3256ef8b4fa02d0b0c0a8e5
BLAKE2b-256 9d8cb959263910ae13364b758264633e258c592ed9415df6345f778fe115d3dc

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