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

Amazon Bedrock Workshop - [Bug] 02_qa_w_rag_claude_opensearch.ipynb hardcoded to use us-east-1 #248

Open
jicowan opened this issue May 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jicowan
Copy link

jicowan commented May 2, 2024

Describe the bug
The following code in 02_qa_w_rag_claude_opensearch.ipynb will throw an error if the AWS_DEFAULT_REGION is not set. Update to retrieve the region dynamically, e.g. boto3.session.Session.region_name. Do not hard code the region.

from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth
from langchain.vectorstores import OpenSearchVectorSearch

service = 'aoss'
credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAuth(credentials, os.environ.get("AWS_DEFAULT_REGION", 'us-east-1'), service)

The following line in 02_qa_w_rag_claude_opensearch.ipynb will also throw an error if the REGION is not set:

host = collection['createCollectionDetail']['id'] + '.' + os.environ.get("AWS_DEFAULT_REGION", None) + '.aoss.amazonaws.com:443'

None is not an appropriate value if the variable is not set.

@jicowan jicowan added the bug Something isn't working label May 2, 2024
@w601sxs
Copy link
Contributor

w601sxs commented May 15, 2024

I agree, can you do a quick PR @jicowan ? Thank you for catching this and improving our examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants