Skip to content

OperationFullStream<T>

Namespace: Vercel.AI.Operations

public sealed class OperationFullStream<T> : IAsyncEnumerable<T>

A single-consumer stream with an explicit Cancel.

Type parameters

Name Description
T

Inheritance: object

Implements: IAsyncEnumerable<T>

View source

OperationFullStream(Func<IAsyncEnumerator<T>>, Action)

Section titled “OperationFullStream(Func<IAsyncEnumerator<T>>, Action)”
public OperationFullStream(Func<IAsyncEnumerator<T>> open, Action cancel)

Creates a stream.

Parameters

Name Type Description
open Func<IAsyncEnumerator<T>>
cancel Action

View source

OperationFullStream(Func<CancellationToken, IAsyncEnumerator<T>>, Action)

Section titled “OperationFullStream(Func<CancellationToken, IAsyncEnumerator<T>>, Action)”
public OperationFullStream(Func<CancellationToken, IAsyncEnumerator<T>> open, Action cancel)

Creates a stream whose enumerator observes the token passed to CancellationToken).

Parameters

Name Type Description
open Func<CancellationToken, IAsyncEnumerator<T>>
cancel Action

View source

public void Cancel()

Cancels the stream and aborts a pending model call.

View source

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

Returns the single enumerator.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: IAsyncEnumerator<T>

View source

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