diff --git a/src/core/llm/anthropic.ts b/src/core/llm/anthropic.ts index 5bbf0f1..2c88a12 100644 --- a/src/core/llm/anthropic.ts +++ b/src/core/llm/anthropic.ts @@ -26,6 +26,8 @@ import { export class AnthropicProvider implements BaseLLMProvider { private client: Anthropic + private static readonly DEFAULT_MAX_TOKENS = 8192 + constructor(apiKey: string) { this.client = new Anthropic({ apiKey, dangerouslyAllowBrowser: true }) } @@ -55,7 +57,8 @@ export class AnthropicProvider implements BaseLLMProvider { .map((m) => AnthropicProvider.parseRequestMessage(m)), system: systemMessages.length > 0 ? systemMessages[0].content : undefined, - max_tokens: request.max_tokens ?? 4096, + max_tokens: + request.max_tokens ?? AnthropicProvider.DEFAULT_MAX_TOKENS, temperature: request.temperature, top_p: request.top_p, }, @@ -101,7 +104,8 @@ export class AnthropicProvider implements BaseLLMProvider { .map((m) => AnthropicProvider.parseRequestMessage(m)), system: systemMessages.length > 0 ? systemMessages[0].content : undefined, - max_tokens: request.max_tokens ?? 4096, + max_tokens: + request.max_tokens ?? AnthropicProvider.DEFAULT_MAX_TOKENS, temperature: request.temperature, top_p: request.top_p, stream: true,