1 unstable release

0.0.1 Jan 20, 2024

#8 in #mistral

Apache-2.0

9KB
187 lines

Rust Mistral Client (WIP)

Usage

Make sure to set the MISTRAL_API_KEY environment variable.

use mistral_api::{ChatCompletion, Query};
use reqwest::Client;

async fn main () {
    let client = Client::new();
    
    let mut completion = ChatCompletion::builder()
        .build("mistral-tiny");
        
    completion.append_message(
        Message{
            role: MessageRole::User,
            content: "Say Hello!".to_string(),
        }
    );
    
    let rsp = completion.query(&client).await.unwrap();
    println!("{:?}", rsp);
}

Dependencies

~4–19MB
~256K SLoC