pub struct ToolDefinition {
pub name: String,
pub description: Option<String>,
pub parameters: JsonPayload,
/* private fields */
}Available on crate features
structured-output and tool-runner only.Expand description
表示单个工具定义。
Fields§
§name: String工具名称。
description: Option<String>工具描述。
parameters: JsonPayload工具参数 JSON Schema。
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn new<T, U, H>(
name: T,
description: Option<U>,
parameters: impl Into<JsonPayload>,
handler: H,
) -> Self
pub fn new<T, U, H>( name: T, description: Option<U>, parameters: impl Into<JsonPayload>, handler: H, ) -> Self
使用显式 JSON Schema 创建工具定义。
Sourcepub fn from_schema<TArgs, T, U, H>(
name: T,
description: Option<U>,
handler: H,
) -> Self
pub fn from_schema<TArgs, T, U, H>( name: T, description: Option<U>, handler: H, ) -> Self
使用 schemars 自动推导参数 Schema。
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 · 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 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