#[non_exhaustive]pub enum ToolDefinition {
Function {
name: ToolName,
description: Option<String>,
input_schema: JsonValue,
strict: Option<bool>,
input_examples: Vec<JsonObject>,
provider_options: Option<ProviderOptions>,
},
Provider {
id: String,
name: ToolName,
args: JsonObject,
},
}Expand description
A tool made available to the model.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Function
A function tool executed by the application (or by the provider when
it reports provider_executed).
Fields
§
input_examples: Vec<JsonObject>Example inputs.
§
provider_options: Option<ProviderOptions>Provider-specific options for this tool.
Provider
A tool defined and executed by the provider (web search, code interpreter, …).
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn function(
name: impl Into<ToolName>,
description: Option<String>,
input_schema: JsonValue,
) -> Self
pub fn function( name: impl Into<ToolName>, description: Option<String>, input_schema: JsonValue, ) -> Self
Creates a function tool with a schema and optional description.
Sourcepub fn provider(
id: impl Into<String>,
name: impl Into<ToolName>,
args: JsonObject,
) -> Self
pub fn provider( id: impl Into<String>, name: impl Into<ToolName>, args: JsonObject, ) -> Self
Creates a provider tool.
Sourcepub fn is_provider_tool(&self) -> bool
pub fn is_provider_tool(&self) -> bool
Returns true for ToolDefinition::Provider.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
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 moreSource§impl Debug for ToolDefinition
impl Debug for ToolDefinition
Source§impl<'de> Deserialize<'de> for ToolDefinition
impl<'de> Deserialize<'de> for ToolDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ToolDefinition
impl PartialEq for ToolDefinition
Source§impl Serialize for ToolDefinition
impl Serialize for ToolDefinition
impl StructuralPartialEq for ToolDefinition
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnsafeUnpin for ToolDefinition
impl UnwindSafe for ToolDefinition
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