Selaa lähdekoodia

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]>
pugazhendhi-m 9 kuukautta sitten
vanhempi
sitoutus
003388a5c4
2 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 7 0
      .changeset/twelve-pumpkins-sit.md
  2. 4 1
      src/api/providers/unbound.ts

+ 7 - 0
.changeset/twelve-pumpkins-sit.md

@@ -0,0 +1,7 @@
+---
+"roo-cline": patch
+---
+
+Changes maxTokens to 8192 for anthropic models that supports it
+anthropic/claude-3-sonnet, claude-3-opus, claude-3-haiku supports maxTokens of 4096.
+This change keeps the max tokens the same for those models

+ 4 - 1
src/api/providers/unbound.ts

@@ -212,7 +212,10 @@ export async function getUnboundModels() {
 
 				switch (true) {
 					case modelId.startsWith("anthropic/"):
-						modelInfo.maxTokens = 8192
+						// Set max tokens to 8192 for supported Anthropic models
+						if (modelInfo.maxTokens !== 4096) {
+							modelInfo.maxTokens = 8192
+						}
 						break
 					default:
 						break