chore: sonnet 4.5 preference

This commit is contained in:
Dallin Romney 2025-12-02 12:35:27 -08:00
parent 886c0a4741
commit 7b036c66a2
6 changed files with 32 additions and 70 deletions

View file

@ -42,9 +42,9 @@ function getContentsForNewBlock(blockType: BlockType): ConfigYaml {
configYaml.models = [
{
provider: "anthropic",
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
apiKey: "${{ secrets.ANTHROPIC_API_KEY }}",
name: "Claude Sonnet 4",
name: "Claude Sonnet 4.5",
roles: ["chat", "edit"],
},
];

View file

@ -134,7 +134,7 @@ describe("Anthropic", () => {
test("streamChat should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -155,7 +155,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -177,7 +177,7 @@ describe("Anthropic", () => {
test("chat should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -198,7 +198,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -220,7 +220,7 @@ describe("Anthropic", () => {
test("streamComplete should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -238,7 +238,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -260,7 +260,7 @@ describe("Anthropic", () => {
test("complete should send a valid request", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -278,7 +278,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -301,7 +301,7 @@ describe("Anthropic", () => {
test("should handle system message", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -325,7 +325,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -347,7 +347,7 @@ describe("Anthropic", () => {
test("should handle tool calls", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -386,7 +386,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 8192,
stream: true,
messages: [
@ -424,7 +424,7 @@ describe("Anthropic", () => {
test("should handle custom max tokens", async () => {
const anthropic = new Anthropic({
apiKey: "test-api-key",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});
@ -446,7 +446,7 @@ describe("Anthropic", () => {
"x-api-key": "test-api-key",
},
body: {
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
max_tokens: 1000,
stream: true,
messages: [
@ -470,7 +470,7 @@ describe("Anthropic", () => {
test("should throw error when API key is missing", async () => {
const anthropic = new Anthropic({
apiKey: "",
model: "claude-sonnet-4",
model: "claude-sonnet-4-5",
apiBase: "https://api.anthropic.com/v1/",
});

View file

@ -6,13 +6,13 @@ import OpenRouter from "./OpenRouter";
describe("OpenRouter Anthropic Caching", () => {
it("should detect Anthropic models correctly", () => {
const openRouter = new OpenRouter({
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
});
// Test private method through modifyChatBody
const body: ChatCompletionCreateParams = {
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
messages: [],
};
@ -22,7 +22,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should add cache_control to user messages when caching is enabled", () => {
const openRouter = new OpenRouter({
model: "anthropic/claude-3.5-sonnet",
model: "anthropic/claude-sonnet-4.5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -31,7 +31,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "anthropic/claude-3.5-sonnet",
model: "anthropic/claude-sonnet-4.5",
messages: [
{ role: "user", content: "First message" },
{ role: "assistant", content: "Response" },
@ -71,7 +71,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should correctly handle cache_control with system messages present", () => {
const openRouter = new OpenRouter({
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -80,7 +80,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
messages: [
{ role: "system", content: "You are a helpful assistant" },
{ role: "user", content: "First user message" },
@ -137,7 +137,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should add cache_control to system message when caching is enabled", () => {
const openRouter = new OpenRouter({
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: false,
@ -146,7 +146,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
messages: [
{ role: "system", content: "You are a helpful assistant" },
{ role: "user", content: "Hello" },
@ -176,7 +176,7 @@ describe("OpenRouter Anthropic Caching", () => {
it("should handle array content correctly", () => {
const openRouter = new OpenRouter({
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
apiKey: "test-key",
cacheBehavior: {
cacheConversation: true,
@ -185,7 +185,7 @@ describe("OpenRouter Anthropic Caching", () => {
});
const body: ChatCompletionCreateParams = {
model: "claude-sonnet-4-latest",
model: "claude-sonnet-4-5",
messages: [
{
role: "user",

View file

@ -30,10 +30,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus
# Frontier Models
[Claude 4 Sonnet](https://hub.continue.dev/anthropic/claude-4-sonnet) from Anthropic
[Claude Sonnet 4.5](https://hub.continue.dev/anthropic/claude-sonnet-4-5) from Anthropic
1. Get your API key from [Anthropic](https://console.anthropic.com/)
2. Add [Claude 4 Sonnet](https://hub.continue.dev/anthropic/claude-4-sonnet) to a config on Continue Mission Control
2. Add[Claude Sonnet 4.5](https://hub.continue.dev/anthropic/claude-sonnet-4-5) to a config on Continue Mission Control
3. Add `ANTHROPIC_API_KEY` as a [User Secret](https://docs.continue.dev/mission-control/secrets/secret-types#user-secrets) on Continue Mission Control [here](https://hub.continue.dev/settings/secrets)
4. Click `Reload config` in the config selector in the Continue IDE extension

View file

@ -16,7 +16,7 @@
{
"provider": "mock",
"title": "TOOL MOCK LLM",
"model": "claude-sonnet-4-latest",
"model": "claude-sonnet-4-5",
"capabilities": {
"tools": true
},
@ -50,7 +50,7 @@
{
"provider": "mock",
"title": "SYSTEM MESSAGE MOCK LLM",
"model": "claude-sonnet-4-latest",
"model": "claude-sonnet-4-5",
"requestOptions": {
"extraBodyProperties": {
"chatStream": [["REPEAT_SYSTEM_MSG"]]
@ -60,7 +60,7 @@
{
"provider": "mock",
"title": "LAST MESSAGE MOCK LLM",
"model": "claude-sonnet-4-latest",
"model": "claude-sonnet-4-5",
"requestOptions": {
"extraBodyProperties": {
"chatStream": [["REPEAT_LAST_MSG"]]

View file

@ -1,51 +1,21 @@
/**
* Calculator class that performs basic arithmetic operations
* Uses method chaining for convenient calculation sequences
*/
class Calculator {
/**
* Initializes the calculator with result set to 0
*/
constructor() {
this.result = 0;
}
/**
* Adds a number to the current result
* @param {number} number - The number to add
* @returns {Calculator} - Returns this for method chaining
*/
add(number) {
this.result += number;
return this;
}
/**
* Subtracts a number from the current result
* @param {number} number - The number to subtract
* @returns {Calculator} - Returns this for method chaining
*/
subtract(number) {
this.result -= number;
return this;
}
/**
* Multiplies the current result by a number
* @param {number} number - The number to multiply by
* @returns {Calculator} - Returns this for method chaining
*/
multiply(number) {
this.result *= number;
return this;
}
/**
* Divides the current result by a number
* @param {number} number - The number to divide by
* @throws {Error} - Throws an error if attempting to divide by zero
* @returns {Calculator} - Returns this for method chaining
*/
divide(number) {
if (number === 0) {
throw new Error("Cannot divide by zero");
@ -54,18 +24,10 @@ class Calculator {
return this;
}
/**
* Gets the current result value
* @returns {number} - The current calculation result
*/
getResult() {
return this.result;
}
/**
* Resets the result to 0
* @returns {Calculator} - Returns this for method chaining
*/
reset() {
this.result = 0;
return this;