Skip to main content

Google Gemini

Use Google’s Gemini models with RadarOS through the unified ModelProvider interface. Gemini offers strong multi-modal capabilities—vision, audio, and native file handling.

Setup

Install the Google GenAI SDK (required by RadarOS for Gemini support):
npm install @google/genai

Factory

import { google } from "@radaros/core";

const model = google("gemini-2.5-flash");
modelId
string
required
The Gemini model identifier.
config
object
Optional configuration. See Config below.

Supported Models

Model IDDescription
gemini-2.5-flashFast, efficient. Great for high-throughput and latency-sensitive apps.
gemini-2.5-proHighest capability. Best for complex reasoning and long-context tasks.

Config

apiKey
string
Google API key. If omitted, uses GOOGLE_API_KEY environment variable.

Example

const model = google("gemini-2.5-flash", {
  apiKey: process.env.GOOGLE_API_KEY,
});

Multi-Modal Support

Gemini supports vision, audio, and file content. Pass multi-modal content via ContentPart[] in messages:

Realtime / Voice (Gemini Live)

For real-time voice agents, use googleLive() to create a Google Gemini Live provider:
import { VoiceAgent, googleLive } from "@radaros/core";

const agent = new VoiceAgent({
  name: "assistant",
  provider: googleLive("gemini-2.5-flash-native-audio-preview-12-2025"),
  instructions: "You are a voice assistant.",
});
googleLive() is a shorthand for new GoogleLiveProvider(). It accepts the same config:
googleLive("gemini-2.5-flash-native-audio-preview-12-2025", {
  apiKey: "...", // optional, defaults to GOOGLE_API_KEY env
});
Requires: npm install @google/genai See the Voice Agents docs for full details.

Full Example

import { Agent, google } from "@radaros/core";

const agent = new Agent({
  name: "Gemini Assistant",
  model: google("gemini-2.5-flash", {
    apiKey: process.env.GOOGLE_API_KEY,
  }),
  instructions: "You are a helpful assistant with strong multi-modal capabilities.",
});

const output = await agent.run("Summarize the key points of this document.");
console.log(output.text);