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

feat: increase default max tokens for Anthropic to 8192 #137

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading