Crates.io | mistral-api |
lib.rs | mistral-api |
version | 0.0.1 |
source | src |
created_at | 2024-01-20 14:54:34.763908 |
updated_at | 2024-01-20 14:54:34.763908 |
description | Rust client library for Mistral API |
homepage | |
repository | |
max_upload_size | |
id | 1106546 |
size | 21,917 |
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);
}