When you work with AWS Bedrock, you must pass the required model’s ID. Let’s see how you can get a list of the available models.
import boto3 bedrock = boto3.client(service_name = 'bedrock', region_name = 'us-east-1') bedrock.list_foundation_models()
Output:
{'ResponseMetadata': {'RequestId': 'e61c456e-0efd-464f-98e1-323c25fc4a97', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Tue, 17 Dec 2024 09:30:18 GMT', 'content-type': 'application/json', 'content-length': '35815', 'connection': 'keep-alive', 'x-amzn-requestid': 'e61c456e-0efd-464f-98e1-323c25fc4a97'}, 'RetryAttempts': 0}, 'modelSummaries': [{'modelArn': 'arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-tg1-large', 'modelId': 'amazon.titan-tg1-large', 'modelName': 'Titan Text Large', 'providerName': 'Amazon', 'inputModalities': ['TEXT'], 'outputModalities': ['TEXT'], 'responseStreamingSupported': True, 'customizationsSupported': [], 'inferenceTypesSupported': ['ON_DEMAND'], 'modelLifecycle': {'status': 'ACTIVE'}}, ...
For example, for the Titan Text Large, the model ID is the ‘amazon.titan-tg1-large’