generated from nhcarrigan/template
feat: migrate to claude 4 model
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 37s
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 37s
This commit is contained in:
parent
50ae0764f1
commit
c306a61b6f
@ -10,11 +10,11 @@ import { calculateCost } from "../utils/calculateCost.js";
|
|||||||
import { isSubscribed } from "../utils/isSubscribed.js";
|
import { isSubscribed } from "../utils/isSubscribed.js";
|
||||||
import { logger } from "../utils/logger.js";
|
import { logger } from "../utils/logger.js";
|
||||||
import { replyToError } from "../utils/replyToError.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 = (
|
const isValidContentType = (
|
||||||
type: string,
|
type: string,
|
||||||
): type is ImageBlockParam["source"]["media_type"] => {
|
): type is Base64ImageSource["media_type"] => {
|
||||||
return [
|
return [
|
||||||
"image/jpg",
|
"image/jpg",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
@ -100,7 +100,7 @@ export const alt = async(
|
|||||||
role: "user",
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ export const evaluate = async(
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
messages: [ { content: code, role: "user" } ],
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ export const mood = async(
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
messages: [ { content: prompt, role: "user" } ],
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ export const proofread = async(
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
messages: [ { content: prompt, role: "user" } ],
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ export const query = async(
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
messages: [ { content: prompt, role: "user" } ],
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
@ -32,7 +32,7 @@ export const summarise = async(
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Required key format for SDK.
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
messages: [ { content: prompt, role: "user" } ],
|
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.`,
|
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,
|
temperature: 1,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user