Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AWS service initialization syntax in example notebooks #277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChandraLingam
Copy link

Description:

This PR proposes an improvement to the way AWS services are initialized in the example notebooks. Currently, the syntax used is:

import boto3

boto3_bedrock = boto3.client('bedrock')

The improved syntax initializes a boto3 session, which allows for more flexibility, such as automatically inferring the region, switching profiles if needed:

import boto3

boto3_session = boto3.Session()  # Initialize a boto3 session (use the profile_name parameter to switch profiles if needed)
bedrock_client = boto3_session.client('bedrock') # Region is automatically inferred from the session

Changes Made:

Updated the initialization syntax in a couple of example notebooks to demonstrate the improvement.

Benefits:

  • No need to manually configure the region when initializing the client; it is automatically inferred from the session.
  • Allows users to easily switch profiles by specifying the profile_name parameter, which is useful when running the examples locally.
  • Provides a more flexible and scalable way to manage AWS service clients.

Please review these changes and let me know if you'd like me to apply this improvement to the remaining example notebooks as well.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant