-
Notifications
You must be signed in to change notification settings - Fork 114
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
ChatBedrock not working with latest nova models (amazon.nova-pro-v1:0 model) #308
Comments
I have also tried chatbedrock with nova models Though chatbedrock is working with claude models. |
I am also facing similar issues. It frequently gives this error:
My code snippet:
|
I had to enable the models in AWS Console. After that the invoke part works just fine. Running into issues with embeddings though. |
I tried the following code.
I could get success response.
|
@aashipandya |
The issue is resolved with addition of region_name in ChatBedrock method |
Fixes langchain-ai#308 Update the `ChatBedrock` class to handle the `region_name` parameter correctly. * Modify `libs/aws/langchain_aws/chat_models/bedrock.py` to ensure the `region_name` parameter is passed to the `ChatBedrockConverse` class and add logic to take `region_name` from `AWS_REGION` environment variable if not provided. * Add test cases in `libs/aws/tests/integration_tests/chat_models/test_bedrock_converse.py` to confirm that `ChatBedrockConverse` works with the `amazon.nova-pro-v1:0` model and takes `region_name` from `AWS_REGION` environment variable if not provided. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/langchain-ai/langchain-aws/issues/308?shareId=XXXX-XXXX-XXXX-XXXX).
I am trying to use the new Amazon Bedrock model amazon.nova-pro-v1:0 with the ChatBedrock integration provided by LangChain-AWS. However, I encounter a validation error when I attempt to invoke the model.
Code to Reproduce
import boto3
from langchain_aws import ChatBedrock
import os
AWS credentials -
aws_access_key = "XYZ"
aws_secret_key = "XYZ"
region_name = "us-east-1"
Bedrock Runtime Client -
model_name = "amazon.nova-pro-v1:0"
bedrock_client = boto3.client(
service_name="bedrock-runtime",
region_name=region_name,
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_key
)
llm = ChatBedrock(client=bedrock_client, model_id=model_name, model_kwargs=dict(temperature=0))
response = llm.invoke("Create a list of 3 pop songs")
print(response)
Error Output
ValidationError: 1 validation error for ChatBedrockConverse
Value error, Could not load credentials to authenticate with AWS client.
Please check that credentials in the specified profile name are valid.
Although If i try same credentials & same model with client.converse method it works.
response = bedrock_client.converse(
modelId=model_name,
messages=messages,
inferenceConfig={"temperature": 0.0}
)
Environment
• LangChain-AWS version: 0.2.9
• Python version: 3.10
• AWS SDK (boto3) version: 1.35.83
I am not sure if the issue is with credentials or ChatBedrock.
The text was updated successfully, but these errors were encountered: