langchain-aws icon indicating copy to clipboard operation
langchain-aws copied to clipboard

ChatBedrockConverse doesn't take into account boto3 setup_default_session.

Open thiagotps opened this issue 6 months ago • 3 comments

The following code:

import boto3
from langchain_aws import ChatBedrockConverse

boto3.setup_default_session(profile_name="genai-dev", region_name="us-east-1")
llm = ChatBedrockConverse(model="anthropic.claude-3-haiku-20240307-v1:0")

raises the following error:

ValidationError: 1 validation error for ChatBedrockConverse
__root__
  Did not find region_name, please add an environment variable `AWS_DEFAULT_REGION` which contains it, or pass `region_name` as a named parameter. (type=value_error)

The error is asking for the environmental variable AWS_DEFAULT_REGION, even though I have set the region name via boto3 setup_default_session method.

thiagotps avatar Aug 15 '24 15:08 thiagotps