AnthropicBatch
Namespace: Vercel.AI.Anthropic
public static class AnthropicBatchValidation and status mapping for the Anthropic Message Batches API.
Inheritance: object
Methods
Section titled “Methods”Count(int, int, int, int, int)
Section titled “Count(int, int, int, int, int)”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
Count(JsonElement)
Section titled “Count(JsonElement)”public static AnthropicBatchCounts Count(JsonElement batch)Reads counts from a batch JSON object.
Parameters
| Name | Type | Description |
|---|---|---|
batch |
JsonElement |
Returns: AnthropicBatchCounts
MapStatus(string?)
Section titled “MapStatus(string?)”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
MissingResults(JsonElement)
Section titled “MissingResults(JsonElement)”public static bool MissingResults(JsonElement batch)True when a completed batch has no results URL.
Parameters
| Name | Type | Description |
|---|---|---|
batch |
JsonElement |
Returns: bool
RejectSpeed(string?, bool)
Section titled “RejectSpeed(string?, bool)”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 |
ResultsUnavailable(JsonElement)
Section titled “ResultsUnavailable(JsonElement)”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
ValidateRequestId(string)
Section titled “ValidateRequestId(string)”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 |
ValidateRequestIds(IEnumerable<string>)
Section titled “ValidateRequestIds(IEnumerable<string>)”public static void ValidateRequestIds(IEnumerable<string> ids)Validates ids and rejects duplicates before any HTTP call.
Parameters
| Name | Type | Description |
|---|---|---|
ids |
IEnumerable<string> |
ValidateRequestType(string?)
Section titled “ValidateRequestType(string?)”public static void ValidateRequestType(string? type)Rejects request types the batches API does not accept, such as image.
Parameters
| Name | Type | Description |
|---|---|---|
type |
string |
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product