Skip to main content

Module interactions

Module interactions 

Source
Expand description

Interactions API — the modern interface for Gemini models and agents Interactions API — the modern interface for Gemini models and agents.

The Interactions API is the simplest and best way to use Gemini models and agents. It provides a unified interface for all use cases, including single-turn text generation, multimodal understanding, structured output, tool orchestration, and agentic workflows.

§Key Advantages

  • Unified interface for models and agents
  • Server-side state management (previous_interaction_id)
  • Observable execution steps
  • Background execution
  • Higher cache hit rates

§Quick Start

let interaction = gemini.create_interaction()
    .with_model("gemini-2.5-flash")
    .with_text("Hello, world!")
    .execute()
    .await?;

println!("{}", interaction.output_text());

Re-exports§

pub use builder::InteractionBuilder;
pub use handle::InteractionHandle;
pub use stream::InteractionEvent;
pub use stream::InteractionStream;
pub use stream::StepDeltaData;
pub use model::*;

Modules§

builder
handle
model
stream