feat: migrate to claude sonnet 4 (#4)
Node.js CI / Lint and Test (push) Successful in 1m0s
Code Analysis / SonarQube (push) Failing after 1m14s

### Explanation

_No response_

### Issue

_No response_

### Attestations

- [ ] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/)
- [ ] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/).
- [ ] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/).

### Dependencies

- [ ] I have pinned the dependencies to a specific patch version.

### Style

- [ ] I have run the linter and resolved any errors.
- [ ] My pull request uses an appropriate title, matching the conventional commit standards.
- [ ] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request.

### Tests

- [ ] My contribution adds new code, and I have added tests to cover it.
- [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes.
- [ ] All new and existing tests pass locally with my changes.
- [ ] Code coverage remains at or above the configured threshold.

### Documentation

_No response_

### Versioning

_No response_

Reviewed-on: nhcarrigan/cordelia-taryne#4
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit was merged in pull request #4.
This commit is contained in:
2025-05-22 11:15:33 -07:00
committed by Naomi Carrigan
parent 61f4fa05c6
commit 14f9d5b4d0
8 changed files with 250 additions and 385 deletions
+3 -3
View File
@@ -10,11 +10,11 @@ import { calculateCost } from "../utils/calculateCost.js";
import { isSubscribed } from "../utils/isSubscribed.js";
import { logger } from "../utils/logger.js";
import { replyToError } from "../utils/replyToError.js";
import type { ImageBlockParam } from "@anthropic-ai/sdk/resources/index.js";
import type { Base64ImageSource } from "@anthropic-ai/sdk/resources/index.js";
const isValidContentType = (
type: string,
): type is ImageBlockParam["source"]["media_type"] => {
): type is Base64ImageSource["media_type"] => {
return [
"image/jpg",
"image/jpeg",
@@ -100,7 +100,7 @@ export const alt = async(
role: "user",
},
],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to generate descriptive and accessible alt-text for the user's image. Be as descriptive as possible. Do not include ANYTHING in your response EXCEPT the actual alt-text. Wrap the text in a multi-line code block for easy copying.`,
temperature: 1,
});
+1 -1
View File
@@ -31,7 +31,7 @@ export const evaluate = async(
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
max_tokens: 2000,
messages: [ { content: code, role: "user" } ],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to evaluate the user's code and provide the result. Wrap ONLY THE CODE RESULT in a multi-line code block for easy copying.`,
temperature: 1,
});
+1 -1
View File
@@ -32,7 +32,7 @@ export const mood = async(
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
max_tokens: 2000,
messages: [ { content: prompt, role: "user" } ],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to analyse the text the user provides for the overall sentiment and mood of the author.`,
temperature: 1,
});
+1 -1
View File
@@ -32,7 +32,7 @@ export const proofread = async(
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
max_tokens: 2000,
messages: [ { content: prompt, role: "user" } ],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to proofread the text the user has provided. You should identify spelling and grammatical errors using British English.`,
temperature: 1,
});
+1 -1
View File
@@ -32,7 +32,7 @@ export const query = async(
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
max_tokens: 2000,
messages: [ { content: prompt, role: "user" } ],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to answer the user's question to the best of your abilities. When possible, include links to relevant sources.`,
temperature: 1,
});
+1 -1
View File
@@ -32,7 +32,7 @@ export const summarise = async(
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
max_tokens: 2000,
messages: [ { content: prompt, role: "user" } ],
model: "claude-3-5-sonnet-latest",
model: "claude-sonnet-4-20250514",
system: `${personality} Your role in this conversation is to summarise the text the user has provided. Your goal is to reach 250 words or less. Wrap ONLY THE SUMMARY in multi-line code block so it is easy to copy.`,
temperature: 1,
});