AI代理框架

一个用Rust编写的轻量级AI代理框架,支持自定义工具、历史管理、流式处理和并行工具执行。

  • by DiscreteTom
  • Rust
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 DiscreteTom/tiny-loop

使用说明

微小环路

Rust中的最小AI代理框架。

⚠️ 早期发展:该项目处于早期阶段,API将频繁更改。

特性

安装

添加到您的 Cargo.toml:

[dependencies]
tiny-loop = "0.5"
serde = { version = "1", features = ["derive"] }
schemars = "1"

快速开始

use tiny_loop::{Agent, llm::OpenAIProvider, tool::tool};

#[tool]
async fn search(
    /// Search query
    query: String
) -> String {
    format!("Results for: {}", query)
}

#[tokio::main]
async fn main() {
    let mut agent = Agent::new(OpenAIProvider::new())
        .system("You are a helpful assistant")
        .tool(search);

    let response = agent.chat("Search for Rust tutorials").await.unwrap();
    println!("{}", response);
}

例子

更新日志