use std::pin::Pin;
use areev::{Areev, ChatExecutors, Result};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<()> {
let areev = Areev::from_env();
let mut executors: ChatExecutors = ChatExecutors::new();
executors.insert(
"get_weather",
Box::new(|_name, args| {
Pin::from(Box::new(async move {
let city = args
.get("city")
.and_then(|v| v.as_str())
.unwrap_or("unknown");
Ok(json!({
"city": city,
"temp_c": 22,
"conditions": "sunny",
}))
}))
}),
);
let response = areev
.harness()
.chat_interactive(
"weather-harness",
"conv-example-1",
"What's the weather in Paris?",
&executors,
)
.await?;
println!("assistant: {}", response.text);
println!(
"iterations={} tool_calls={} provider={}",
response.iterations,
response.tool_calls.len(),
response.provider
);
Ok(())
}