Rust

gemini

Module

Google Gemini.

Contents

use utopia_agents::Gemini;
Rust
pub struct Gemini

Google's Gemini API: answers always streamed (server-sent events), the description and instructions as the system instruction, the assistant's messages as the model role, images inline. No structured output.

Rust
use utopia_agents::{Adapter, Gemini, adapters::gemini};

let adapter = Gemini::new("test-api-key").with_model(gemini::MODEL_GEMINI_2_0_FLASH_LITE);
assert_eq!(adapter.name(), "gemini");
assert_eq!(
    adapter.endpoint(),
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite:streamGenerateContent?alt=sse&key=test-api-key"
);
use utopia_agents::adapters::gemini::endpoint;
Rust
pub fn endpoint(model: &str, api_key: &str) -> String

The streaming endpoint of a model, with the API key in the query.

Rust
pub const MODEL_GEMINI_1_5_PRO: &str = "gemini-1.5-pro"

Gemini 1.5 Pro.

Rust
pub const MODEL_GEMINI_2_0_FLASH: &str = "gemini-2.0-flash"

Gemini 2.0 Flash (the default).

Rust
pub const MODEL_GEMINI_2_0_FLASH_LITE: &str = "gemini-2.0-flash-lite"

Gemini 2.0 Flash Lite.

Rust
pub const MODEL_GEMINI_2_5_FLASH_PREVIEW: &str = "gemini-2.5-flash-preview-04-17"

Gemini 2.5 Flash Preview.

Rust
pub const MODEL_GEMINI_2_5_PRO_PREVIEW: &str = "gemini-2.5-pro-preview-03-25"

Gemini 2.5 Pro Preview.

Rust
pub const MODELS: &[&str] = &[ MODEL_GEMINI_2_0_FLASH, MODEL_GEMINI_2_0_FLASH_LITE, MODEL_GEMINI_1_5_PRO, MODEL_GEMINI_2_5_FLASH_PREVIEW, MODEL_GEMINI_2_5_PRO_PREVIEW, ]

Undocumented.