Skip to content

Commit feac926

Browse files
committed
llm: replace anthropic claude sonnet with sonnet 3.5, move it to the top, tweak descriptions, and only expose the context window limited variant.
1 parent f1820ff commit feac926

File tree

4 files changed

+53
-8
lines changed

4 files changed

+53
-8
lines changed

src/packages/server/llm/anthropic.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ function getModelName(model: AnthropicModel): string {
2626
model = "claude-3-haiku";
2727
} else if (model === "claude-3-opus-8k") {
2828
model = "claude-3-opus";
29+
} else if (model === "claude-3-5-sonnet-4k") {
30+
model = "claude-3-5-sonnet";
2931
}
3032
// now we have a valid name, and we have to append their static version number
3133
return `${model}-${ANTHROPIC_VERSION[model]}`;

src/packages/server/llm/test/00.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,26 @@ test_llm("mistralai")("Mistral AI", () => {
118118
});
119119

120120
test_llm("anthropic")("Anthropic", () => {
121-
const model: AnthropicModel = "claude-3-haiku";
121+
const haiku: AnthropicModel = "claude-3-haiku";
122+
const sonnet: AnthropicModel = "claude-3-5-sonnet-4k";
123+
const opus: AnthropicModel = "claude-3-opus-8k";
122124

123125
test("model", () => {
124-
expect(isAnthropicModel(model)).toBe(true);
126+
expect(isAnthropicModel(haiku)).toBe(true);
125127
});
126128

127-
test("basics", async () => {
128-
const answer = await evaluateAnthropic({ model, ...QUERY });
129+
test("haiku", async () => {
130+
const answer = await evaluateAnthropic({ model: haiku, ...QUERY });
131+
checkAnswer(answer);
132+
});
133+
134+
test("sonnet", async () => {
135+
const answer = await evaluateAnthropic({ model: sonnet, ...QUERY });
136+
checkAnswer(answer);
137+
});
138+
139+
test("opus", async () => {
140+
const answer = await evaluateAnthropic({ model: opus, ...QUERY });
129141
checkAnswer(answer);
130142
});
131143
});

src/packages/util/db-schema/llm-utils.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ export const GOOGLE_MODEL_TO_ID: Partial<{ [m in GoogleModel]: string }> = {
160160

161161
// https://docs.anthropic.com/claude/docs/models-overview -- stable names for the modesl ...
162162
export const ANTHROPIC_MODELS = [
163+
"claude-3-5-sonnet",
164+
"claude-3-5-sonnet-4k", // added 2024-06-24
163165
"claude-3-haiku",
164166
"claude-3-haiku-8k", // limited context window, offered for free
165167
"claude-3-sonnet",
@@ -170,12 +172,15 @@ export const ANTHROPIC_MODELS = [
170172
const CLAUDE_SONNET_VERSION = "20240229";
171173
const CLAUDE_HAIKU_VERSION = "20240307";
172174
const CLAUDE_OPUS_VERSION = "20240229";
175+
const CLAUDE_SONNET_3_5_VERSION = "20240620";
173176
// ... and we add a version number (there is no "*-latest") when dispatching on the backend
174177
export const ANTHROPIC_VERSION: { [name in AnthropicModel]: string } = {
178+
"claude-3-sonnet-4k": CLAUDE_SONNET_VERSION,
175179
"claude-3-opus": CLAUDE_OPUS_VERSION,
176180
"claude-3-opus-8k": CLAUDE_OPUS_VERSION,
177181
"claude-3-sonnet": CLAUDE_SONNET_VERSION,
178-
"claude-3-sonnet-4k": CLAUDE_SONNET_VERSION,
182+
"claude-3-5-sonnet": CLAUDE_SONNET_3_5_VERSION,
183+
"claude-3-5-sonnet-4k": CLAUDE_SONNET_3_5_VERSION,
179184
"claude-3-haiku": CLAUDE_HAIKU_VERSION,
180185
"claude-3-haiku-8k": CLAUDE_HAIKU_VERSION,
181186
} as const;
@@ -228,7 +233,7 @@ export const USER_SELECTABLE_LLMS_BY_VENDOR: {
228233
// we show opus and the context restricted models (to avoid high costs)
229234
return (
230235
m === "claude-3-opus-8k" ||
231-
m === "claude-3-sonnet-4k" ||
236+
m === "claude-3-5-sonnet-4k" ||
232237
m === "claude-3-haiku-8k"
233238
);
234239
}),
@@ -709,6 +714,8 @@ export const LLM_USERNAMES: LLM2String = {
709714
"claude-3-haiku-8k": "Claude 3 Haiku 8k",
710715
"claude-3-sonnet": "Claude 3 Sonnet",
711716
"claude-3-sonnet-4k": "Claude 3 Sonnet 4k",
717+
"claude-3-5-sonnet": "Claude 3.5 Sonnet",
718+
"claude-3-5-sonnet-4k": "Claude 3.5 Sonnet 4k",
712719
"claude-3-opus": "Claude 3 Opus 200k",
713720
"claude-3-opus-8k": "Claude 3 Opus 8k",
714721
} as const;
@@ -758,14 +765,18 @@ export const LLM_DESCR: LLM2String = {
758765
"Fastest model, lightweight actions (Anthropic, 200k token context)",
759766
"claude-3-haiku-8k":
760767
"Fastest model, lightweight actions (Anthropic, 8k token context)",
768+
"claude-3-5-sonnet":
769+
"Our most intelligent model (Anthropic, 200k token context)",
770+
"claude-3-5-sonnet-4k":
771+
"Our most intelligent model (Anthropic, 4k token context)",
761772
"claude-3-sonnet":
762773
"Best combination of performance and speed (Anthropic, 200k token context)",
763774
"claude-3-sonnet-4k":
764775
"Best combination of performance and speed (Anthropic, 4k token context)",
765776
"claude-3-opus":
766-
"Most intelligent, complex analysis, higher-order math and coding (Anthropic, 200k token context)",
777+
"Excels at writing and complex tasks (Anthropic, 200k token context)",
767778
"claude-3-opus-8k":
768-
"Most intelligent, complex analysis, higher-order math and coding (Anthropic, 8k token context)",
779+
"Excels at writing and complex tasks (Anthropic, 8k token context)",
769780
} as const;
770781

771782
export function isFreeModel(model: unknown, isCoCalcCom: boolean): boolean {
@@ -969,6 +980,18 @@ export const LLM_COST: { [name in LanguageModelCore]: Cost } = {
969980
max_tokens: 200_000,
970981
free: false,
971982
},
983+
"claude-3-5-sonnet": {
984+
prompt_tokens: usd1Mtokens(3),
985+
completion_tokens: usd1Mtokens(15),
986+
max_tokens: 4_000, // limited to 4k tokens, offered for free
987+
free: false,
988+
},
989+
"claude-3-5-sonnet-4k": {
990+
prompt_tokens: usd1Mtokens(3),
991+
completion_tokens: usd1Mtokens(15),
992+
max_tokens: 4_000, // limited to 4k tokens, offered for free
993+
free: false,
994+
},
972995
"claude-3-sonnet-4k": {
973996
prompt_tokens: usd1Mtokens(3),
974997
completion_tokens: usd1Mtokens(15),

src/packages/util/db-schema/purchase-quotas.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ export const QUOTA_SPEC: QuotaSpec = {
135135
display: LLM_USERNAMES["claude-3-sonnet-4k"],
136136
color: "#181818",
137137
},
138+
"anthropic-claude-3-5-sonnet": {
139+
display: LLM_USERNAMES["claude-3-5-sonnet"],
140+
color: "#181818",
141+
},
142+
"anthropic-claude-3-5-sonnet-4k": {
143+
display: LLM_USERNAMES["claude-3-5-sonnet-4k"],
144+
color: "#181818",
145+
},
138146
"anthropic-claude-3-haiku": {
139147
display: LLM_USERNAMES["claude-3-haiku"],
140148
color: "#181818",

0 commit comments

Comments
 (0)