Closed shabie closed 1 month ago
@3coins and @shabie can we please urgently get this fix in - this is needed for the Custom Model import feature of Bedrock as well
for now will sub-class work ?
what is the purpose of this code -
if self.model_id.startswith("arn"): raise ValueError( "Model provider should be supplied when passing a model ARN as " "model_id" )
https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html Seems only us and eu are supported right now.
There is a PR for it https://github.com/langchain-ai/langchain-aws/pull/170/files
https://github.com/langchain-ai/langchain-aws/pull/184 fixes this issue. @shabie Can you take a look, there is a slight modification from your code suggestion to allow some of the test runs to pass.
Aamzon Bedrock now supports cross-region inference making it easier to handle throughput: https://aws.amazon.com/about-aws/whats-new/2024/08/amazon-bedrock-cross-region-inference/
This requires using a model ID with the region prefix as can be seen here:
US West (Oregon) (us-west-2)
Europe (Ireland) (eu-west-1)
Europe (Paris) (eu-west-3)
US West (Oregon) (us-west-2)
US West (Oregon) (us-west-2)
Europe (Ireland) (eu-west-1)
Europe (Paris) (eu-west-3)
US West (Oregon) (us-west-2)
Europe (Ireland) (eu-west-1)
Europe (Paris) (eu-west-3)
This means that this code needs to be modified:
https://github.com/langchain-ai/langchain-aws/blob/d89fcf80c61174c21c88ef8d1cfbf3a55c7d84c5/libs/aws/langchain_aws/llms/bedrock.py#L616-L625
This logic should be updated to something like the following:
I am happy to make a PR.