pub struct ToolCallBuilder { /* private fields */ }Expand description
Builder for constructing a ToolCall field by field.
Replaces the error-prone 3-positional-argument ToolCall::new.
use lc_shared::ToolCall;
let call = ToolCall::builder("call_1")
.name("get_weather")
.arguments(r#"{"city":"beijing"}"#)
.build();
assert_eq!(call.id, "call_1");
assert_eq!(call.name(), "get_weather");Implementations§
Source§impl ToolCallBuilder
impl ToolCallBuilder
Sourcepub fn new(id: impl Into<String>) -> ToolCallBuilder
pub fn new(id: impl Into<String>) -> ToolCallBuilder
Start building a tool call with its id.
Sourcepub fn name(self, name: impl Into<String>) -> ToolCallBuilder
pub fn name(self, name: impl Into<String>) -> ToolCallBuilder
Set the function name.
Sourcepub fn arguments(self, arguments: impl Into<String>) -> ToolCallBuilder
pub fn arguments(self, arguments: impl Into<String>) -> ToolCallBuilder
Set the JSON-encoded function arguments.
Trait Implementations§
Source§impl Clone for ToolCallBuilder
impl Clone for ToolCallBuilder
Source§fn clone(&self) -> ToolCallBuilder
fn clone(&self) -> ToolCallBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ToolCallBuilder
impl RefUnwindSafe for ToolCallBuilder
impl Send for ToolCallBuilder
impl Sync for ToolCallBuilder
impl Unpin for ToolCallBuilder
impl UnsafeUnpin for ToolCallBuilder
impl UnwindSafe for ToolCallBuilder
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