Skip to content

Commit 71a8e22

Browse files
committed
Add reset sampler
1 parent c1e17d7 commit 71a8e22

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llama-cpp-2/src/sampling.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ impl LlamaSampler {
6262
self
6363
}
6464

65+
/// Resets the internal state of the sampler.
66+
///
67+
/// This can be useful when you want to start fresh with a sampler without creating a new instance.
68+
pub fn reset(&mut self) {
69+
unsafe {
70+
llama_cpp_sys_2::llama_sampler_reset(self.sampler);
71+
}
72+
}
73+
6574
/// Combines a list of samplers into a single sampler that applies each component sampler one
6675
/// after another.
6776
///

0 commit comments

Comments
 (0)