use seedframe::prelude::*;
use seedframe::providers::completions::OpenAI;
#[client(
provider = "OpenAI",
config = "{\"model\": \"gpt-4o-mini\"}",
tools("capitalize", "greet")
)]
struct SimpleClient;
#[tool]
fn greet(name: String, mood: String) {
println!("Hello {name}! I see you're feeling {mood}.");
}
#[tool]
fn capitalize(input: String, State(state): State<AppState>) -> String {
format!(
"capitalize: {}, state: {}",
input.to_uppercase(),
state.some_number,
)
}
#[derive(Debug)]
struct AppState {
some_number: i32,
}
#[tokio::main]
async fn main() -> Result<(), seedframe::error::Error> {
let mut client = SimpleClient::build("You are a helpful assistant")
.await
.with_state(AppState { some_number: 3 })?;
client
.prompt("Capitalize the word 'capital'")
.append_tool_response(true)
.send()
.await?;
dbg!(client.export_history());
Ok(())
}