@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
62 lines (61 loc) • 1.9 kB
text/typescript
import "reflect-metadata";
import { CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotServiceAdapter } from "../service-adapter.mjs";
import { LanguageModel } from "ai";
import Anthropic from "@anthropic-ai/sdk";
//#region src/service-adapters/anthropic/anthropic-adapter.d.ts
interface AnthropicPromptCachingConfig {
/**
* Whether to enable prompt caching.
*/
enabled: boolean;
/**
* Whether to enable debug logging for cache operations.
*/
debug?: boolean;
}
interface AnthropicAdapterParams {
/**
* An optional Anthropic instance to use. If not provided, a new instance will be
* created.
*/
anthropic?: Anthropic;
/**
* The model to use.
*/
model?: string;
/**
* Configuration for prompt caching.
* See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
*/
promptCaching?: AnthropicPromptCachingConfig;
/**
* Optional maximum input token limit. Overrides the default limit
* used when trimming messages to fit the context window.
*/
maxInputTokens?: number;
}
declare class AnthropicAdapter implements CopilotServiceAdapter {
model: string;
provider: string;
private promptCaching;
private maxInputTokens?;
private _anthropic;
get anthropic(): Anthropic;
get name(): string;
constructor(params?: AnthropicAdapterParams);
getLanguageModel(): LanguageModel;
private ensureAnthropic;
/**
* Adds cache control to system prompt
*/
private addSystemPromptCaching;
/**
* Adds cache control to the final message
*/
private addIncrementalMessageCaching;
private shouldGenerateFallbackResponse;
process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
}
//#endregion
export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig };
//# sourceMappingURL=anthropic-adapter.d.mts.map