Skip to main content

sutegi_ai/
lib.rs

1//! Agent-facing surface for sutegi.
2//!
3//! Tools are now a **core** concept: register them directly on the app with
4//! [`App::tool`](sutegi_web::App::tool) / [`App::stream_tool`], and describe
5//! their inputs with the [`schema`] helpers. sutegi validates each call's
6//! arguments against the declared schema, mounts `POST /__tools/:name`
7//! (and `/__tools/:name/stream` for SSE), and lists everything in the
8//! `/__tools` manifest and `/__introspect`.
9//!
10//! ```ignore
11//! use sutegi::prelude::*;
12//!
13//! App::new("assistant")
14//!     .state(db)
15//!     .tool("create_todo", "Create a todo",
16//!         schema::object(vec![("title", schema::string("the title"))], &["title"]),
17//!         |c, args| {
18//!             let todo: Todo = Todo::from_row(&args)?;   // args are validated
19//!             let id = todo.save(c.db::<Db>())?;
20//!             Ok(Todo { id, ..todo }.to_json())
21//!         })
22//!     .serve()
23//! ```
24//!
25//! This crate re-exports that surface so the `sutegi::ai::…` path keeps working
26//! and is the home for future LLM-client helpers.
27
28pub use sutegi_web::schema;
29pub use sutegi_web::{Ctx, ToolCtx};