use daimon::prelude::*;
#[tool_fn]
async fn add(
a: f64,
b: f64,
) -> daimon::Result<ToolOutput> {
Ok(ToolOutput::text(format!("{}", a + b)))
}
#[tool_fn]
async fn to_uppercase(
text: String,
) -> daimon::Result<ToolOutput> {
Ok(ToolOutput::text(text.to_uppercase()))
}
#[tokio::main]
async fn main() -> daimon::Result<()> {
let agent = Agent::builder()
.model(daimon::model::openai::OpenAi::new("gpt-4o"))
.system_prompt("You are a helpful assistant. Use tools when needed.")
.tool(Add)
.tool(ToUppercase)
.build()?;
let response = agent.prompt("What is 42 + 58?").await?;
println!("{}", response.text());
Ok(())
}