pub enum ModelToolDefinition {
Function(FunctionToolDefinition),
Hosted(HostedToolDefinition),
}Expand description
One model-visible client function or provider-hosted tool definition.
Variants§
Function(FunctionToolDefinition)
A function call that the client must execute.
Hosted(HostedToolDefinition)
A tool executed inside the provider response lifecycle.
Implementations§
Source§impl ModelToolDefinition
impl ModelToolDefinition
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
input_schema: Value,
) -> Result<Self, ModelRequestError>
pub fn new( name: impl Into<String>, description: impl Into<String>, input_schema: Value, ) -> Result<Self, ModelRequestError>
Creates a validated client function definition.
§Errors
Returns an error for invalid names/descriptions or non-object, oversized, or excessively nested schemas.
Sourcepub fn hosted(
description: impl Into<String>,
input_schema: Value,
options: HostedToolOptions,
) -> Result<Self, ModelRequestError>
pub fn hosted( description: impl Into<String>, input_schema: Value, options: HostedToolOptions, ) -> Result<Self, ModelRequestError>
Creates a validated provider-hosted definition.
§Errors
Returns an error when the common model contract violates request bounds.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Returns the model-visible description.
Sourcepub const fn input_schema(&self) -> &Value
pub const fn input_schema(&self) -> &Value
Returns the provider-neutral input JSON Schema.
Sourcepub const fn as_function(&self) -> Option<&FunctionToolDefinition>
pub const fn as_function(&self) -> Option<&FunctionToolDefinition>
Returns this definition as a client function.
Sourcepub const fn as_hosted(&self) -> Option<&HostedToolDefinition>
pub const fn as_hosted(&self) -> Option<&HostedToolDefinition>
Returns this definition as a hosted tool.
Sourcepub const fn hosted_kind(&self) -> Option<HostedToolKind>
pub const fn hosted_kind(&self) -> Option<HostedToolKind>
Returns the hosted capability kind, if any.
Trait Implementations§
Source§impl Clone for ModelToolDefinition
impl Clone for ModelToolDefinition
Source§fn clone(&self) -> ModelToolDefinition
fn clone(&self) -> ModelToolDefinition
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 ModelToolDefinition
impl Debug for ModelToolDefinition
Source§impl PartialEq for ModelToolDefinition
impl PartialEq for ModelToolDefinition
impl StructuralPartialEq for ModelToolDefinition
Auto Trait Implementations§
impl Freeze for ModelToolDefinition
impl RefUnwindSafe for ModelToolDefinition
impl Send for ModelToolDefinition
impl Sync for ModelToolDefinition
impl Unpin for ModelToolDefinition
impl UnsafeUnpin for ModelToolDefinition
impl UnwindSafe for ModelToolDefinition
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