#![allow(unused)]
use kalosm::language::*;
#[derive(Schema, Parse, Clone, Debug)]
struct Account {
summary: String,
name: String,
#[parse(range = 1..=100)]
age: u8,
}
#[tokio::main]
async fn main() {
let source = loop {
let input =
prompt_input("Model (choose from qwen-1.5b, qwen-7b, qwen-14b, llama-8b): ").unwrap();
match input.as_str() {
"qwen-1.5b" => break LlamaSource::deepseek_r1_distill_qwen_1_5b(),
"qwen-7b" => break LlamaSource::deepseek_r1_distill_qwen_7b(),
"qwen-14b" => break LlamaSource::deepseek_r1_distill_qwen_14b(),
"llama-8b" => break LlamaSource::deepseek_r1_distill_llama_8b(),
_ => println!("Invalid model... try again"),
}
};
let llm = Llama::builder().with_source(source).build().await.unwrap();
let task = llm.task("You generate accounts based on a description of the account holder in this format { \"summary\": \"A summary of the account holder\", \"name\": \"The name of the account holder\", \"age\": numericAgeInYears }");
let mut response = task("Candice is the CEO of a fortune 500 company. She is a 30 years old.")
.with_constraints(
LiteralParser::new("<think>")
.then(StopOn::new("</think>"))
.ignore_output_then(Account::new_parser()),
);
response.to_std_out().await.unwrap();
println!("\n\n");
let account = response.await.unwrap();
println!("{account:#?}");
}