docs: update README and examples for v1.0.0
- Rewrite README with all new endpoints and current model names - Add available models table with constructors - Add FIM and OCR examples - Update all examples for string-based Model type - Update streaming example for Option<String> delta content - Use serde_json::json!() for tool schemas in examples - Add .envrc to .gitignore
This commit is contained in:
21
examples/fim.rs
Normal file
21
examples/fim.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user