New to AWS and AI but I am attempting to connect AWS Bedrock to a NextJS app. I am just trying to get a working response but I keep running into hurdles. I can’t seem to get past my current error:
Error generating chat response: Error: No value provided for input HTTP label: modelId.
Below is my code. Am I missing something stupid and obvious?
import { BedrockClient } from "@aws-sdk/client-bedrock";
import { InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
const client = new BedrockClient({
region: process.env.AWS_REGION,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
});
export const generateChatResponse = async (messages) =>
const params = {
Input: {
Text: messages.map((msg) => msg.content).join("n"),
},
ModelId: "claude-3-haiku",
};
try {
const command = new InvokeModelCommand(params);
const response = await client.send(command);
return response;
} catch (error) {
console.error("Error generating chat response:", error);
return null;
}
};