Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt caching #628

Open
Kaankoska22 opened this issue Dec 15, 2024 · 2 comments
Open

Prompt caching #628

Kaankoska22 opened this issue Dec 15, 2024 · 2 comments

Comments

@Kaankoska22
Copy link

Hi I couldn't make this call work what am I doing wrong?

const response = await anthropic.beta.prompt_caching.messages.create({
betas: ['prompt-caching-2024-07-31'],
model: "claude-3-5-sonnet-20241022",
max_tokens: 1024,
system: [
{
type: "text",
text: "You are an AI assistant tasked with analyzing literary works. Your goal is to provide insightful commentary on themes, characters, and writing style.\n",
},
{
type: "text",
text: Bigprompt,
cache_control: { type: "ephemeral" }
}
],
messages: [
{
role: "user",
content: "example query"
}
]
});

@IbrohimIsroilov
Copy link

I think they disabled promptCaching, countTokens.

function makeBetaResource(client: AnthropicBedrock): BetaResource {
const resource = new Resources.Beta(client);

// @ts-expect-error we're deleting non-optional properties
delete resource.promptCaching;

// @ts-expect-error we're deleting non-optional properties
delete resource.messages.batches;

// @ts-expect-error we're deleting non-optional properties
delete resource.messages.countTokens;

return resource;
}

@goodroot
Copy link

I don't think this is in the SDK yet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants