use serde_json::{Map, Value};
#[derive(Debug, Clone, Default)]
pub struct OllamaOptionsBuilder {
options: Map<String, Value>,
}
impl OllamaOptionsBuilder {
pub fn new() -> Self {
Self::default()
}
pub fn num_ctx(mut self, val: u32) -> Self {
self.options.insert("num_ctx".to_string(), val.into());
self
}
pub fn keep_alive<T: Into<Value>>(mut self, val: T) -> Self {
self.options.insert("keep_alive".to_string(), val.into());
self
}
pub fn num_predict(mut self, val: i32) -> Self {
self.options.insert("num_predict".to_string(), val.into());
self
}
pub fn temperature(mut self, val: f32) -> Self {
self.options.insert("temperature".to_string(), val.into());
self
}
pub fn seed(mut self, val: u32) -> Self {
self.options.insert("seed".to_string(), val.into());
self
}
pub fn top_k(mut self, val: u32) -> Self {
self.options.insert("top_k".to_string(), val.into());
self
}
pub fn top_p(mut self, val: f32) -> Self {
self.options.insert("top_p".to_string(), val.into());
self
}
pub fn stop(mut self, val: Vec<String>) -> Self {
self.options.insert("stop".to_string(), val.into());
self
}
pub fn mirostat(mut self, val: u8) -> Self {
self.options.insert("mirostat".to_string(), val.into());
self
}
pub fn repeat_penalty(mut self, val: f32) -> Self {
self.options.insert("repeat_penalty".to_string(), val.into());
self
}
pub fn repeat_last_n(mut self, val: i32) -> Self {
self.options.insert("repeat_last_n".to_string(), val.into());
self
}
pub fn build(self) -> Map<String, Value> {
self.options
}
}