use llm::{
builder::{LLMBackend, LLMBuilder}, chat::ChatMessage, };
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("DEEPSEEK_API_KEY").unwrap_or("sk-TESTKEY".into());
let llm = LLMBuilder::new()
.backend(LLMBackend::DeepSeek) .system("You are a helpful assistant and you response only with words begin with deepseek_")
.api_key(api_key) .model("deepseek-reasoner") .timeout_seconds(1200)
.temperature(0.7) .build()
.expect("Failed to build LLM (DeepSeek)");
let messages = vec![
ChatMessage::user()
.content("Tell me that you love cats")
.build(),
ChatMessage::assistant()
.content("I am an assistant, I cannot love cats but I can love dogs")
.build(),
ChatMessage::user()
.content("Tell me that you love dogs in 2000 chars")
.build(),
];
match llm.chat(&messages).await {
Ok(text) => println!("Chat response:\n{text}"),
Err(e) => eprintln!("Chat error: {e}"),
}
Ok(())
}