Skip to content

AmazonBedrockAnthropicRequests

Namespace: Vercel.AI.AmazonBedrock

public static class AmazonBedrockAnthropicRequests

Builds InvokeModel URLs and the Bedrock Anthropic request body.

Inheritance: object

View source

public static string BuildUrl(string baseUrl, string modelId, bool streaming)

InvokeModel URL. Streaming uses invoke-with-response-stream.

Parameters

Name Type Description
baseUrl string
modelId string
streaming bool

Returns: string

View source

public static string ToAnthropicErrorBody(string text)

Rewrites a Bedrock error body into the Anthropic { type: error, error } shape.

Parameters

Name Type Description
text string

Returns: string

View source

Transform(JsonObject, IReadOnlyList<string>?)

Section titled “Transform(JsonObject, IReadOnlyList<string>?)”
public static JsonObject Transform(JsonObject source, IReadOnlyList<string>? betas = null)

Drops model and stream, keeps a tool choice type and name, renames the thinking block binding field, upgrades computer-use tool versions, moves the betas into anthropic_beta, and sets anthropic_version to bedrock-2023-05-31.

Parameters

Name Type Description
source JsonObject
betas IReadOnlyList<string>

Returns: JsonObject

View source

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