AnthropicCacheControlValidator
Namespace: Vercel.AI.Anthropic
public sealed class AnthropicCacheControlValidatorReads cache_control and enforces Anthropic’s four-breakpoint limit.
Inheritance: object
Constructors
Section titled “Constructors”AnthropicCacheControlValidator(string)
Section titled “AnthropicCacheControlValidator(string)”public AnthropicCacheControlValidator(string providerOptionsName = "anthropic")Creates a validator. <code class=“paramref”>providerOptionsName</code> is read before anthropic.
Parameters
| Name | Type | Description |
|---|---|---|
providerOptionsName |
string |
Properties
Section titled “Properties”Warnings
Section titled “Warnings”public IReadOnlyList<AnthropicWarning> Warnings { get; }Warnings collected while reading cache controls.
Value: IReadOnlyList<AnthropicWarning>
Methods
Section titled “Methods”Get(JsonElement?, string, bool)
Section titled “Get(JsonElement?, string, bool)”public JsonObject? Get(JsonElement? providerMetadata, string contextType, bool canCache)Returns the cache control object when this context may cache it.
Parameters
| Name | Type | Description |
|---|---|---|
providerMetadata |
JsonElement? | |
contextType |
string | |
canCache |
bool |
Returns: JsonObject
Read(JsonElement?)
Section titled “Read(JsonElement?)”public static JsonObject? Read(JsonElement? providerMetadata)Reads cacheControl or cache_control from Anthropic provider metadata.
Parameters
| Name | Type | Description |
|---|---|---|
providerMetadata |
JsonElement? |
Returns: JsonObject
Read(JsonElement?, string)
Section titled “Read(JsonElement?, string)”public static JsonObject? Read(JsonElement? providerMetadata, string providerOptionsName)Reads the cache control from <code class=“paramref”>providerOptionsName</code>, falling back to the anthropic namespace.
Parameters
| Name | Type | Description |
|---|---|---|
providerMetadata |
JsonElement? | |
providerOptionsName |
string |
Returns: JsonObject
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product