环境要求
- 操作系统:Linux / macOS / Windows (WSL)
- Python版本:≥ 3.11.10
- 包管理器:Conda (推荐)
安装SAGE
使用Wheel方法安装(推荐)
验证安装
检查安装状态和版本信息
运行示例
执行hello_world.py验证功能
构建管道
使用Fluent API构建您的第一个管道
# 1. 下载并安装SAGE wheel包
pip install sage-0.1.2-cp311-cp311-linux_x86_64.whl
# 2. 验证安装
pip show sage-framework
# 3. 运行Hello World示例
python hello_world.py
# 1. 克隆仓库
git clone https://github.com/intellistream/SAGE.git
cd SAGE
# 2. 创建conda环境
conda create -n sage python=3.11.10
conda activate sage
# 3. 安装依赖
pip install -r requirements.txt
# 4. 开发模式安装
pip install -e .
# 创建您的第一个RAG管道
from sage import Environment, FileSource, DenseRetriever, QAPromptor, OpenAIGenerator
# 初始化环境
pipeline = Environment(name="my_first_rag_pipeline")
# 构建声明式管道
result = (pipeline
.from_source(FileSource, {"path": "documents/"})
.map(DenseRetriever, {"model": "sentence-transformers/all-MiniLM-L6-v2"})
.map(QAPromptor, {"template": "基于以下内容回答问题: {context}\n问题: {query}"})
.map(OpenAIGenerator, {"model": "gpt-3.5-turbo"})
.execute({"query": "什么是SAGE?"})
)
print(result)