Skip to content

Commit

Permalink
feat: increase default max tokens for Anthropic to 8192 (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-on authored Nov 26, 2024
1 parent 5aed8bc commit c403922
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/llm/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c403922

Please sign in to comment.