pub struct ToolConfig {
pub name: Option<String>,
pub description: Option<String>,
pub return_direct: bool,
pub args_schema: Option<ArgsSchema>,
pub infer_schema: bool,
pub response_format: ResponseFormat,
pub parse_docstring: bool,
pub error_on_invalid_docstring: bool,
pub extras: Option<HashMap<String, Value>>,
}Expand description
Configuration for creating a tool from a function.
Fields§
§name: Option<String>Optional name for the tool. If not provided, uses the function name.
description: Option<String>Optional description for the tool.
return_direct: boolWhether to return the tool’s output directly.
args_schema: Option<ArgsSchema>Optional schema for the tool’s input arguments.
infer_schema: boolWhether to infer the schema from the function signature.
response_format: ResponseFormatThe tool response format.
parse_docstring: boolWhether to parse the docstring for parameter descriptions.
error_on_invalid_docstring: boolWhether to raise an error on invalid docstring.
extras: Option<HashMap<String, Value>>Optional provider-specific extras.
Implementations§
Source§impl ToolConfig
impl ToolConfig
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description.
Sourcepub fn with_return_direct(self, return_direct: bool) -> Self
pub fn with_return_direct(self, return_direct: bool) -> Self
Set return_direct.
Sourcepub fn with_args_schema(self, schema: ArgsSchema) -> Self
pub fn with_args_schema(self, schema: ArgsSchema) -> Self
Set the args schema.
Sourcepub fn with_infer_schema(self, infer_schema: bool) -> Self
pub fn with_infer_schema(self, infer_schema: bool) -> Self
Set infer_schema.
Sourcepub fn with_response_format(self, format: ResponseFormat) -> Self
pub fn with_response_format(self, format: ResponseFormat) -> Self
Set the response format.
Sourcepub fn with_parse_docstring(self, parse: bool) -> Self
pub fn with_parse_docstring(self, parse: bool) -> Self
Set parse_docstring.
Sourcepub fn with_extras(self, extras: HashMap<String, Value>) -> Self
pub fn with_extras(self, extras: HashMap<String, Value>) -> Self
Set extras.
Trait Implementations§
Source§impl Clone for ToolConfig
impl Clone for ToolConfig
Source§fn clone(&self) -> ToolConfig
fn clone(&self) -> ToolConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolConfig
impl Debug for ToolConfig
Source§impl Default for ToolConfig
impl Default for ToolConfig
Source§fn default() -> ToolConfig
fn default() -> ToolConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ToolConfig
impl RefUnwindSafe for ToolConfig
impl Send for ToolConfig
impl Sync for ToolConfig
impl Unpin for ToolConfig
impl UnwindSafe for ToolConfig
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