First lesson does not work due to model and API changes

I tried running the first lesson notebook and initially I got an error because the titan-text-express-v1 model is no longer available. Then I got an error because the invoke_model API for Amazon’s Nova models are not the same as for the Titan models. Check the docs in Bedrock - the forum doesn’t let me post links!

The new call in my notebook looks like this:

request_body = {
  ‘messages’: [{‘role’: ‘user’,‘content’: [{‘text’: prompt}]}],
}

kwargs = {
  ‘modelId’: ‘us.amazon.nova-2-lite-v1:0’,
  ‘body’: json.dumps(request_body)
}

response = bedrock_runtime.invoke_model(**kwargs)

After updating the API call, I then got this permissions error:

AccessDeniedException: An error occurred (AccessDeniedException) when calling the InvokeModel operation: User: arn:aws:sts::288407523163:assumed-role/voclabs/user4767639=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcHA is not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:us-west-2:288407523163:inference-profile/us.amazon.nova-2-lite-v1:0 because no identity-based policy allows the bedrock:InvokeModel action 

I think the only way I can now try and do the course is to download the notebooks, and try and run them inside my own AWS account fixing them along the way.

1 Like

Thank you for reporting @JamesAHammerton ! I’m running into same issue and tested your fix with updated model, thank you!

I’m reporting this AccessDeniedException to our engineering team!

Thank you!

Thank you again @JamesAHammerton for reporting and proposing a fix!

We’re currently working with the AWS team to update the code, in the meanwhile the course is set to “under maintenance”. We’ll keep you posted!

cc @Community-Team Gio!