mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #1262 from RooVetGit/cte/lower-default-max-tokens
Fix maxTokens defaults for Claude 3.7 Sonnet models
This commit is contained in:
commit
390932ea68
7 changed files with 15 additions and 40 deletions
5
.changeset/tasty-grapes-suffer.md
Normal file
5
.changeset/tasty-grapes-suffer.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Fix maxTokens defaults for Claude 3.7 Sonnet models
|
||||
|
|
@ -278,7 +278,7 @@ export async function getOpenRouterModels() {
|
|||
modelInfo.supportsPromptCache = true
|
||||
modelInfo.cacheWritesPrice = 3.75
|
||||
modelInfo.cacheReadsPrice = 0.3
|
||||
modelInfo.maxTokens = 64_000
|
||||
modelInfo.maxTokens = rawModel.id === "anthropic/claude-3.7-sonnet:thinking" ? 64_000 : 16_384
|
||||
break
|
||||
case rawModel.id.startsWith("anthropic/claude-3.5-sonnet-20240620"):
|
||||
modelInfo.supportsPromptCache = true
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export const anthropicModels = {
|
|||
thinking: true,
|
||||
},
|
||||
"claude-3-7-sonnet-20250219": {
|
||||
maxTokens: 64_000,
|
||||
maxTokens: 16_384,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsComputerUse: true,
|
||||
|
|
@ -437,7 +437,7 @@ export type VertexModelId = keyof typeof vertexModels
|
|||
export const vertexDefaultModelId: VertexModelId = "claude-3-7-sonnet@20250219"
|
||||
export const vertexModels = {
|
||||
"claude-3-7-sonnet@20250219:thinking": {
|
||||
maxTokens: 64000,
|
||||
maxTokens: 64_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsComputerUse: true,
|
||||
|
|
@ -449,7 +449,7 @@ export const vertexModels = {
|
|||
thinking: true,
|
||||
},
|
||||
"claude-3-7-sonnet@20250219": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 16_384,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: true,
|
||||
supportsComputerUse: true,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import * as vscodemodels from "vscode"
|
|||
import {
|
||||
ApiConfiguration,
|
||||
ModelInfo,
|
||||
ApiProvider,
|
||||
anthropicDefaultModelId,
|
||||
anthropicModels,
|
||||
azureOpenAiDefaultApiVersion,
|
||||
|
|
@ -1385,7 +1384,6 @@ const ApiOptions = ({
|
|||
apiConfiguration={apiConfiguration}
|
||||
setApiConfigurationField={setApiConfigurationField}
|
||||
modelInfo={selectedModelInfo}
|
||||
provider={selectedProvider as ApiProvider}
|
||||
/>
|
||||
<ModelInfoView
|
||||
selectedModelId={selectedModelId}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useEffect, useMemo } from "react"
|
||||
import { ApiProvider } from "../../../../src/shared/api"
|
||||
|
||||
import { Slider } from "@/components/ui"
|
||||
|
||||
import { ApiConfiguration, ModelInfo } from "../../../../src/shared/api"
|
||||
|
|
@ -8,16 +8,10 @@ interface ThinkingBudgetProps {
|
|||
apiConfiguration: ApiConfiguration
|
||||
setApiConfigurationField: <K extends keyof ApiConfiguration>(field: K, value: ApiConfiguration[K]) => void
|
||||
modelInfo?: ModelInfo
|
||||
provider?: ApiProvider
|
||||
}
|
||||
|
||||
export const ThinkingBudget = ({
|
||||
apiConfiguration,
|
||||
setApiConfigurationField,
|
||||
modelInfo,
|
||||
provider,
|
||||
}: ThinkingBudgetProps) => {
|
||||
const tokens = apiConfiguration?.modelMaxTokens || modelInfo?.maxTokens || 64_000
|
||||
export const ThinkingBudget = ({ apiConfiguration, setApiConfigurationField, modelInfo }: ThinkingBudgetProps) => {
|
||||
const tokens = apiConfiguration?.modelMaxTokens || 16_384
|
||||
const tokensMin = 8192
|
||||
const tokensMax = modelInfo?.maxTokens || 64_000
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ describe("ApiOptions", () => {
|
|||
})
|
||||
|
||||
expect(screen.getByTestId("thinking-budget")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("thinking-budget")).toHaveAttribute("data-provider", "anthropic")
|
||||
})
|
||||
|
||||
it("should show ThinkingBudget for Vertex models that support thinking", () => {
|
||||
|
|
@ -104,7 +103,6 @@ describe("ApiOptions", () => {
|
|||
})
|
||||
|
||||
expect(screen.getByTestId("thinking-budget")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("thinking-budget")).toHaveAttribute("data-provider", "vertex")
|
||||
})
|
||||
|
||||
it("should not show ThinkingBudget for models that don't support thinking", () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React from "react"
|
||||
import { render, screen, fireEvent } from "@testing-library/react"
|
||||
import { ThinkingBudget } from "../ThinkingBudget"
|
||||
import { ApiProvider, ModelInfo } from "../../../../../src/shared/api"
|
||||
import { ModelInfo } from "../../../../../src/shared/api"
|
||||
|
||||
// Mock Slider component
|
||||
jest.mock("@/components/ui", () => ({
|
||||
|
|
@ -25,11 +24,11 @@ describe("ThinkingBudget", () => {
|
|||
supportsPromptCache: true,
|
||||
supportsImages: true,
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
apiConfiguration: {},
|
||||
setApiConfigurationField: jest.fn(),
|
||||
modelInfo: mockModelInfo,
|
||||
provider: "anthropic" as ApiProvider,
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
@ -60,7 +59,7 @@ describe("ThinkingBudget", () => {
|
|||
expect(screen.getAllByTestId("slider")).toHaveLength(2)
|
||||
})
|
||||
|
||||
it("should use modelMaxThinkingTokens field for Anthropic provider", () => {
|
||||
it("should update modelMaxThinkingTokens", () => {
|
||||
const setApiConfigurationField = jest.fn()
|
||||
|
||||
render(
|
||||
|
|
@ -68,25 +67,6 @@ describe("ThinkingBudget", () => {
|
|||
{...defaultProps}
|
||||
apiConfiguration={{ modelMaxThinkingTokens: 4096 }}
|
||||
setApiConfigurationField={setApiConfigurationField}
|
||||
provider="anthropic"
|
||||
/>,
|
||||
)
|
||||
|
||||
const sliders = screen.getAllByTestId("slider")
|
||||
fireEvent.change(sliders[1], { target: { value: "5000" } })
|
||||
|
||||
expect(setApiConfigurationField).toHaveBeenCalledWith("modelMaxThinkingTokens", 5000)
|
||||
})
|
||||
|
||||
it("should use modelMaxThinkingTokens field for Vertex provider", () => {
|
||||
const setApiConfigurationField = jest.fn()
|
||||
|
||||
render(
|
||||
<ThinkingBudget
|
||||
{...defaultProps}
|
||||
apiConfiguration={{ modelMaxThinkingTokens: 4096 }}
|
||||
setApiConfigurationField={setApiConfigurationField}
|
||||
provider="vertex"
|
||||
/>,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue