-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add support for Claude 3.7 Thinking & Budget Tokens #4339
Comments
I just had claude-code write me a patch to support 3.7 so I could try out the new model today. This is what it came up with. Looks OK to me, seems to work with tools support. I didn't run the modified tests. Maybe someone who actually works on this project can add the "thinking" feature to this and send a PR. Date: Mon, 24 Feb 2025 18:01:12 -0500
Subject: [PATCH] claude-3.7 sonnet support
---
CLAUDE.md | 21 +++++++++++++++++++
core/config/default.ts | 11 ++++++++++
core/llm/llm.test.ts | 2 +-
core/llm/llms/Asksage.ts | 1 +
core/llm/llms/FreeTrial.ts | 1 +
core/llm/toolSupport.ts | 4 ++--
extensions/vscode/config_schema.json | 4 +++-
.../vscode/e2e/test-continue-yaml/config.yaml | 4 ++--
.../vscode/e2e/test-continue/config.json | 4 ++--
extensions/vscode/package-lock.json | 4 ++--
gui/src/pages/AddNewModel/configs/models.ts | 16 +++++++++++++-
.../pages/AddNewModel/configs/providers.ts | 1 +
.../packages/test-org/claude37sonnet.yaml | 8 +++++++
packages/llm-info/src/providers/anthropic.ts | 12 ++++++++++-
packages/llm-info/src/providers/bedrock.ts | 6 ++++++
15 files changed, 87 insertions(+), 12 deletions(-)
create mode 100644 CLAUDE.md
create mode 100644 packages/config-yaml/test/packages/test-org/claude37sonnet.yaml
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 000000000..00b08cb8d
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,21 @@
+# Continue Development Guide
+
+## Build & Development Commands
+- **TypeScript Check**: `npm run tsc:check` (all) or `npm run tsc:check -w core` (specific package)
+- **Run Tests**: `cd core && npm run test` (all tests) or `cd core && npm test -- -t "TestName"` (single test)
+- **Lint Code**: `cd core && npm run lint` (check) or `cd core && npm run lint:fix` (auto-fix)
+- **VS Code Extension**: `cd extensions/vscode && npm run esbuild-watch` (build + watch)
+- **GUI**: `cd gui && npm start` (development server)
+
+## Code Style Guidelines
+- **Formatting**: 2-space indentation, double quotes, trailing commas, semicolons required
+- **Imports**: Grouped (builtin → external → internal → parent/sibling) with blank lines between groups
+- **Type Safety**: Always use proper TypeScript types, avoid `any` unless necessary
+- **Error Handling**: Use explicit error handling with try/catch for async operations
+- **Naming**: Use camelCase for variables/functions, PascalCase for classes/interfaces/types
+- **Components**: Follow React functional component patterns with explicit prop types
+- **Testing**: Write unit tests for core functionality using Jest
+- **Comments**: Document complex logic, public APIs, and non-obvious behavior
+
+## Node Requirements
+- Node.js ≥ 20.11.0 required
\ No newline at end of file
diff --git a/core/config/default.ts b/core/config/default.ts
index 23e709603..9dd12cd11 100644
--- a/core/config/default.ts
+++ b/core/config/default.ts
@@ -6,6 +6,17 @@ import {
} from "../";
export const FREE_TRIAL_MODELS: ModelDescription[] = [
+ {
+ title: "Claude 3.7 Sonnet (Free Trial)",
+ provider: "free-trial",
+ model: "claude-3-7-sonnet-latest",
+ systemMessage:
+ "You are an expert software developer. You give helpful and concise responses.",
+ capabilities: {
+ uploadImage: true,
+ tools: true
+ }
+ },
{
title: "Claude 3.5 Sonnet (Free Trial)",
provider: "free-trial",
diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts
index 9912b862e..9bfff7f4b 100644
--- a/core/llm/llm.test.ts
+++ b/core/llm/llm.test.ts
@@ -191,7 +191,7 @@ describe("LLM", () => {
testLLM(
new Anthropic({
- model: "claude-3-5-sonnet-latest",
+ model: "claude-3-7-sonnet-latest",
apiKey: process.env.ANTHROPIC_API_KEY,
}),
{
diff --git a/core/llm/llms/Asksage.ts b/core/llm/llms/Asksage.ts
index 59554efe5..446308d05 100644
--- a/core/llm/llms/Asksage.ts
+++ b/core/llm/llms/Asksage.ts
@@ -27,6 +27,7 @@ class Asksage extends BaseLLM {
"gpt-o3-mini": "gpt-o3-mini", // Stub
"gpt-3.5-turbo": "gpt35-16k", // Works
"aws-bedrock-claude-35-sonnet-gov": "aws-bedrock-claude-35-sonnet-gov", // Works
+ "claude-3-7-sonnet-latest": "claude-37-sonnet", // Works
"claude-3-5-sonnet-latest": "claude-35-sonnet", // Works
"claude-3-opus-20240229": "claude-3-opus", // Works
"claude-3-sonnet-20240229": "claude-3-sonnet", // Works
diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts
index ab69aff70..5ccff4412 100644
--- a/core/llm/llms/FreeTrial.ts
+++ b/core/llm/llms/FreeTrial.ts
@@ -210,6 +210,7 @@ class FreeTrial extends BaseLLM {
async listModels(): Promise<string[]> {
return [
"codestral-latest",
+ "claude-3-7-sonnet-latest",
"claude-3-5-sonnet-latest",
"llama3.1-405b",
"llama3.1-70b",
diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts
index e1e030467..abffb080c 100644
--- a/core/llm/toolSupport.ts
+++ b/core/llm/toolSupport.ts
@@ -3,13 +3,13 @@ export const PROVIDER_TOOL_SUPPORT: Record<
(model: string) => boolean | undefined
> = {
"continue-proxy": (model) => {
- return ["claude-3-5", "claude-3.5", "gpt-4", "o3", "gemini"].some((part) =>
+ return ["claude-3-7", "claude-3.7", "claude-3-5", "claude-3.5", "gpt-4", "o3", "gemini"].some((part) =>
model.toLowerCase().startsWith(part),
);
},
anthropic: (model) => {
if (
- ["claude-3-5", "claude-3.5"].some((part) =>
+ ["claude-3-7", "claude-3.7", "claude-3-5", "claude-3.5"].some((part) =>
model.toLowerCase().startsWith(part),
)
) {
diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json
index 259d3e7c8..d3d2aa713 100644
--- a/extensions/vscode/config_schema.json
+++ b/extensions/vscode/config_schema.json
@@ -718,10 +718,11 @@
"enum": [
"gpt-4o",
"codestral-latest",
- "llama3.1-70b",
+ "llama3.1-70b",
"llama3.1-405b",
"gpt-3.5-turbo",
"gemini-pro",
+ "claude-3-7-sonnet-latest",
"claude-3-5-sonnet-latest",
"claude-3-haiku-20240307",
"AUTODETECT"
@@ -834,6 +835,7 @@
"enum": [
"claude-2",
"claude-instant-1",
+ "claude-3-7-sonnet-latest",
"claude-3-5-sonnet-latest",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
diff --git a/extensions/vscode/e2e/test-continue-yaml/config.yaml b/extensions/vscode/e2e/test-continue-yaml/config.yaml
index 5de426a94..fff0f590c 100644
--- a/extensions/vscode/e2e/test-continue-yaml/config.yaml
+++ b/extensions/vscode/e2e/test-continue-yaml/config.yaml
@@ -24,7 +24,7 @@ models:
- name: TOOL MOCK LLM
provider: mock
- model: claude-3-5-sonnet-latest
+ model: claude-3-7-sonnet-latest
requestOptions:
extraBodyProperties:
chatStream:
@@ -46,7 +46,7 @@ models:
- name: SYSTEM MESSAGE MOCK LLM
provider: mock
- model: claude-3-5-sonnet-latest
+ model: claude-3-7-sonnet-latest
requestOptions:
extraBodyProperties:
chatStream:
diff --git a/extensions/vscode/e2e/test-continue/config.json b/extensions/vscode/e2e/test-continue/config.json
index ad67f1999..2c2ee5dc0 100644
--- a/extensions/vscode/e2e/test-continue/config.json
+++ b/extensions/vscode/e2e/test-continue/config.json
@@ -16,7 +16,7 @@
{
"provider": "mock",
"title": "TOOL MOCK LLM",
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-3-7-sonnet-latest",
"requestOptions": {
"extraBodyProperties": {
"chatStream": [
@@ -48,7 +48,7 @@
{
"provider": "mock",
"title": "SYSTEM MESSAGE MOCK LLM",
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-3-7-sonnet-latest",
"requestOptions": {
"extraBodyProperties": {
"chatStream": [["REPEAT_SYSTEM_MSG"]]
diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json
index 57f283f76..2346dd279 100644
--- a/extensions/vscode/package-lock.json
+++ b/extensions/vscode/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "continue",
- "version": "0.9.268",
+ "version": "0.9.269",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.9.268",
+ "version": "0.9.269",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts
index 72303ce17..0559fb2aa 100644
--- a/gui/src/pages/AddNewModel/configs/models.ts
+++ b/gui/src/pages/AddNewModel/configs/models.ts
@@ -945,10 +945,24 @@ export const models: { [key: string]: ModelPackage } = {
icon: "openai.png",
isOpenSource: false,
},
+ claude37Sonnet: {
+ title: "Claude 3.7 Sonnet",
+ description:
+ "Anthropic's most advanced model with exceptional intelligence and expanded capabilities",
+ params: {
+ model: "claude-3-7-sonnet-latest",
+ contextLength: 200_000,
+ title: "Claude 3.7 Sonnet",
+ apiKey: "",
+ },
+ providerOptions: ["anthropic", "free-trial", "askSage"],
+ icon: "anthropic.png",
+ isOpenSource: false,
+ },
claude35Sonnet: {
title: "Claude 3.5 Sonnet",
description:
- "Anthropic's most intelligent model, but much less expensive than Claude 3 Opus",
+ "Anthropic's highly intelligent model, but much less expensive than Claude 3 Opus",
params: {
model: "claude-3-5-sonnet-latest",
contextLength: 200_000,
diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts
index 31c0bb2f6..b83d2d669 100644
--- a/gui/src/pages/AddNewModel/configs/providers.ts
+++ b/gui/src/pages/AddNewModel/configs/providers.ts
@@ -108,6 +108,7 @@ export const providers: Partial<Record<string, ProviderInfo>> = {
},
],
packages: [
+ models.claude37Sonnet,
models.claude35Sonnet,
models.claude3Opus,
models.claude3Sonnet,
diff --git a/packages/config-yaml/test/packages/test-org/claude37sonnet.yaml b/packages/config-yaml/test/packages/test-org/claude37sonnet.yaml
new file mode 100644
index 000000000..124d3c0dc
--- /dev/null
+++ b/packages/config-yaml/test/packages/test-org/claude37sonnet.yaml
@@ -0,0 +1,8 @@
+name: Claude 3.7 sonnet latest
+version: 0.0.1
+
+models:
+ - name: claude-3-7-sonnet-latest
+ provider: anthropic
+ model: claude-3-7-sonnet-latest
+ apiKey: ${{ inputs.ANTHROPIC_API_KEY }}
\ No newline at end of file
diff --git a/packages/llm-info/src/providers/anthropic.ts b/packages/llm-info/src/providers/anthropic.ts
index db74dbc87..71673ab04 100644
--- a/packages/llm-info/src/providers/anthropic.ts
+++ b/packages/llm-info/src/providers/anthropic.ts
@@ -4,13 +4,23 @@ export const Anthropic: ModelProvider = {
id: "anthropic",
displayName: "Anthropic",
models: [
+ {
+ model: "claude-3-7-sonnet-latest",
+ displayName: "Claude 3.7 Sonnet",
+ contextLength: 200000,
+ maxCompletionTokens: 8192,
+ description:
+ "Most advanced model with exceptional intelligence and expanded capabilities.",
+ regex: /claude-3\.7-sonnet/i,
+ recommendedFor: ["chat"],
+ },
{
model: "claude-3-5-sonnet-latest",
displayName: "Claude 3.5 Sonnet",
contextLength: 200000,
maxCompletionTokens: 8192,
description:
- "Most intelligent model with the highest level of intelligence and capability.",
+ "Highly intelligent model with excellent capabilities.",
regex: /claude-3\.5-sonnet/i,
recommendedFor: ["chat"],
},
diff --git a/packages/llm-info/src/providers/bedrock.ts b/packages/llm-info/src/providers/bedrock.ts
index 122e41306..6dcb223f9 100644
--- a/packages/llm-info/src/providers/bedrock.ts
+++ b/packages/llm-info/src/providers/bedrock.ts
@@ -2,6 +2,12 @@ import { ModelProvider } from "../types.js";
export const Bedrock: ModelProvider = {
models: [
+ {
+ model: "anthropic.claude-3-7-sonnet-20240219-v1:0",
+ displayName: "Claude 3.7 Sonnet",
+ contextLength: 200000,
+ maxCompletionTokens: 8192,
+ },
{
model: "anthropic.claude-3-5-sonnet-20240620-v1:0",
displayName: "Claude 3.5 Sonnet",
--
2.48.1
|
hi @maqrrr Use this guide to test it and make the PR. https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md#vs-code |
Created a PR #4342 to partially fix this issue. |
how do I you make the patch? I interested in trying it too. |
Looks kinda overcomplicated for me. @Asmedeus998 Here is simple workaround which works perfectly for me:
Since But if you need tools you have to apply patch, yes |
Validations
Problem
Claude 3.7 has added thinking (reasoning) mode. Unlike previous thinking models, they also allow to set a budget for how many tokens the model is allowed to think for. This requires additional thinking parameters in the API call that's not supported in Continue config yet.
More info at Claude's documentation:
https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
Solution
Add "thinking" options to the Continue config.
The text was updated successfully, but these errors were encountered: