Skip to content

AnthropicPrompt

Namespace: Vercel.AI.Anthropic

public static class AnthropicPrompt

Converts SDK prompt messages into Anthropic message blocks.

Inheritance: object

View source

Convert(IReadOnlyList<ModelMessage>, bool, AnthropicCacheControlValidator?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, AnthropicMediaPartConverter?)

Section titled “Convert(IReadOnlyList<ModelMessage>, bool, AnthropicCacheControlValidator?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, AnthropicMediaPartConverter?)”
public static AnthropicPromptResult Convert(IReadOnlyList<ModelMessage> prompt, bool sendReasoning = true, AnthropicCacheControlValidator? cacheControl = null, IReadOnlyDictionary<string, string>? providerToolNames = null, IReadOnlyDictionary<string, string>? toolsetNames = null, AnthropicMediaPartConverter? convertMediaPart = null)

Converts SDK prompt messages. Maps to convertToAnthropicPrompt.

Parameters

Name Type Description
prompt IReadOnlyList<ModelMessage>
sendReasoning bool
cacheControl AnthropicCacheControlValidator
providerToolNames IReadOnlyDictionary<string, string>
toolsetNames IReadOnlyDictionary<string, string>
convertMediaPart AnthropicMediaPartConverter

Returns: AnthropicPromptResult

View source

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