Skip to content

Commit

Permalink
Merge branch 'main' into feat/chat-image-support
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-on committed Nov 26, 2024
2 parents e55a45d + c403922 commit f28526e
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 @@ -29,6 +29,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 All @@ -54,7 +56,8 @@ export class AnthropicProvider implements BaseLLMProvider {
.filter((m) => m.role !== 'system')
.map((m) => AnthropicProvider.parseRequestMessage(m)),
system: systemMessage,
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 @@ -96,7 +99,8 @@ export class AnthropicProvider implements BaseLLMProvider {
.filter((m) => m.role !== 'system')
.map((m) => AnthropicProvider.parseRequestMessage(m)),
system: systemMessage,
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 f28526e

Please sign in to comment.