Add examples for set_initial_prompt(...)
This commit is contained in:
parent
8c8a5d78d9
commit
9aa2429606
2 changed files with 8 additions and 0 deletions
|
|
@ -51,6 +51,7 @@ fn main() {
|
|||
).expect("failed to open model");
|
||||
let mut state = ctx.create_state().expect("failed to create key");
|
||||
let mut params = FullParams::new(SamplingStrategy::default());
|
||||
params.set_initial_prompt("experience");
|
||||
params.set_progress_callback_safe(|progress| println!("Progress callback: {}%", progress));
|
||||
|
||||
let st = std::time::Instant::now();
|
||||
|
|
|
|||
|
|
@ -590,6 +590,13 @@ impl<'a, 'b> FullParams<'a, 'b> {
|
|||
///
|
||||
/// # Panics
|
||||
/// This method will panic if `initial_prompt` contains a null byte, as it cannot be converted into a `CString`.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// let mut params = FullParams::new(SamplingStrategy::default());
|
||||
/// params.set_initial_prompt("Hello, world!");
|
||||
/// // ... further usage of params ...
|
||||
/// ```
|
||||
pub fn set_initial_prompt(&mut self, initial_prompt: &str) {
|
||||
self.fp.initial_prompt = CString::new(initial_prompt)
|
||||
.expect("Initial prompt contains null byte")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue