Back to Copilotkit

AnthropicAdapter

docs/content/docs/reference/v1/classes/llm-adapters/AnthropicAdapter.mdx

1.57.01.1 KB
Original Source

{ /*

  • ATTENTION! DO NOT MODIFY THIS FILE!
  • This page is auto-generated. If you want to make any changes to this page, changes must be made at:
  • packages/runtime/src/service-adapters/anthropic/anthropic-adapter.ts */ } Copilot Runtime adapter for Anthropic.

Example

ts
import { CopilotRuntime, AnthropicAdapter } from "@copilotkit/runtime";
import Anthropic from "@anthropic-ai/sdk";
 
const copilotKit = new CopilotRuntime();
 
const anthropic = new Anthropic({
  apiKey: "<your-api-key>",
});
 
return new AnthropicAdapter({
  anthropic,
  promptCaching: {
    enabled: true,
    debug: true
  }
});

Constructor Parameters

<PropertyReference name="anthropic" type="Anthropic" > An optional Anthropic instance to use. If not provided, a new instance will be created. </PropertyReference> <PropertyReference name="model" type="string" > The model to use. </PropertyReference> <PropertyReference name="promptCaching" type="AnthropicPromptCachingConfig" > Configuration for prompt caching. See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching </PropertyReference>