Skip to content

GoogleRealtime

Namespace: Vercel.AI.Google

public sealed class GoogleRealtime

Maps Gemini Live WebSocket messages. No socket is opened, so this compiles on netstandard2.0.

Inheritance: object

View source

public static JsonObject BuildSession(GoogleRealtimeSession session)

Builds the Live setup object.

Parameters

Name Type Description
session GoogleRealtimeSession

Returns: JsonObject

View source

public static JsonNode FunctionResponse(string? output)

Wraps a non-object tool result in { output } so the Live API receives a Struct.

Parameters

Name Type Description
output string

Returns: JsonNode

View source

public IReadOnlyList<GoogleRealtimeEvent> ParseServerEvent(JsonElement raw)

Maps one server message into one or more normalized events.

Parameters

Name Type Description
raw JsonElement

Returns: IReadOnlyList<GoogleRealtimeEvent>

View source

SerializeClient(string, GoogleRealtimeSession?, string?, string?, string?, string?, string?)

Section titled “SerializeClient(string, GoogleRealtimeSession?, string?, string?, string?, string?, string?)”
public JsonObject? SerializeClient(string type, GoogleRealtimeSession? session, string? audio, string? text, string? callId, string? callName, string? callOutput)

Serializes a client event. Returns null for events Gemini Live ignores.

Parameters

Name Type Description
type string
session GoogleRealtimeSession
audio string
text string
callId string
callName string
callOutput string

Returns: JsonObject

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product