adding api functionality

This commit is contained in:
KS Jannette
2026-02-11 13:35:19 -05:00
parent bf907c900d
commit dd816d3984
3 changed files with 68 additions and 262 deletions

View File

@@ -1 +1,19 @@
import Anthropic from "@anthropic-ai/sdk";
import anthropicApiKey from "../.secrets";
const client = new Anthropic({
apiKey: anthropicApiKey
});
const prompt = `You are a helpful assistant that analyzes notes for semantic similarity. Each note is a json object with the
various attributes. For clustering purposes, the relvant attribute is "text". Analze the text attributes of the notes and return a json object with the following structure: {{$notes}}`;
export const clusterNotes = async (notes) => {
const response = await client.messages.create({
model: "claude-opus-4-6",
messages: [
{ role: "user", content: `${prompt}`}
]
});
return response.content[0].text;
};