Skip to content

AnthropicBatch

Namespace: Vercel.AI.Anthropic

public static class AnthropicBatch

Validation and status mapping for the Anthropic Message Batches API.

Inheritance: object

View source

public static AnthropicBatchCounts Count(int processing, int succeeded, int errored, int canceled, int expired)

Builds SDK counts from the provider request_counts object.

Parameters

Name Type Description
processing int
succeeded int
errored int
canceled int
expired int

Returns: AnthropicBatchCounts

View source

public static AnthropicBatchCounts Count(JsonElement batch)

Reads counts from a batch JSON object.

Parameters

Name Type Description
batch JsonElement

Returns: AnthropicBatchCounts

View source

public static string MapStatus(string? processingStatus)

Maps processing status. ended is completed. Other known states are pending.

Parameters

Name Type Description
processingStatus string

Returns: string

View source

public static bool MissingResults(JsonElement batch)

True when a completed batch has no results URL.

Parameters

Name Type Description
batch JsonElement

Returns: bool

View source

public static void RejectSpeed(string? speed, bool fallbackSpeed)

Rejects speed and fallback speed, which batches do not support.

Parameters

Name Type Description
speed string
fallbackSpeed bool

View source

public static bool ResultsUnavailable(JsonElement batch)

True when the batch is still pending, so results cannot be read.

Parameters

Name Type Description
batch JsonElement

Returns: bool

View source

public static void ValidateRequestId(string id)

Throws when <code class=“paramref”>id</code> is not 1–64 letters, digits, underscores, or hyphens.

Parameters

Name Type Description
id string

View source

public static void ValidateRequestIds(IEnumerable<string> ids)

Validates ids and rejects duplicates before any HTTP call.

Parameters

Name Type Description
ids IEnumerable<string>

View source

public static void ValidateRequestType(string? type)

Rejects request types the batches API does not accept, such as image.

Parameters

Name Type Description
type string

View source

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