use anyhow::Result;
use selfware::api::types::Message;
use selfware::api::{ApiClient, ThinkingMode};
use selfware::config::Config;
#[tokio::main]
async fn main() -> Result<()> {
if std::env::var("SELFWARE_DEBUG").is_ok() {
tracing_subscriber::fmt()
.with_env_filter("selfware=debug")
.init();
}
println!("=== Selfware Basic Chat Example ===\n");
let config = Config::load(None)?;
println!("Using endpoint: {}", config.endpoint);
println!("Using model: {}", config.model);
println!();
let client = ApiClient::new(&config)?;
println!("Sending prompt to model...\n");
let messages = vec![
Message::system(
"You are a helpful Rust assistant. Reply directly without using tools or external actions.",
),
Message::user("What's a simple way to check if a number is prime in Rust? Show me the code."),
];
let response = client.chat(messages, None, ThinkingMode::Disabled).await?;
let answer = &response.choices[0].message.content;
println!("Assistant response:\n{}\n", answer);
println!("=== Task Complete ===");
Ok(())
}