pub struct Config { /* private fields */ }Implementations§
Source§impl Config
impl Config
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Create an instance of Config using the builder syntax
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}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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