Skip to content

SpeechTextStream

Namespace: Vercel.AI.Operations

public sealed class SpeechTextStream : IAsyncEnumerable<SpeechTextPart>

The text a speech model reads. The provider owns it once doStream is called: it must enumerate it to the end or dispose its enumerator on every terminal path.

Inheritance: object

Implements: IAsyncEnumerable<SpeechTextPart>

View source

SpeechTextStream(IAsyncEnumerable<SpeechTextPart>)

Section titled “SpeechTextStream(IAsyncEnumerable<SpeechTextPart>)”
public SpeechTextStream(IAsyncEnumerable<SpeechTextPart> source)

Creates a stream over <code class=“paramref”>source</code>.

Parameters

Name Type Description
source IAsyncEnumerable<SpeechTextPart>

View source

public bool Locked { get; }

True after the model takes the enumerator.

Value: bool

View source

public Task CancelAsync()

Releases a stream no model took. A locked stream stays with the model.

Returns: Task

View source

public IAsyncEnumerator<SpeechTextPart> GetAsyncEnumerator(CancellationToken cancellationToken = default)

Takes the single enumerator.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: IAsyncEnumerator<SpeechTextPart>

View source

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