Skip to content

Commit 003388a

Browse files
Fix maxTokens to 8192 only for compatible Anthropic models (#1862)
Fix maxTokens to 8096 only for compatible Anthropic models Co-authored-by: Pugazhendhi <[email protected]>
1 parent 3c3dd9d commit 003388a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/twelve-pumpkins-sit.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Changes maxTokens to 8192 for anthropic models that supports it
6+
anthropic/claude-3-sonnet, claude-3-opus, claude-3-haiku supports maxTokens of 4096.
7+
This change keeps the max tokens the same for those models

src/api/providers/unbound.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ export async function getUnboundModels() {
212212

213213
switch (true) {
214214
case modelId.startsWith("anthropic/"):
215-
modelInfo.maxTokens = 8192
215+
// Set max tokens to 8192 for supported Anthropic models
216+
if (modelInfo.maxTokens !== 4096) {
217+
modelInfo.maxTokens = 8192
218+
}
216219
break
217220
default:
218221
break

0 commit comments

Comments
 (0)