aws-samples / amazon-bedrock-workshop

This is a workshop designed for Amazon Bedrock a foundational model service.
https://catalog.us-east-1.prod.workshops.aws/amazon-bedrock/en-US
MIT No Attribution
1.48k stars 632 forks source link

Not Authorized to invoke this API operation: 02_Summarization/02.long-text-summarization-titan.ipynb #109

Closed komalda closed 7 months ago

komalda commented 1 year ago

https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/02_Summarization/02.long-text-summarization-titan.ipynb When I run below code


modelId = "amazon.titan-tg1-large"
output = ""
try:

    output = summary_chain.run(docs)

except ValueError as error:
    if  "AccessDeniedException" in str(error):
        print(f"\x1b[41m{error}\
        \nTo troubeshoot this issue please refer to the following resources.\
         \nhttps://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_access-denied.html\
         \nhttps://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html\x1b[0m\n")      
        class StopExecution(ValueError):
            def _render_traceback_(self):
                pass
        raise StopExecution        
    else:
        raise error```

getting following error. (model id is : modelId = "amazon.titan-tg1-large")

`
Error raised by bedrock service: An error occurred (AccessDeniedException) when calling the InvokeModel operation: Your account is not authorized to invoke this API operation.        
To troubeshoot this issue please refer to the following resources.         
https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_access-denied.html         
https://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html

`
mbaron commented 1 year ago

Titan examples are not working at the moment. The model is still in preview: https://github.com/aws-samples/amazon-bedrock-workshop/issues/71

gmarchand commented 1 year ago

It's not the good model ID : modelId = "amazon.titan-tg1-large" https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids-arns.html

AI21 Labs Jurassic-2 Mid 1.x ai21.j2-mid-v1
AI21 Labs Jurassic-2 Ultra 1.x ai21.j2-ultra-v1
Amazon Titan Text G1 - Lite 1.x amazon.titan-text-lite-v1
Amazon Titan Embeddings G1 - Text 1.x amazon.titan-embed-text-v1
Amazon Titan Text G1 - Express 1.x amazon.titan-text-express-v1
Amazon Titan Text G1 - Agile 1.x amazon.titan-text-agile-v1
Anthropic Claude 1.x anthropic.claude-v1
Anthropic Claude 2.x anthropic.claude-v2
Anthropic Claude Instant 1.x anthropic.claude-instant-v1
Cohere Command 14.x cohere.command-text-v14
Stability AI Stable Diffusion XL 0.x stability.stable-diffusion-xl-v0
w601sxs commented 7 months ago

Closing this; please refer to the latest bedrock workshop update and reopen if still relevant