Skip to content

GoogleTranscriptionModel

Namespace: Vercel.AI.Google

public sealed class GoogleTranscriptionModel : ITranscriptionModel, ITranscriptionCaller

Gemini transcription. Unary models post to the Interactions API.

Inheritance: object

Implements: ITranscriptionModel, ITranscriptionCaller

View source

GoogleTranscriptionModel(GoogleProvider, string)

Section titled “GoogleTranscriptionModel(GoogleProvider, string)”
public GoogleTranscriptionModel(GoogleProvider provider, string modelId)

Creates a transcription model.

Parameters

Name Type Description
provider GoogleProvider
modelId string

View source

public bool CanStream { get; }

False. The Gemini Live WebSocket is not opened by this port.

Value: bool

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public string SpecificationVersion { get; }

Specification version.

Value: string

View source

public static JsonObject BuildLiveSetup(string modelId)

Builds the Live API setup message. Live models reject a unary call.

Parameters

Name Type Description
modelId string

Returns: JsonObject

View source

BuildRequest(string, AudioInput, JsonObject?)

Section titled “BuildRequest(string, AudioInput, JsonObject?)”
public static JsonObject BuildRequest(string modelId, AudioInput audio, JsonObject? transcriptionConfig)

Builds the Interactions transcription body.

Parameters

Name Type Description
modelId string
audio AudioInput
transcriptionConfig JsonObject

Returns: JsonObject

View source

DoGenerateAsync(TranscriptionModelCall, CancellationToken)

Section titled “DoGenerateAsync(TranscriptionModelCall, CancellationToken)”
public Task<TranscriptionModelResult> DoGenerateAsync(TranscriptionModelCall call, CancellationToken cancellationToken)

Transcribes audio through the Interactions API. google provider options become the transcription_config, and word_info annotations become word segments.

Parameters

Name Type Description
call TranscriptionModelCall
cancellationToken CancellationToken

Returns: Task<TranscriptionModelResult>

View source

DoStreamAsync(TranscriptionStreamCall, CancellationToken)

Section titled “DoStreamAsync(TranscriptionStreamCall, CancellationToken)”
public Task<TranscriptionStreamStart?> DoStreamAsync(TranscriptionStreamCall call, CancellationToken cancellationToken)

Returns null. The Gemini Live WebSocket is not opened by this port.

Parameters

Name Type Description
call TranscriptionStreamCall
cancellationToken CancellationToken

Returns: Task<TranscriptionStreamStart>

View source

DoTranscribeAsync(AudioInput, CancellationToken)

Section titled “DoTranscribeAsync(AudioInput, CancellationToken)”
public Task<TranscriptionResult> DoTranscribeAsync(AudioInput audio, CancellationToken cancellationToken)

Transcribes audio.

Parameters

Name Type Description
audio AudioInput
cancellationToken CancellationToken

Returns: Task<TranscriptionResult>

View source

public static bool IsLive(string modelId)

True when the model id is a Live API transcription model.

Parameters

Name Type Description
modelId string

Returns: bool

View source

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