experimental_getBatchResults
API Reference for experimental_getBatchResults.
Batch support is experimental and the API may change in patch releases.
Returns an async iterable of terminal results for the requests in an asynchronous batch. For a complete guide to the batch lifecycle, see Batch.
Import
import { experimental_getBatchResults } from "ai"
API Signature
Parameters
provider?:
batch:
tools?:
providerOptions?:
maxRetries?:
abortSignal?:
timeout?:
headers?:
Returns
An AsyncIterableStream<Experimental_BatchItemResult> of succeeded,
failed, cancelled, or expired request results. You can consume the stream as
either an async iterable or a ReadableStream.
Successful items contain id, status: 'succeeded', text, normalized
content (including text, reasoning, sources, files, tool calls, and tool
results),
finishReason, usage, and optional response and provider metadata. text is
the concatenation of text parts and can be an empty string when a result
contains no text parts.
Failed, cancelled, and expired items contain the request id, their terminal
status, and optional error details.