aws-samples / amazon-kendra-langchain-extensions

Samples to build Generative AI applications with LangChain and Amazon Kendra
https://aws.amazon.com/blogs/machine-learning/quickly-build-high-accuracy-generative-ai-applications-on-enterprise-data-using-amazon-kendra-langchain-and-large-language-models/
MIT No Attribution
158 stars 104 forks source link

updated handling of profile name in claude v2 script #66

Closed mohaalsouli closed 7 months ago

mohaalsouli commented 7 months ago

This PR updates how the scripts handles presense of an AWS profile name. If an AWS profile is present in the environment variables, the scripts uses it to communicate with Bedrock and Kendra. If an AWS profile does not exist in the environment variables, the script will use the default profile.

Note, if you are running on SageMaker Studio Classic, the default profile will be your instance's IAM Execution Role so make sure it has the right IAM permissions to invoke models on Bedrock and query and retrieve from Kendra.

This has been tested on SageMaker Studio Classic with and without an AWS Profile defined. Both worked as expected.

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