Files

22 lines
645 B
Rust
Raw Permalink Normal View History

use mistralai_client::v1::{
client::Client,
constants::Model,
fim::FimParams,
};
fn main() {
// This example suppose you have set the `MISTRAL_API_KEY` environment variable.
let client = Client::new(None, None, None, None).unwrap();
let model = Model::codestral_latest();
let prompt = "def fibonacci(n):".to_string();
let options = FimParams {
suffix: Some("\n return result".to_string()),
temperature: Some(0.0),
..Default::default()
};
let response = client.fim(model, prompt, Some(options)).unwrap();
println!("Completion: {}", response.choices[0].message.content);
}