GoogleRealtimeModel
Namespace: Vercel.AI.Google
public sealed class GoogleRealtimeModel : IRealtimeModelRealtime model. Event mapping is local; opening the Live socket is not available on this runtime.
Inheritance: object
Implements: IRealtimeModel
Constructors
Section titled “Constructors”GoogleRealtimeModel(GoogleProvider, string)
Section titled “GoogleRealtimeModel(GoogleProvider, string)”public GoogleRealtimeModel(GoogleProvider provider, string modelId)Creates a realtime model.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
GoogleProvider | |
modelId |
string |
Properties
Section titled “Properties”ModelId
Section titled “ModelId”public string ModelId { get; }Model id.
Value: string
Provider
Section titled “Provider”public string Provider { get; }Provider id.
Value: string
Methods
Section titled “Methods”BuildUri()
Section titled “BuildUri()”public Uri BuildUri()WebSocket URI for this model.
Returns: Uri
ConnectAsync(CancellationToken)
Section titled “ConnectAsync(CancellationToken)”public Task<IRealtimeSession> ConnectAsync(CancellationToken cancellationToken)Opens a realtime session.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: Task<IRealtimeSession>
CreateClientSecretAsync(GoogleRealtimeSession?, int?, CancellationToken)
Section titled “CreateClientSecretAsync(GoogleRealtimeSession?, int?, CancellationToken)”public Task<GoogleRealtimeClientSecret> CreateClientSecretAsync(GoogleRealtimeSession? session, int? expiresAfterSeconds, CancellationToken cancellationToken)Creates an ephemeral auth token that a client uses to open a Live session. <code class=“paramref”>expiresAfterSeconds</code> is the window to open a session and defaults to 60 seconds. The token itself lives 30 minutes longer, so the opened session has room to run.
Parameters
| Name | Type | Description |
|---|---|---|
session |
GoogleRealtimeSession | |
expiresAfterSeconds |
int? | |
cancellationToken |
CancellationToken |
Returns: Task<GoogleRealtimeClientSecret>
GetWebSocketUrl(string, string)
Section titled “GetWebSocketUrl(string, string)”public string GetWebSocketUrl(string token, string url)The URL a client opens with a token from CancellationToken).
Parameters
| Name | Type | Description |
|---|---|---|
token |
string | |
url |
string |
Returns: string
ParseServerEvent(JsonElement)
Section titled “ParseServerEvent(JsonElement)”public IReadOnlyList<GoogleRealtimeEvent> ParseServerEvent(JsonElement raw)Maps one server message with this model’s event mapper.
Parameters
| Name | Type | Description |
|---|---|---|
raw |
JsonElement |
Returns: IReadOnlyList<GoogleRealtimeEvent>
SerializeClientEvent(string, GoogleRealtimeSession?, string?, string?, string?, string?, string?)
Section titled “SerializeClientEvent(string, GoogleRealtimeSession?, string?, string?, string?, string?, string?)”public JsonObject? SerializeClientEvent(string type, GoogleRealtimeSession? session, string? audio, string? text, string? callId, string? callName, string? callOutput)Serializes a client event with this model’s event mapper. A session update uses this model.
Parameters
| Name | Type | Description |
|---|---|---|
type |
string | |
session |
GoogleRealtimeSession | |
audio |
string | |
text |
string | |
callId |
string | |
callName |
string | |
callOutput |
string |
Returns: JsonObject
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product