Open thiagotps opened 2 months ago
I believe you need to pass region_name
directly into ChatBedrockConverse
- or set the environment variable AWS_DEFAULT_REGION
. boto3 and langchain_aws don't share variables, so you must specify the region name for the llm as well I believe. Let me know if that fixes your error.
I believe you need to pass
region_name
directly intoChatBedrockConverse
- or set the environment variableAWS_DEFAULT_REGION
. boto3 and langchain_aws don't share variables, so you must specify the region name for the llm as well I believe. Let me know if that fixes your error.
Yes, setting region_name
and credentials_profile_name
in the ChatBedrockConverse constructor works.
Looking in the code of validate_environment
in bedrock_converse.py
, I see that a new boto3.Session
object is being instantiated, and later, with that new session, the bedrock-runtime
client is then created. Wouldn't it be better to just call boto3.client('bedrock-runtime')
directly (or at least when no credentials_profile_name
was provided) ? That way it will work with boto3.setup_default_session
out of the box.
Not a boto3
expert by any means - but if I understand correctly the code currently creates its own session, but you would like it to work with the session already setup? That sounds reasonable to me - if you want to open up a PR (with a corresponding test case) I would be happy to review. Lmk if I misunderstood
@thiagotps I believe this has been fixed in the latest release. I am not able to reproduce with v0.2.2. Let us know if you still see this issue.
The following code:
raises the following error:
The error is asking for the environmental variable
AWS_DEFAULT_REGION
, even though I have set the region name via boto3setup_default_session
method.