Skip to content

OpenAITranscriptionModel

Namespace: Vercel.AI.OpenAI

public sealed class OpenAITranscriptionModel : ITranscriptionModel

OpenAI audio transcription model.

Inheritance: object

Implements: ITranscriptionModel

View source

OpenAITranscriptionModel(OpenAIProvider, string, Func<DateTimeOffset>?)

Section titled “OpenAITranscriptionModel(OpenAIProvider, string, Func<DateTimeOffset>?)”
public OpenAITranscriptionModel(OpenAIProvider provider, string modelId, Func<DateTimeOffset>? clock = null)

Creates a transcription model. <code class=“paramref”>clock</code> sets the response timestamp and defaults to UTC now.

Parameters

Name Type Description
provider OpenAIProvider
modelId string
clock Func<DateTimeOffset>

View source

OpenAITranscriptionModel(OpenAIProvider, string, string, Func<DateTimeOffset>?)

Section titled “OpenAITranscriptionModel(OpenAIProvider, string, string, Func<DateTimeOffset>?)”
public OpenAITranscriptionModel(OpenAIProvider provider, string modelId, string path, Func<DateTimeOffset>? clock = null)

Creates a transcription or translation model for <code class=“paramref”>path</code>.

Parameters

Name Type Description
provider OpenAIProvider
modelId string
path string
clock Func<DateTimeOffset>

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public MultipartFormDataContent Build(OpenAITranscriptionCall call)

Builds the multipart body so tests can inspect field names.

Parameters

Name Type Description
call OpenAITranscriptionCall

Returns: MultipartFormDataContent

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 IsRealtimeWhisper(string modelId)

True when <code class=“paramref”>modelId</code> must use the realtime transcription socket.

Parameters

Name Type Description
modelId string

Returns: bool

View source

TranscribeAsync(OpenAITranscriptionCall, CancellationToken)

Section titled “TranscribeAsync(OpenAITranscriptionCall, CancellationToken)”
public Task<OpenAITranscriptionResult> TranscribeAsync(OpenAITranscriptionCall call, CancellationToken cancellationToken)

Transcribes audio and returns segments, language, duration, and response metadata.

Parameters

Name Type Description
call OpenAITranscriptionCall
cancellationToken CancellationToken

Returns: Task<OpenAITranscriptionResult>

View source

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