mistral-api

Crates.iomistral-api
lib.rsmistral-api
version0.0.1
sourcesrc
created_at2024-01-20 14:54:34.763908
updated_at2024-01-20 14:54:34.763908
descriptionRust client library for Mistral API
homepage
repository
max_upload_size
id1106546
size21,917
Lei (leifu1128)

documentation

README

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);
}
Commit count: 0

cargo fmt