StreamProviderError
Namespace: Vercel.AI.Util
public sealed class StreamProviderError : AiSdkError, ISerializable, IErrorMarkersError reported by a provider after a model response stream has started.
Inheritance: object → Exception → AiSdkError
Implements: ISerializable, IErrorMarkers
Constructors
Section titled “Constructors”StreamProviderError(string, string?, object?, int?, bool?, object?, Exception?)
Section titled “StreamProviderError(string, string?, object?, int?, bool?, object?, Exception?)”public StreamProviderError(string message, string? type = null, object? code = null, int? statusCode = null, bool? isRetryable = null, object? data = null, Exception? cause = null)Creates the error from provider metadata.
Parameters
| Name | Type | Description |
|---|---|---|
message |
string | |
type |
string | |
code |
object | |
statusCode |
int? | |
isRetryable |
bool? | |
data |
object | |
cause |
Exception |
Fields
Section titled “Fields”ErrorMarker
Section titled “ErrorMarker”public const string ErrorMarker = "vercel.ai.error.AI_StreamProviderError"Marker for IsInstance(object).
Value: string
Properties
Section titled “Properties”public object? Code { get; }Provider-defined error code.
Value: object
public object? Data { get; }Original provider error payload.
Value: object
IsRetryable
Section titled “IsRetryable”public bool IsRetryable { get; }Whether retrying the model call may succeed.
Value: bool
StatusCode
Section titled “StatusCode”public int? StatusCode { get; }HTTP-equivalent status code.
Value: int?
public string? Type { get; }Provider-defined error type.
Value: string
Methods
Section titled “Methods”IsInstance(object?)
Section titled “IsInstance(object?)”public static bool IsInstance(object? error)Returns whether <code class=“paramref”>error</code> carries this error’s marker.
Parameters
| Name | Type | Description |
|---|---|---|
error |
object |
Returns: bool
IsRetryableStatusCode(int?)
Section titled “IsRetryableStatusCode(int?)”public static bool IsRetryableStatusCode(int? statusCode)Retryable statuses are 408, 409, 429, and 500 and above.
Parameters
| Name | Type | Description |
|---|---|---|
statusCode |
int? |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product