ModelPartStream
Namespace: Vercel.AI.Operations
public sealed class ModelPartStreamModel stream that stays open until Cancel() when Completes is false.
Inheritance: object
Constructors
Section titled “Constructors”ModelPartStream(IReadOnlyList<ModelStreamPart>, bool, Exception?)
Section titled “ModelPartStream(IReadOnlyList<ModelStreamPart>, bool, Exception?)”public ModelPartStream(IReadOnlyList<ModelStreamPart> parts, bool completes = true, Exception? failure = null)Creates a scripted stream.
Parameters
| Name | Type | Description |
|---|---|---|
parts |
IReadOnlyList<ModelStreamPart> | |
completes |
bool | |
failure |
Exception |
Properties
Section titled “Properties”Cancelled
Section titled “Cancelled”public bool Cancelled { get; }True after Cancel().
Value: bool
Completes
Section titled “Completes”public bool Completes { get; }True when the stream ends after Parts.
Value: bool
Failure
Section titled “Failure”public Exception? Failure { get; }Error raised after the scripted parts.
Value: Exception
public IReadOnlyList<ModelStreamPart> Parts { get; }Scripted parts.
Value: IReadOnlyList<ModelStreamPart>
Methods
Section titled “Methods”Cancel()
Section titled “Cancel()”public void Cancel()Stops a stream that has not completed.
ReadAsync(CancellationToken)
Section titled “ReadAsync(CancellationToken)”public IAsyncEnumerable<ModelStreamPart> ReadAsync(CancellationToken cancellationToken = default)Reads the scripted parts, then waits when the stream stays open.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: IAsyncEnumerable<ModelStreamPart>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product