This engineering guide walks through end-to-end code blueprints for connecting wearable hardware streams (directional open-ear PCM audio, 12MP camera frames, and GPS telemetry) to the Gemini Multimodal Live API using the official Google Gen AI SDK v3.2.0 (@google/genai and google-genai). All patterns adhere strictly to Google's wearable privacy policies, zero-training mandates, and edge bystander face redaction requirements.
This TypeScript service runs within the mobile companion application (iOS/Android), establishing a low-latency persistent WebSocket session to the Multimodal Live API, streaming microphone buffers, interleaving camera frames on voice activity, and forwarding incoming audio chunks directly to the glasses' speakers:
import { GoogleGenAI } from '@google/genai';
// Initialize the official Gen AI SDK v3.2.0 client
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
export class EyewearLiveSessionManager {
private session: any = null;
private isLedActive: boolean = false;
async startLiveSession(onAudioChunkReceived: (pcmBuffer: ArrayBuffer) => void) {
// Connect to Multimodal Live API WebSocket session
this.session = await ai.live.connect({
model: 'gemini-omni-1.2-flash',
config: {
generationConfig: {
responseModalities: ['AUDIO'],
speechConfig: {
voiceConfig: {
prebuiltVoiceConfig: {
voiceName: 'Kore' // Natural, low-latency conversational voice
}
}
}
},
systemInstruction: {
parts: [{
text: `You are the ambient intelligence embedded in Google Intelligent Eyewear.
Deliver ultra-concise, conversational, single-sentence spoken answers directly into the user's ear.
When describing physical scenes, prioritize immediate spatial orientation and safety-critical obstacles.
Never recite markdown lists or repetitive conversational pleasantries.`
}]
}
}
});
// Listen for incoming audio tokens from Gemini
this.session.on('content', (content: any) => {
if (content.modelTurn?.parts) {
for (const part of content.modelTurn.parts) {
if (part.inlineData?.mimeType?.startsWith('audio/pcm')) {
const audioData = Buffer.from(part.inlineData.data, 'base64').buffer;
onAudioChunkReceived(audioData);
}
}
}
});
console.log('โ
Intelligent Eyewear Live API session active.');
}
// Stream raw microphone PCM audio (16kHz / 16-bit mono)
sendAudioDelta(pcmChunk: Buffer) {
if (!this.session) return;
this.session.send({
realtimeInput: {
mediaChunks: [{
mimeType: 'audio/pcm;rate=16000',
data: pcmChunk.toString('base64')
}]
}
});
}
// Interleave camera snapshot (12MP sensor downscaled to 1080p WebP for streaming)
sendCameraFrame(imageBuffer: Buffer, isLedVerified: boolean) {
if (!this.session) return;
if (!isLedVerified) {
console.error('โ Hardware Safety Violation: Capture LED is obstructed or non-functional.');
return;
}
this.session.send({
realtimeInput: {
mediaChunks: [{
mimeType: 'image/webp',
data: imageBuffer.toString('base64')
}]
}
});
console.log('๐ธ Visual frame dispatched to Gemini Live session.');
}
async close() {
if (this.session) {
await this.session.close();
this.session = null;
}
}
}
This Python blueprint implements a server-side companion agent capable of handling high-stakes Guided Vision queries (reading medication small-print or crosswalk safety) while executing verified tools for Google Maps audio navigation:
import os
import asyncio
from google import genai
from google.genai import types
# Initialize Gen AI SDK v3.2.0 client
client = genai.Client(api_key=os.environ.get("GEMINI_API_KEY"))
# Define verified tools for Intelligent Eyewear spatial action
def get_walking_directions(destination: str, current_lat: float, current_lng: float) -> dict:
"""Calculates immediate turn-by-turn walking steps and spatial audio cues."""
return {
"destination": destination,
"next_step": "Walk straight 45 meters, then take a slight right at the pedestrian crossing.",
"audio_panning": "pan_right_30deg",
"estimated_arrival_minutes": 4
}
async def run_wearable_guided_vision_stream():
# Configure Multimodal Live WebSocket session with function calling
async with client.aio.live.connect(
model="gemini-4-argon",
config=types.LiveConnectConfig(
response_modalities=[types.LiveModality.AUDIO],
tools=[get_walking_directions],
system_instruction=types.Content(parts=[
types.Part.from_text(
"You are the Guided Vision copilot for Google Intelligent Eyewear. "
"When visually inspecting labels or text, read active ingredients and dosage first. "
"When navigating, specify whether turns should be taken immediately or ahead."
)
])
)
) as session:
print("๐ Connected to Gemini 4 Argon Live API for Guided Vision.")
# Simulated wearer asking for navigation help while looking down a busy boulevard
await session.send(
types.LiveClientContent(
turns=[
types.Content(parts=[
types.Part.from_text("Hey Gemini, how do I walk to the Union Square subway entrance from here?")
])
],
turn_complete=True
)
)
async for response in session.receive():
if response.server_content and response.server_content.model_turn:
for part in response.server_content.model_turn.parts:
if part.inline_data:
print(f"๐ Spoken audio chunk received: {len(part.inline_data.data)} bytes")
elif part.executable_code or part.function_call:
print(f"โก Tool Call Triggered: {part.function_call.name}")
if __name__ == "__main__":
asyncio.run(run_wearable_guided_vision_stream())
To adhere to Google's strict privacy policy (mandating that bystander faces are redacted before cloud processing and visuals are never stored), companion bridge apps run a local micro-model filter before forwarding frames:
/**
* Edge Privacy Pre-Processor for Google Intelligent Eyewear
* Enforces hardware LED state verification and bystander face redaction.
*/
export interface PrivacySanitizationResult {
safeBuffer: Buffer;
facesRedactedCount: number;
isCompliant: boolean;
rejectionReason?: string;
}
export function sanitizeWearableFrame(
rawFrame: Buffer,
hardwareLedStatus: 'ACTIVE_VERIFIED' | 'BLOCKED_TAMPERED' | 'DISCONNECTED'
): PrivacySanitizationResult {
// 1. Verify hardware LED capture indicator interlock
if (hardwareLedStatus !== 'ACTIVE_VERIFIED') {
return {
safeBuffer: Buffer.alloc(0),
facesRedactedCount: 0,
isCompliant: false,
rejectionReason: 'HARDWARE_LED_TAMPER_DETECTED: Optical recording interlock disabled.'
};
}
// 2. Perform on-device face detection & Gaussian blur on non-subject faces
// (In production, uses Android ML Kit Face Detector or iOS Vision Framework)
const simulatedFacesDetected = 2; // e.g. 2 bystanders detected in background
// 3. Mark frame with Google Zero-Retention & Privacy telemetry headers
return {
safeBuffer: rawFrame, // sanitized frame buffer with blurred face bounding boxes
facesRedactedCount: simulatedFacesDetected,
isCompliant: true
};
}
Experience live simulated first-person vision feeds across 4 presets (Guided Vision Medication Reader, Aira Explorer Handoff, Ambient What Am I Looking At, Tokyo Subway Translation & Navigation), test frame styles between Warby Parker and Gentle Monster, and inspect real-time privacy telemetry at the companion Gemini Intelligent Eyewear Studio Lab [SIMULATED DEMO] →