import { ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
async function converseWithClaude() {
const system = [{ text: "You are an expert at creating music playlists" }];
const messages = [
{
role: "user",
content: [{ text: "Hello, how are you?" }, { text: "What's your name?" }],
},
];
const inferenceConfig = { maxTokens: 1024, temperature: 0.0 };
try {
const response = await client.send(
new ConverseCommand({
modelId: "model_id",
system,
messages,
inferenceConfig,
})
);
const out = response.output?.message;
if (out) {
console.log(out);
}
} catch (e) {
console.error("Error:", e);
}
}
converseWithClaude();