-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cc5688
commit 3e67995
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use ollama_rs::{ | ||
generation::{completion::request::GenerationRequest, options::GenerationOptions}, | ||
Ollama, | ||
}; | ||
|
||
const CODE_MODEL: &str = "granite-code:3b"; | ||
|
||
#[tokio::test] | ||
async fn typical_c_code_main() { | ||
const C_PREFIX: &str = "int m"; | ||
const C_SUFFIX: &str = "(int argc, char **argv)"; | ||
const C_COMPLETION: &str = "ain"; | ||
|
||
let options = GenerationOptions::default().seed(146); | ||
let request = | ||
GenerationRequest::new_with_suffix(CODE_MODEL.into(), C_PREFIX.into(), C_SUFFIX.into()) | ||
.options(options); | ||
|
||
let ollama = Ollama::default(); | ||
let res = ollama.generate(request).await.unwrap(); | ||
|
||
let completion = res.response; | ||
assert_eq!(completion, C_COMPLETION); | ||
} |