- Newest
- Most votes
- Most comments
Hello.
Your code tries to use "Mistral Large 2 (24.07)", but it is not available in "us-east-1".
When I checked on the management console, it was possible to enable the model in the Oregon region, so try changing to the Oregon region (us-west-2).
https://aws.amazon.com/about-aws/whats-new/2024/07/mistral-large-2-foundation-model-amazon-bedrock/?nc1=h_ls
brt = boto3.client(service_name='bedrock-runtime', region_name='us-west-2') # Specify your region
us-east-1
us-west-2
By the way, the sample code for the request for "Mistral Large 2 (24.07)" is provided in the document below.
https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-mistral-large-2407.html
You can find a lot of Mistral on Bedrock samples in this "aws-samples" repository. https://github.com/aws-samples/mistral-on-aws/tree/main/notebooks
answered 2 years ago
Based on the error message you're encountering, it appears that there are a few issues with your code and setup that need to be addressed. Let's go through them:
-
Model ID: The error suggests that the model identifier you're using is invalid. The model ID 'mistral.mistral-large-2407-v1:0' is not a standard Amazon Bedrock model ID. Make sure you're using the correct model ID for the Bedrock service. For example, if you want to use Claude v2, the correct model ID would be 'anthropic.claude-v2'.
-
SDK Version: Ensure that you're using the latest version of the boto3 library. Older versions may not support the Bedrock service. You can upgrade boto3 using pip:
pip install --upgrade boto3 -
Service Name: The service name 'bedrock-runtime' is correct for invoking models, but make sure your AWS credentials have the necessary permissions to access this service.
-
Region: Verify that Bedrock is available in the 'us-east-1' region for your account and that you have enabled access to the specific model you're trying to use.
-
Request Body: The structure of your request body looks correct for Claude models, but different models may require different input formats. Make sure you're following the specific requirements for the model you're using.
-
Local Environment: If you're running this code locally, ensure that your AWS credentials are properly configured in your environment or AWS credentials file.
To resolve these issues:
- Double-check the model ID you're using and make sure it's a valid Bedrock model ID.
- Upgrade your boto3 library to the latest version.
- Verify that you have the necessary permissions to access Bedrock in your AWS account.
- Ensure that you've enabled access to the specific model you're trying to use in the Bedrock console.
- Check the Bedrock documentation for the correct input format for the specific model you're using.
If you continue to face issues after addressing these points, you may want to try using a different model or contact AWS support for further assistance.
Sources
Resolve InvokeModel API error in Amazon Bedrock | AWS re:Post
Bedrock unveiled: A Quick Lambda example | AWS re:Post
answered 2 years ago
Relevant content
asked 6 months ago
