pub struct ConfigBuilder<S: State = Empty> { /* private fields */ }Expand description
Use builder syntax to set the inputs and finish with build().
Implementations§
Source§impl<S: State> ConfigBuilder<S>
impl<S: State> ConfigBuilder<S>
Sourcepub fn build(self) -> Configwhere
S: IsComplete,
pub fn build(self) -> Configwhere
S: IsComplete,
Finish building and return the requested object
Examples found in repository?
examples/simple.rs (line 52)
47async fn main() {
48 let mut toolbox: ToolBox<String, Infallible> = ToolBox::new();
49 let tool = ConversationTool::new("Dave".to_owned());
50 toolbox.add_tool(tool).unwrap();
51
52 let link = LlamaLink::new("http://127.0.0.1:3756", Config::builder().build());
53 let result = link
54 .call_function(format_prompt("What do you think about canadians", &toolbox), &toolbox)
55 .await;
56 match result {
57 Ok(Ok(call_result)) => println!("{}", call_result),
58 Err(error) => panic!("{}", error),
59 }
60}More examples
examples/formatted.rs (line 52)
47async fn main() {
48 let mut toolbox: ToolBox<String, Infallible> = ToolBox::new();
49 let tool = ConversationTool::new("Dave".to_owned());
50 toolbox.add_tool(tool).unwrap();
51
52 let link = LlamaLink::new("http://127.0.0.1:3756", Config::builder().build());
53 let system = format!("You are a helpful AI assistant. Respond to the user in this json function calling format: {}",serde_json::to_string(toolbox.schema()).unwrap());
54 let messages = vec![Message::User("What do you think about the rust programming language".to_owned())];
55 let result = link
56 .call_function_with_format(
57 &system, &messages, &PromptFormatter::default(), &toolbox)
58 .await;
59 match result {
60 Ok(Ok(call_result)) => println!("{}", call_result),
61 Err(error) => panic!("{}", error),
62 }
63}Sourcepub fn n_predict(self, value: usize) -> ConfigBuilder<SetNPredict<S>>where
S::NPredict: IsUnset,
pub fn n_predict(self, value: usize) -> ConfigBuilder<SetNPredict<S>>where
S::NPredict: IsUnset,
Sourcepub fn maybe_n_predict(
self,
value: Option<usize>,
) -> ConfigBuilder<SetNPredict<S>>where
S::NPredict: IsUnset,
pub fn maybe_n_predict(
self,
value: Option<usize>,
) -> ConfigBuilder<SetNPredict<S>>where
S::NPredict: IsUnset,
Sourcepub fn temperature(self, value: f32) -> ConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
pub fn temperature(self, value: f32) -> ConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
Sourcepub fn maybe_temperature(
self,
value: Option<f32>,
) -> ConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
pub fn maybe_temperature(
self,
value: Option<f32>,
) -> ConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
Sourcepub fn top_k(self, value: usize) -> ConfigBuilder<SetTopK<S>>where
S::TopK: IsUnset,
pub fn top_k(self, value: usize) -> ConfigBuilder<SetTopK<S>>where
S::TopK: IsUnset,
Sourcepub fn maybe_top_k(self, value: Option<usize>) -> ConfigBuilder<SetTopK<S>>where
S::TopK: IsUnset,
pub fn maybe_top_k(self, value: Option<usize>) -> ConfigBuilder<SetTopK<S>>where
S::TopK: IsUnset,
Sourcepub fn top_p(self, value: f32) -> ConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
pub fn top_p(self, value: f32) -> ConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
Sourcepub fn maybe_top_p(self, value: Option<f32>) -> ConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
pub fn maybe_top_p(self, value: Option<f32>) -> ConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
Sourcepub fn stop(self, value: Vec<String>) -> ConfigBuilder<SetStop<S>>where
S::Stop: IsUnset,
pub fn stop(self, value: Vec<String>) -> ConfigBuilder<SetStop<S>>where
S::Stop: IsUnset,
Sourcepub fn maybe_stop(self, value: Option<Vec<String>>) -> ConfigBuilder<SetStop<S>>where
S::Stop: IsUnset,
pub fn maybe_stop(self, value: Option<Vec<String>>) -> ConfigBuilder<SetStop<S>>where
S::Stop: IsUnset,
Auto Trait Implementations§
impl<S> Freeze for ConfigBuilder<S>
impl<S> RefUnwindSafe for ConfigBuilder<S>
impl<S> Send for ConfigBuilder<S>
impl<S> Sync for ConfigBuilder<S>
impl<S> Unpin for ConfigBuilder<S>
impl<S> UnwindSafe for ConfigBuilder<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more