pub struct Tool { /* private fields */ }Expand description
One tool exposed to the system language model.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn new<F>(
name: impl Into<String>,
description: impl Into<String>,
parameters: GenerationSchema,
handler: F,
) -> Self
pub fn new<F>( name: impl Into<String>, description: impl Into<String>, parameters: GenerationSchema, handler: F, ) -> Self
Create a tool from a dynamic GeneratedContent handler.
Sourcepub fn json<Args, Output, F>(
name: impl Into<String>,
description: impl Into<String>,
parameters: GenerationSchema,
handler: F,
) -> Self
pub fn json<Args, Output, F>( name: impl Into<String>, description: impl Into<String>, parameters: GenerationSchema, handler: F, ) -> Self
Create a tool whose handler receives decoded JSON arguments.
Sourcepub fn generable<Args, Output, F>(
name: impl Into<String>,
description: impl Into<String>,
handler: F,
) -> Result<Self, FMError>
pub fn generable<Args, Output, F>( name: impl Into<String>, description: impl Into<String>, handler: F, ) -> Result<Self, FMError>
Sourcepub fn definition(&self) -> ToolDefinition
pub fn definition(&self) -> ToolDefinition
Convert this tool into a transcript tool definition.
Sourcepub fn with_schema_in_instructions(self, includes: bool) -> Self
pub fn with_schema_in_instructions(self, includes: bool) -> Self
Control whether the schema is included in the model’s tool instructions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tool
impl !RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl !UnwindSafe for Tool
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