Skip to content

Commit 914bce3

Browse files
committed
Add get_seed method
1 parent 71a8e22 commit 914bce3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llama-cpp-2/src/sampling.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ impl LlamaSampler {
7171
}
7272
}
7373

74+
/// Gets the random seed used by this sampler.
75+
///
76+
/// Returns:
77+
/// - For random samplers (dist, mirostat, mirostat_v2): returns their current seed
78+
/// - For sampler chains: returns the first non-default seed found in reverse order
79+
/// - For all other samplers: returns 0xFFFFFFFF
80+
#[must_use]
81+
pub fn get_seed(&self) -> u32 {
82+
unsafe { llama_cpp_sys_2::llama_sampler_get_seed(self.sampler) }
83+
}
84+
7485
/// Combines a list of samplers into a single sampler that applies each component sampler one
7586
/// after another.
7687
///

0 commit comments

Comments
 (0)