Skip to main content

InteractionBuilder

Struct InteractionBuilder 

Source
pub struct InteractionBuilder { /* private fields */ }
Expand description

Fluent builder for constructing and executing interaction requests.

Implementations§

Source§

impl InteractionBuilder

Source

pub fn with_model(self, model: impl Into<String>) -> Self

Set the model (mutually exclusive with agent).

Source

pub fn with_agent(self, agent: impl Into<String>) -> Self

Set the agent (mutually exclusive with model).

Source

pub fn with_input(self, input: impl Into<InteractionInput>) -> Self

Set input from anything that implements Into<InteractionInput>.

Source

pub fn with_text(self, text: impl Into<String>) -> Self

Set input as plain text.

Source

pub fn with_content_input(self, content: Vec<InteractionContent>) -> Self

Set input as a content array (multimodal).

Source

pub fn with_step_input(self, steps: Vec<Step>) -> Self

Set input as a step array (stateless multi-turn).

Source

pub fn with_image( self, data: impl Into<String>, mime_type: ImageMimeType, ) -> Self

Add image input.

Source

pub fn with_image_uri( self, uri: impl Into<String>, mime_type: ImageMimeType, ) -> Self

Add image input from a URI.

Source

pub fn with_audio( self, data: impl Into<String>, mime_type: AudioMimeType, ) -> Self

Add audio input.

Source

pub fn with_video(self, uri: impl Into<String>) -> Self

Add video input from a URI.

Source

pub fn with_document( self, data: impl Into<String>, mime_type: DocumentMimeType, ) -> Self

Add document input.

Source

pub fn with_system_instruction(self, instruction: impl Into<String>) -> Self

Set the system instruction.

Source

pub fn with_tool(self, tool: InteractionTool) -> Self

Add a tool.

Source

pub fn with_tools(self, tools: Vec<InteractionTool>) -> Self

Add tools.

Source

pub fn with_function( self, name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> Self

Add a function declaration tool.

Enable Google Search.

Source

pub fn with_code_execution(self) -> Self

Enable code execution.

Source

pub fn with_url_context(self) -> Self

Enable URL context.

Source

pub fn with_google_maps(self) -> Self

Enable Google Maps.

Enable file search.

Source

pub fn with_mcp_server( self, name: impl Into<String>, url: impl Into<String>, ) -> Self

Enable MCP Server.

Source

pub fn with_computer_use(self, environment: ComputerUseEnvironment) -> Self

Enable computer use.

Source

pub fn with_retrieval(self, retrieval_types: Vec<RetrievalType>) -> Self

Enable retrieval tool.

Source

pub fn with_response_format(self, format: ResponseFormat) -> Self

Set the response format.

Source

pub fn with_json_schema(self, schema: Value) -> Self

Set JSON structured output with a schema.

Source

pub fn with_temperature(self, temperature: f64) -> Self

Source

pub fn with_top_p(self, top_p: f64) -> Self

Source

pub fn with_seed(self, seed: i64) -> Self

Source

pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self

Source

pub fn with_max_output_tokens(self, tokens: i64) -> Self

Source

pub fn with_thinking_level(self, level: InteractionThinkingLevel) -> Self

Source

pub fn with_thinking_summaries(self, summaries: ThinkingSummaries) -> Self

Source

pub fn with_presence_penalty(self, penalty: f64) -> Self

Source

pub fn with_frequency_penalty(self, penalty: f64) -> Self

Source

pub fn with_tool_choice(self, choice: ToolChoiceConfig) -> Self

Source

pub fn with_speech_config(self, config: InteractionSpeechConfig) -> Self

Source

pub fn with_video_config(self, config: VideoConfig) -> Self

Source

pub fn with_generation_config(self, config: InteractionGenerationConfig) -> Self

Set the full generation config.

Source

pub fn with_agent_config(self, config: AgentConfig) -> Self

Set the agent config.

Source

pub fn with_previous_interaction(self, id: impl Into<String>) -> Self

Set previous_interaction_id for server-side state management.

Source

pub fn with_store(self, store: bool) -> Self

Set store flag. Use store(false) for stateless mode.

Source

pub fn with_background(self) -> Self

Enable background execution.

Source

pub fn with_environment(self, env: EnvironmentConfig) -> Self

Set the environment configuration.

Source

pub fn with_environment_id(self, env_id: impl Into<String>) -> Self

Set the environment by ID (reuse an existing environment).

Source

pub fn with_cached_content(self, cached_content: impl Into<String>) -> Self

Set cached content.

Source

pub fn with_response_modalities(self, modalities: Vec<ResponseModality>) -> Self

Set response modalities.

Source

pub fn with_service_tier(self, tier: ServiceTier) -> Self

Set the service tier.

Source

pub fn with_webhook_config(self, config: WebhookConfig) -> Self

Set the webhook configuration.

Source

pub fn build(self) -> Result<CreateInteractionRequest, ClientError>

Build the request.

Source

pub async fn execute(self) -> Result<Interaction, ClientError>

Execute the interaction (non-streaming).

Source

pub async fn execute_stream(self) -> Result<InteractionStream, ClientError>

Execute the interaction (streaming).

Trait Implementations§

Source§

impl Clone for InteractionBuilder

Source§

fn clone(&self) -> InteractionBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more