pub struct InteractionBuilder { /* private fields */ }Expand description
Fluent builder for constructing and executing interaction requests.
Implementations§
Source§impl InteractionBuilder
impl InteractionBuilder
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model (mutually exclusive with agent).
Sourcepub fn with_agent(self, agent: impl Into<String>) -> Self
pub fn with_agent(self, agent: impl Into<String>) -> Self
Set the agent (mutually exclusive with model).
Sourcepub fn with_input(self, input: impl Into<InteractionInput>) -> Self
pub fn with_input(self, input: impl Into<InteractionInput>) -> Self
Set input from anything that implements Into<InteractionInput>.
Sourcepub fn with_content_input(self, content: Vec<InteractionContent>) -> Self
pub fn with_content_input(self, content: Vec<InteractionContent>) -> Self
Set input as a content array (multimodal).
Sourcepub fn with_step_input(self, steps: Vec<Step>) -> Self
pub fn with_step_input(self, steps: Vec<Step>) -> Self
Set input as a step array (stateless multi-turn).
Sourcepub fn with_image(
self,
data: impl Into<String>,
mime_type: ImageMimeType,
) -> Self
pub fn with_image( self, data: impl Into<String>, mime_type: ImageMimeType, ) -> Self
Add image input.
Sourcepub fn with_image_uri(
self,
uri: impl Into<String>,
mime_type: ImageMimeType,
) -> Self
pub fn with_image_uri( self, uri: impl Into<String>, mime_type: ImageMimeType, ) -> Self
Add image input from a URI.
Sourcepub fn with_audio(
self,
data: impl Into<String>,
mime_type: AudioMimeType,
) -> Self
pub fn with_audio( self, data: impl Into<String>, mime_type: AudioMimeType, ) -> Self
Add audio input.
Sourcepub fn with_video(self, uri: impl Into<String>) -> Self
pub fn with_video(self, uri: impl Into<String>) -> Self
Add video input from a URI.
Sourcepub fn with_document(
self,
data: impl Into<String>,
mime_type: DocumentMimeType,
) -> Self
pub fn with_document( self, data: impl Into<String>, mime_type: DocumentMimeType, ) -> Self
Add document input.
Sourcepub fn with_system_instruction(self, instruction: impl Into<String>) -> Self
pub fn with_system_instruction(self, instruction: impl Into<String>) -> Self
Set the system instruction.
Sourcepub fn with_tool(self, tool: InteractionTool) -> Self
pub fn with_tool(self, tool: InteractionTool) -> Self
Add a tool.
Sourcepub fn with_tools(self, tools: Vec<InteractionTool>) -> Self
pub fn with_tools(self, tools: Vec<InteractionTool>) -> Self
Add tools.
Sourcepub fn with_function(
self,
name: impl Into<String>,
description: impl Into<String>,
parameters: Value,
) -> Self
pub fn with_function( self, name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> Self
Add a function declaration tool.
Sourcepub fn with_google_search(self) -> Self
pub fn with_google_search(self) -> Self
Enable Google Search.
Sourcepub fn with_code_execution(self) -> Self
pub fn with_code_execution(self) -> Self
Enable code execution.
Sourcepub fn with_url_context(self) -> Self
pub fn with_url_context(self) -> Self
Enable URL context.
Sourcepub fn with_google_maps(self) -> Self
pub fn with_google_maps(self) -> Self
Enable Google Maps.
Sourcepub fn with_file_search(self, store_names: Vec<String>) -> Self
pub fn with_file_search(self, store_names: Vec<String>) -> Self
Enable file search.
Sourcepub fn with_mcp_server(
self,
name: impl Into<String>,
url: impl Into<String>,
) -> Self
pub fn with_mcp_server( self, name: impl Into<String>, url: impl Into<String>, ) -> Self
Enable MCP Server.
Sourcepub fn with_computer_use(self, environment: ComputerUseEnvironment) -> Self
pub fn with_computer_use(self, environment: ComputerUseEnvironment) -> Self
Enable computer use.
Sourcepub fn with_retrieval(self, retrieval_types: Vec<RetrievalType>) -> Self
pub fn with_retrieval(self, retrieval_types: Vec<RetrievalType>) -> Self
Enable retrieval tool.
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_json_schema(self, schema: Value) -> Self
pub fn with_json_schema(self, schema: Value) -> Self
Set JSON structured output with a schema.
pub fn with_temperature(self, temperature: f64) -> Self
pub fn with_top_p(self, top_p: f64) -> Self
pub fn with_seed(self, seed: i64) -> Self
pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
pub fn with_max_output_tokens(self, tokens: i64) -> Self
pub fn with_thinking_level(self, level: InteractionThinkingLevel) -> Self
pub fn with_thinking_summaries(self, summaries: ThinkingSummaries) -> Self
pub fn with_presence_penalty(self, penalty: f64) -> Self
pub fn with_frequency_penalty(self, penalty: f64) -> Self
pub fn with_tool_choice(self, choice: ToolChoiceConfig) -> Self
pub fn with_speech_config(self, config: InteractionSpeechConfig) -> Self
pub fn with_video_config(self, config: VideoConfig) -> Self
Sourcepub fn with_generation_config(self, config: InteractionGenerationConfig) -> Self
pub fn with_generation_config(self, config: InteractionGenerationConfig) -> Self
Set the full generation config.
Sourcepub fn with_agent_config(self, config: AgentConfig) -> Self
pub fn with_agent_config(self, config: AgentConfig) -> Self
Set the agent config.
Sourcepub fn with_previous_interaction(self, id: impl Into<String>) -> Self
pub fn with_previous_interaction(self, id: impl Into<String>) -> Self
Set previous_interaction_id for server-side state management.
Sourcepub fn with_store(self, store: bool) -> Self
pub fn with_store(self, store: bool) -> Self
Set store flag. Use store(false) for stateless mode.
Sourcepub fn with_background(self) -> Self
pub fn with_background(self) -> Self
Enable background execution.
Sourcepub fn with_environment(self, env: EnvironmentConfig) -> Self
pub fn with_environment(self, env: EnvironmentConfig) -> Self
Set the environment configuration.
Sourcepub fn with_environment_id(self, env_id: impl Into<String>) -> Self
pub fn with_environment_id(self, env_id: impl Into<String>) -> Self
Set the environment by ID (reuse an existing environment).
Sourcepub fn with_cached_content(self, cached_content: impl Into<String>) -> Self
pub fn with_cached_content(self, cached_content: impl Into<String>) -> Self
Set cached content.
Sourcepub fn with_response_modalities(self, modalities: Vec<ResponseModality>) -> Self
pub fn with_response_modalities(self, modalities: Vec<ResponseModality>) -> Self
Set response modalities.
Sourcepub fn with_service_tier(self, tier: ServiceTier) -> Self
pub fn with_service_tier(self, tier: ServiceTier) -> Self
Set the service tier.
Sourcepub fn with_webhook_config(self, config: WebhookConfig) -> Self
pub fn with_webhook_config(self, config: WebhookConfig) -> Self
Set the webhook configuration.
Sourcepub fn build(self) -> Result<CreateInteractionRequest, ClientError>
pub fn build(self) -> Result<CreateInteractionRequest, ClientError>
Build the request.
Sourcepub async fn execute(self) -> Result<Interaction, ClientError>
pub async fn execute(self) -> Result<Interaction, ClientError>
Execute the interaction (non-streaming).
Sourcepub async fn execute_stream(self) -> Result<InteractionStream, ClientError>
pub async fn execute_stream(self) -> Result<InteractionStream, ClientError>
Execute the interaction (streaming).
Trait Implementations§
Source§impl Clone for InteractionBuilder
impl Clone for InteractionBuilder
Source§fn clone(&self) -> InteractionBuilder
fn clone(&self) -> InteractionBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more