diff --git a/javascriptv3/example_code/bedrock-runtime/hello.js b/javascriptv3/example_code/bedrock-runtime/hello.js index e02363e7fe4..0ca54952a4f 100644 --- a/javascriptv3/example_code/bedrock-runtime/hello.js +++ b/javascriptv3/example_code/bedrock-runtime/hello.js @@ -15,7 +15,6 @@ */ import { fileURLToPath } from "url"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -36,10 +35,7 @@ const hello = async () => { console.log("Invoking model...\n"); // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - credentialDefaultProvider: defaultProvider, - region: AWS_REGION, - }); + const client = new BedrockRuntimeClient({ region: AWS_REGION }); // Prepare the payload for the model. const payload = { diff --git a/javascriptv3/example_code/bedrock-runtime/models/ai21_labs_jurassic2/jurassic2.js b/javascriptv3/example_code/bedrock-runtime/models/ai21_labs_jurassic2/jurassic2.js index 7a741ce6e8a..faca482641a 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/ai21_labs_jurassic2/jurassic2.js +++ b/javascriptv3/example_code/bedrock-runtime/models/ai21_labs_jurassic2/jurassic2.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -29,10 +28,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Jurassic-2 Mid if not provided. modelId = modelId || "ai21.j2-mid-v1"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/amazon_titan/titan_text.js b/javascriptv3/example_code/bedrock-runtime/models/amazon_titan/titan_text.js index 9ad9f8ebba3..d14fff264ee 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/amazon_titan/titan_text.js +++ b/javascriptv3/example_code/bedrock-runtime/models/amazon_titan/titan_text.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -23,10 +22,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Titan Text G1 - Express if not provided. modelId = modelId || "amazon.titan-text-express-v1"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_2.js b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_2.js index ed2cc6d48c0..48c7d79a75b 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_2.js +++ b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_2.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -36,10 +35,7 @@ import { */ export const invokeMessagesApi = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude 2.0 if not provided. modelId = modelId || "anthropic.claude-v2"; @@ -82,10 +78,7 @@ export const invokeMessagesApi = async (prompt, modelId) => { */ export const invokeTextCompletionsApi = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude 2.0 if not provided. modelId = modelId || "anthropic.claude-v2"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_3.js b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_3.js index 0664c73df78..fca59b6e9b8 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_3.js +++ b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_3.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -41,10 +40,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude 3 Haiku if not provided. modelId = modelId || "anthropic.claude-3-haiku-20240307-v1:0"; @@ -87,10 +83,7 @@ export const invokeModel = async (prompt, modelId) => { */ export const invokeModelWithResponseStream = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude 3 Haiku if not provided. modelId = modelId || "anthropic.claude-3-haiku-20240307-v1:0"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_instant_1.js b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_instant_1.js index 4372964a595..f7b1f7f5e45 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_instant_1.js +++ b/javascriptv3/example_code/bedrock-runtime/models/anthropic_claude/claude_instant_1.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -34,10 +33,7 @@ import { */ export const invokeMessagesApi = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude Instant 1.0 if not provided. modelId = modelId || "anthropic.claude-instant-v1"; @@ -80,10 +76,7 @@ export const invokeMessagesApi = async (prompt, modelId) => { */ export const invokeTextCompletionsApi = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Claude Instant 1.0 if not provided. modelId = modelId || "anthropic.claude-instant-v1"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/meta_llama2/llama2_chat.js b/javascriptv3/example_code/bedrock-runtime/models/meta_llama2/llama2_chat.js index 3cc9826c5b8..3b088141d81 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/meta_llama2/llama2_chat.js +++ b/javascriptv3/example_code/bedrock-runtime/models/meta_llama2/llama2_chat.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -23,10 +22,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Llama2 Chat 13B if not provided. modelId = modelId || "meta.llama2-13b-chat-v1"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mistral_7b.js b/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mistral_7b.js index 31697399bcb..6042b1bfbd1 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mistral_7b.js +++ b/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mistral_7b.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -26,10 +25,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Mistral 7B Instruct if not provided. modelId = modelId || "mistral.mistral-7b-instruct-v0:2"; diff --git a/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mixtral_8x7b.js b/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mixtral_8x7b.js index 5de86408c10..b3a8d8114c9 100644 --- a/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mixtral_8x7b.js +++ b/javascriptv3/example_code/bedrock-runtime/models/mistral_ai/mixtral_8x7b.js @@ -4,7 +4,6 @@ import { fileURLToPath } from "url"; import { FoundationModels } from "../../config/foundation_models.js"; -import { defaultProvider } from "@aws-sdk/credential-provider-node"; import { BedrockRuntimeClient, InvokeModelCommand, @@ -26,10 +25,7 @@ import { */ export const invokeModel = async (prompt, modelId) => { // Create a new Bedrock Runtime client instance. - const client = new BedrockRuntimeClient({ - region: "us-east-1", - credentialDefaultProvider: defaultProvider, - }); + const client = new BedrockRuntimeClient({ region: "us-east-1" }); // Use the provided model ID or fallback to Mistral 8x7B Instruct if not provided. modelId = modelId || "mistral.mixtral-8x7b-instruct-v0:1"; diff --git a/javascriptv3/example_code/bedrock-runtime/package.json b/javascriptv3/example_code/bedrock-runtime/package.json index 501f4e9b9f9..f668f5dfcd5 100644 --- a/javascriptv3/example_code/bedrock-runtime/package.json +++ b/javascriptv3/example_code/bedrock-runtime/package.json @@ -8,8 +8,7 @@ "integration-test": "vitest run **/*.integration.test.js" }, "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.533.0", - "@aws-sdk/credential-provider-node": "^3.533.0" + "@aws-sdk/client-bedrock-runtime": "^3.533.0" }, "devDependencies": { "vitest": "^1.3.0",