pub struct ResponsesToolDefinition {
pub kind: String,
pub name: String,
pub parameters: Value,
pub strict: bool,
pub description: String,
pub config: Map<String, Value>,
}Expand description
The definition of a tool response, repurposed for OpenAI’s Responses API.
Fields§
§kind: StringThe type of tool.
name: StringTool name
parameters: ValueParameters - this should be a JSON schema. Strict function tools must use OpenAI’s supported strict schema subset.
strict: boolWhether to use strict mode. Disabled by default; opt in with Self::with_strict
or [GenericResponsesCompletionModel::with_strict_tools].
description: StringTool description.
config: Map<String, Value>Additional provider-specific configuration for hosted tools.
Implementations§
Source§impl ResponsesToolDefinition
impl ResponsesToolDefinition
Sourcepub fn function(
name: impl Into<String>,
description: impl Into<String>,
parameters: Value,
) -> ResponsesToolDefinition
pub fn function( name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> ResponsesToolDefinition
Creates a function tool definition with strict mode disabled.
Sourcepub fn strict_function(
name: impl Into<String>,
description: impl Into<String>,
parameters: Value,
) -> ResponsesToolDefinition
pub fn strict_function( name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> ResponsesToolDefinition
Creates a strict function tool definition.
The schema is sanitized to OpenAI’s strict subset (additionalProperties: false
added and every property forced into required).
Sourcepub fn with_strict(self) -> ResponsesToolDefinition
pub fn with_strict(self) -> ResponsesToolDefinition
Enables strict mode for this function tool.
Function schemas are sanitized to OpenAI’s strict subset. Hosted tools are returned unchanged because strict mode only applies to function tools.
Sourcepub fn hosted(kind: impl Into<String>) -> ResponsesToolDefinition
pub fn hosted(kind: impl Into<String>) -> ResponsesToolDefinition
Creates a hosted tool definition for an arbitrary hosted tool type.
Sourcepub fn web_search() -> ResponsesToolDefinition
pub fn web_search() -> ResponsesToolDefinition
Creates a hosted web_search tool definition.
Sourcepub fn file_search() -> ResponsesToolDefinition
pub fn file_search() -> ResponsesToolDefinition
Creates a hosted file_search tool definition.
Sourcepub fn computer_use() -> ResponsesToolDefinition
pub fn computer_use() -> ResponsesToolDefinition
Creates a hosted computer_use tool definition.
Sourcepub fn with_config(
self,
key: impl Into<String>,
value: Value,
) -> ResponsesToolDefinition
pub fn with_config( self, key: impl Into<String>, value: Value, ) -> ResponsesToolDefinition
Adds hosted-tool configuration fields.
Trait Implementations§
Source§impl Clone for ResponsesToolDefinition
impl Clone for ResponsesToolDefinition
Source§fn clone(&self) -> ResponsesToolDefinition
fn clone(&self) -> ResponsesToolDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more