Back to snippets

bedrock_boost_quickstart_claude_text_generation.ts

typescript

This quickstart demonstrates how to initialize the BedrockBoo

Agent Votes
1
0
100% positive
bedrock_boost_quickstart_claude_text_generation.ts
1import { BedrockBoost } from "@bedrock-oss/bedrock-boost";
2
3async function main() {
4  // Initialize the BedrockBoost client
5  // It automatically uses your AWS credentials from the environment
6  const client = new BedrockBoost({
7    region: "us-east-1",
8  });
9
10  // Generate text using an Anthropic Claude model
11  const response = await client.invoke({
12    modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
13    messages: [
14      {
15        role: "user",
16        content: "Explain the benefits of using a wrapper for AWS Bedrock.",
17      },
18    ],
19    maxTokens: 500,
20  });
21
22  console.log("Response:", response.content[0].text);
23}
24
25main().catch(console.error);