aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.12k stars 579 forks source link

config is missing and const makes the example hard to use #6624

Open rvernica opened 2 days ago

rvernica commented 2 days ago

Describe the issue

Example code uses const for all the variables which makes the example hard to use with Copy & Paste. Also, the config variable is used and not declared nor is any reference provided on how it should be declared.

import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
// const { BedrockRuntimeClient, InvokeModelCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
const client = new BedrockRuntimeClient(config);

Links

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelCommand/

aBurmeseDev commented 1 day ago

Hi @rvernica - thanks for reaching out and your feedback.

For the client config, it would depend on the client but the essential inputs are usually the credentials and the region. However, these can also be provided through environment variables or a configuration file, eliminating the need to include them in the code initialization. Apart from credentials and region, developers can also specify custom options like endpoint URLs and request handlers.

Here's the documentation you can refer to: https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md

Hope that helps and we'll consider improving our code example addressing your feedback. Best, John