Skip to main content

chat_completion/
chat_completion.rs

1use lm_studio_api_extended::{Chat, Model, Context, Request};
2
3#[tokio::main]
4async fn main() {
5    let mut chat = Chat::new(
6        Model::Kimiko13b,
7        Context::new(
8            "You're Jarvis – my assistant.", 
9            4090
10        ),
11    );
12
13    let request = Request {
14        messages: vec!["Hello, Jarvis.".into()],
15        context: true,
16        stream: false,
17        ..Default::default()
18    };
19
20    match chat.send(request).await {
21        Ok(Some(res)) => println!("{}", res.text()),
22        Err(e) => eprintln!("Error: {e}"),
23        _ => {}
24    }
25}