Skip to main content

Crate sova_ai

Crate sova_ai 

Source
Expand description

AISDK language models for Sova — app.install(Ai::…) / req.ai().

Thin shell over aisdk: install a default model into app state, call it from handlers, or drop down to the full LanguageModelRequest builder. FakeAi records prompts for tests.

use sova_ai::{Ai, AiExt, FakeAi};

let fake = FakeAi::new().stub_text("pong");
app.install(Ai::fake(fake.clone()));

// in a handler:
let out = req.ai().prompt("ping").generate().await?;
assert_eq!(out.text().as_deref(), Some("pong"));

Re-exports§

pub use aisdk;

Modules§

prelude
Common AISDK imports for handlers and agents.

Structs§

Ai
Plugin builder — install with app.install(Ai::…).
AiBound
Fluent call builder (prompt / system / generate / stream_response).
AiClient
Shared AI client in app state (req.state::<AiClient>() / req.ai()).
FakeAi
Laravel-style fake model: stub replies, assert prompts.
SharedModel
Cloneable model handle used as the default for LanguageModelRequest.

Enums§

AiError
Plugin / call errors (maps AISDK failures and missing install config).

Traits§

AiExt
req.ai() — bound to the installed AiClient.

Functions§

stream_to_response
Convert StreamTextResponse into an SSE HTTP response (data: lines = text deltas).