Skip to content

Vercel.AI.Util

API reference

Errors, downloads, warnings, and helpers.

Type Summary
AbortController Controller for an AbortSignal.
AbortSignal Abort signal that records the first reason.
AiSdkError Base error for upstream AI SDK error types. Marker checks work without a shared assembly.
ApiCallError A failed provider HTTP call, including retry metadata and response headers.
AssetDownloadCall Arguments passed to a single asset download.
AsyncIterableStream<T> A readable stream that can also be enumerated with await foreach.
AsyncIterableStreams Wraps readable streams so they can be consumed with async iteration.
Callbacks Invokes callbacks and ignores individual failures.
CanonicalHash Canonical JSON and its SHA-256 base64url digest.
Collections Array and property helpers from the AI SDK util package.
CompatibilityWarning A feature running in compatibility mode.
DataObject Object with an explicit constructor token and own properties. Used where JavaScript distinguishes prototypes and inherited names.
DataUrl Reads text from text/ data URLs.
DecisionRefusalError A decision model refused one or more questions.
DecisionUnsupportedQuestionTypeError A decision model does not support the type of a requested question.
DeepEqual Deep equality for JSON-like data, including dates and prototype identity.
DefaultDownloadFunction Default download function: downloads URLs the model cannot fetch itself.
DeprecatedWarning A deprecated setting.
Deprecations Stable codes for deprecation warnings.
Download Downloads a URL with SSRF checks on every redirect hop.
DownloadError Failure while downloading a URL.
DownloadRequest Options passed to a download fetch implementation.
DownloadRequestItem One URL passed to DefaultDownloadFunction.
DownloadResponse One HTTP response seen by Download.
DownloadResult Bytes and media type returned by Download.GetAsync.
ErrorMarkerBag Plain marker bag used to recognize an error shape copied across packages.
EvaluationUnsupportedQuestionTypeError Deprecated alias of DecisionUnsupportedQuestionTypeError. It carries the decision error marker.
FixJson Repairs truncated JSON by scanning once and closing open strings, literals, arrays, and objects.
HeaderCollection Case-insensitive header list that preserves repeated values such as Set-Cookie.
IdMap<T> String-keyed map with no inherited members. Missing keys, including proto, return the default value.
InvalidArgumentError An argument failed validation. Message format matches the TypeScript SDK.
InvalidToolInputError The input of a tool call does not match the tool’s input schema. Maps to InvalidToolInputError.
JsUndefined Sentinel for a JavaScript undefined value. Distinct from null.
LanguageModelCallOptionsInput Model call options validated by LanguageModelCallPreparation.
LanguageModelCallPreparation Validates language-model call options. PrepareCallSettings(LanguageModelCallOptionsInput) is the deprecated alias.
LogWarnings Logs provider warnings. Set Logger to false to suppress them, or to a delegate to replace the default emitter.
LogWarningsOptions Arguments passed to Log(LogWarningsOptions).
MergeAbortSignals Combines abort signals and timeout durations.
ModelWarning A warning returned by a model provider.
NoSuchModelError A provider has no model with the requested id. Maps to NoSuchModelError.
NoSuchProviderError A registry has no provider with the requested id. Maps to NoSuchProviderError.
NoSuchToolError The model called a tool that is not available. Maps to NoSuchToolError.
ObjectMerge Deep-merges JSON objects. Arrays, dates, and regular expressions are replaced.
OtherWarning A provider warning that is not one of the structured kinds.
PartialJson Parses complete JSON, or JSON repaired by FixJson.
PartialJsonResult Outcome of Parse(string).
PrepareHeaders Fills default headers without replacing headers the caller already set.
PrepareRetries Validates maxRetries and builds the default retry strategy.
PrepareRetries.Result Result of Int32).
ReadableStream<T> Pull-based readable stream. Supports enqueue, close, error, backpressure via pull, and a single reader.
ReadableStreamController<T> Enqueues chunks into a ReadableStream%601.
ReadableStreamReader<T> Default reader for a ReadableStream%601.
RetryError Retries were exhausted or stopped.
RetryOptions Options for RetryWithExponentialBackoffRespectingRetryHeaders.
RetryWithExponentialBackoffRespectingRetryHeaders Retries a failed operation with exponential backoff, honoring retry-after-ms and retry-after when the delay is between 0 and 60 seconds, or shorter than the backoff delay.
SerialJobExecutor Runs async jobs one at a time, in submission order.
ServerResponse Byte sink with status, headers, and optional write backpressure. Mirrors the subset of Node ServerResponse used by the text-stream helpers.
ServerResponseWriter Writes a byte stream to a ServerResponse.
SetAbortTimeout Schedules an abort when a timeout elapses.
SimulateReadableStream Emits scripted chunks, optionally delaying each pull.
StitchableStream<T> A stream that reads inner streams one at a time.
StreamIterator<T> Async iterator over a ReadableStream%601.
StreamProviderError Error reported by a provider after a model response stream has started.
TextStreamPart One part of a model text stream.
TextStreamResponse HTTP response whose body is a UTF-8 text stream.
TextStreams Text-stream helpers: keep text deltas, build a response, and write it to a server response.
TimeoutError DOM TimeoutError analog used as an abort reason.
ToolCallRepairError The repair of a tool call failed. Maps to ToolCallRepairError.
ToolInputSchemaValidator Validates a tool call input against the JSON Schema of a tool. Covers the keywords tool schemas use: type, enum, const, properties, required, additionalProperties, items, minItems, maxItems, minLength, maxLength, minimum, maximum, anyOf, oneOf and allOf. Other keywords are ignored.
UndefinedStreamError Rejection whose reason is JavaScript undefined.
UnsupportedWarning A feature the provider does not support.
Type Summary
IteratorResult<T> Result of one async-iterator step.
StreamRead<T> One read from a ReadableStream%601.
Type Summary
IErrorMarkers Reads error markers used to recognize AI SDK errors across assembly copies. Mirrors Symbol.for markers in the TypeScript SDK.
Type Summary
RetryErrorReason Why RetryError stopped retrying.
Type Summary
DownloadFetch Fetches one URL for Download.

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