2023/09/28 - Amazon Bedrock - 15 new api methods
Changes Model Invocation logging added to enable or disable logs in customer account. Model listing and description support added. Provisioned Throughput feature added. Custom model support added for creating custom models. Also includes list, and delete functions for custom model.
Returns a list of the custom models that you have created with the CreateModelCustomizationJob operation.
For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.list_custom_models( baseModelArnEquals='string', creationTimeAfter=datetime(2015, 1, 1), creationTimeBefore=datetime(2015, 1, 1), foundationModelArnEquals='string', maxResults=123, nameContains='string', nextToken='string', sortBy='CreationTime', sortOrder='Ascending'|'Descending' )
string
Return custom models only if the base model ARN matches this parameter.
datetime
Return custom models created after the specified time.
datetime
Return custom models created before the specified time.
string
Return custom models only if the foundation model ARN matches this parameter.
integer
Maximum number of results to return in the response.
string
Return custom models only if the job name contains these characters.
string
Continuation token from the previous response, for Bedrock to list the next set of results.
string
The field to sort by in the returned list of models.
string
The sort order of the results.
dict
Response Syntax
{ 'modelSummaries': [ { 'baseModelArn': 'string', 'baseModelName': 'string', 'creationTime': datetime(2015, 1, 1), 'modelArn': 'string', 'modelName': 'string' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
modelSummaries (list) --
Model summaries.
(dict) --
Summary information for a custom model.
baseModelArn (string) --
The base model ARN.
baseModelName (string) --
The base model name.
creationTime (datetime) --
Creation time of the model.
modelArn (string) --
The ARN of the custom model.
modelName (string) --
The name of the custom model.
nextToken (string) --
Continuation token for the next request to list the next set of results.
Remove one or more tags from a resource. For more information, see Tagging resources in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.untag_resource( resourceARN='string', tagKeys=[ 'string', ] )
string
[REQUIRED]
The ARN of the resource to untag.
list
[REQUIRED]
Tag keys of the tags to remove from the resource.
(string) --
dict
Response Syntax
{}
Response Structure
(dict) --
Deletes a custom model that you created earlier. For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.delete_custom_model( modelIdentifier='string' )
string
[REQUIRED]
Name of the model to delete.
dict
Response Syntax
{}
Response Structure
(dict) --
Returns a list of model customization jobs that you have submitted. You can filter the jobs to return based on one or more criteria.
For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.list_model_customization_jobs( creationTimeAfter=datetime(2015, 1, 1), creationTimeBefore=datetime(2015, 1, 1), maxResults=123, nameContains='string', nextToken='string', sortBy='CreationTime', sortOrder='Ascending'|'Descending', statusEquals='InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped' )
datetime
Return customization jobs created after the specified time.
datetime
Return customization jobs created before the specified time.
integer
Maximum number of results to return in the response.
string
Return customization jobs only if the job name contains these characters.
string
Continuation token from the previous response, for Bedrock to list the next set of results.
string
The field to sort by in the returned list of jobs.
string
The sort order of the results.
string
Return customization jobs with the specified status.
dict
Response Syntax
{ 'modelCustomizationJobSummaries': [ { 'baseModelArn': 'string', 'creationTime': datetime(2015, 1, 1), 'customModelArn': 'string', 'customModelName': 'string', 'endTime': datetime(2015, 1, 1), 'jobArn': 'string', 'jobName': 'string', 'lastModifiedTime': datetime(2015, 1, 1), 'status': 'InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
modelCustomizationJobSummaries (list) --
Job summaries.
(dict) --
Information about one customization job
baseModelArn (string) --
ARN of the base model.
creationTime (datetime) --
Creation time of the custom model.
customModelArn (string) --
ARN of the custom model.
customModelName (string) --
Name of the custom model.
endTime (datetime) --
Time that the customization job ended.
jobArn (string) --
ARN of the customization job.
jobName (string) --
Name of the customization job.
lastModifiedTime (datetime) --
Time that the customization job was last modified.
status (string) --
Status of the customization job.
nextToken (string) --
Page continuation token to use in the next request.
Retrieves the properties associated with a model-customization job, including the status of the job. For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.get_model_customization_job( jobIdentifier='string' )
string
[REQUIRED]
Identifier for the customization job.
dict
Response Syntax
{ 'baseModelArn': 'string', 'clientRequestToken': 'string', 'creationTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'failureMessage': 'string', 'hyperParameters': { 'string': 'string' }, 'jobArn': 'string', 'jobName': 'string', 'lastModifiedTime': datetime(2015, 1, 1), 'outputDataConfig': { 's3Uri': 'string' }, 'outputModelArn': 'string', 'outputModelKmsKeyArn': 'string', 'outputModelName': 'string', 'roleArn': 'string', 'status': 'InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped', 'trainingDataConfig': { 's3Uri': 'string' }, 'trainingMetrics': { 'trainingLoss': ... }, 'validationDataConfig': { 'validators': [ { 's3Uri': 'string' }, ] }, 'validationMetrics': [ { 'validationLoss': ... }, ], 'vpcConfig': { 'securityGroupIds': [ 'string', ], 'subnetIds': [ 'string', ] } }
Response Structure
(dict) --
baseModelArn (string) --
ARN of the base model.
clientRequestToken (string) --
The token that you specified in the CreateCustomizationJob request.
creationTime (datetime) --
Time that the resource was created.
endTime (datetime) --
Time that the resource transitioned to terminal state.
failureMessage (string) --
Information about why the job failed.
hyperParameters (dict) --
The hyperparameter values for the job.
(string) --
(string) --
jobArn (string) --
The ARN of the customization job.
jobName (string) --
The name of the customization job.
lastModifiedTime (datetime) --
Time that the resource was last modified.
outputDataConfig (dict) --
Output data configuration
s3Uri (string) --
The S3 URI where the output data is stored.
outputModelArn (string) --
The ARN of the output model.
outputModelKmsKeyArn (string) --
The custom model is encrypted at rest using this key.
outputModelName (string) --
The name of the output model.
roleArn (string) --
The ARN of the IAM role.
status (string) --
The status of the job. A successful job transitions from in-progress to completed when the output model is ready to use. If the job failed, the failure message contains information about why the job failed.
trainingDataConfig (dict) --
S3 Location of the training data.
s3Uri (string) --
The S3 URI where the training data is stored.
trainingMetrics (dict) --
Metrics associated with the custom job.
trainingLoss (float) --
Loss metric associated with the custom job.
validationDataConfig (dict) --
Array of up to 10 validators.
validators (list) --
Information about the validators.
(dict) --
Information about a validator.
s3Uri (string) --
The S3 URI where the validation data is stored.
validationMetrics (list) --
The loss metric for each validator that you provided in the createjob request.
(dict) --
The metric for the validator.
validationLoss (float) --
The validation loss associated with this validator.
vpcConfig (dict) --
VPC configuration for the custom model job.
securityGroupIds (list) --
VPC configuration security group Ids.
(string) --
subnetIds (list) --
VPC configuration subnets.
(string) --
List of Bedrock foundation models that you can use. For more information, see Foundation models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.list_foundation_models( byCustomizationType='FINE_TUNING', byInferenceType='ON_DEMAND'|'PROVISIONED', byOutputModality='TEXT'|'IMAGE'|'EMBEDDING', byProvider='string' )
string
List by customization type.
string
List by inference type.
string
List by output modality type.
string
A Bedrock model provider.
dict
Response Syntax
{ 'modelSummaries': [ { 'customizationsSupported': [ 'FINE_TUNING', ], 'inferenceTypesSupported': [ 'ON_DEMAND'|'PROVISIONED', ], 'inputModalities': [ 'TEXT'|'IMAGE'|'EMBEDDING', ], 'modelArn': 'string', 'modelId': 'string', 'modelName': 'string', 'outputModalities': [ 'TEXT'|'IMAGE'|'EMBEDDING', ], 'providerName': 'string', 'responseStreamingSupported': True|False }, ] }
Response Structure
(dict) --
modelSummaries (list) --
A list of bedrock foundation models.
(dict) --
Summary information for a foundation model.
customizationsSupported (list) --
Whether the model supports fine-tuning or continual pre-training.
(string) --
inferenceTypesSupported (list) --
The inference types that the model supports.
(string) --
inputModalities (list) --
The input modalities that the model supports.
(string) --
modelArn (string) --
The ARN of the foundation model.
modelId (string) --
The model Id of the foundation model.
modelName (string) --
The name of the model.
outputModalities (list) --
The output modalities that the model supports.
(string) --
providerName (string) --
The model's provider name.
responseStreamingSupported (boolean) --
Indicates whether the model supports streaming.
Get the current configuration values for model invocation logging.
See also: AWS API Documentation
Request Syntax
client.get_model_invocation_logging_configuration()
dict
Response Syntax
{ 'loggingConfig': { 'cloudWatchConfig': { 'largeDataDeliveryS3Config': { 'bucketName': 'string', 'keyPrefix': 'string' }, 'logGroupName': 'string', 'roleArn': 'string' }, 'embeddingDataDeliveryEnabled': True|False, 'imageDataDeliveryEnabled': True|False, 's3Config': { 'bucketName': 'string', 'keyPrefix': 'string' }, 'textDataDeliveryEnabled': True|False } }
Response Structure
(dict) --
loggingConfig (dict) --
The current configuration values.
cloudWatchConfig (dict) --
CloudWatch logging configuration.
largeDataDeliveryS3Config (dict) --
S3 configuration for delivering a large amount of data.
bucketName (string) --
S3 bucket name.
keyPrefix (string) --
S3 prefix.
logGroupName (string) --
The log group name.
roleArn (string) --
The role ARN.
embeddingDataDeliveryEnabled (boolean) --
Set to include embeddings data in the log delivery.
imageDataDeliveryEnabled (boolean) --
Set to include image data in the log delivery.
s3Config (dict) --
S3 configuration for storing log data.
bucketName (string) --
S3 bucket name.
keyPrefix (string) --
S3 prefix.
textDataDeliveryEnabled (boolean) --
Set to include text data in the log delivery.
List the tags associated with the specified resource.
For more information, see Tagging resources in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.list_tags_for_resource( resourceARN='string' )
string
[REQUIRED]
The ARN of the resource.
dict
Response Syntax
{ 'tags': [ { 'key': 'string', 'value': 'string' }, ] }
Response Structure
(dict) --
tags (list) --
An array of the tags associated with this resource.
(dict) --
Definition of the key/value pair for a tag.
key (string) --
Key for the tag.
value (string) --
Value for the tag.
Set the configuration values for model invocation logging.
See also: AWS API Documentation
Request Syntax
client.put_model_invocation_logging_configuration( loggingConfig={ 'cloudWatchConfig': { 'largeDataDeliveryS3Config': { 'bucketName': 'string', 'keyPrefix': 'string' }, 'logGroupName': 'string', 'roleArn': 'string' }, 'embeddingDataDeliveryEnabled': True|False, 'imageDataDeliveryEnabled': True|False, 's3Config': { 'bucketName': 'string', 'keyPrefix': 'string' }, 'textDataDeliveryEnabled': True|False } )
dict
[REQUIRED]
The logging configuration values to set.
cloudWatchConfig (dict) --
CloudWatch logging configuration.
largeDataDeliveryS3Config (dict) --
S3 configuration for delivering a large amount of data.
bucketName (string) -- [REQUIRED]
S3 bucket name.
keyPrefix (string) --
S3 prefix.
logGroupName (string) -- [REQUIRED]
The log group name.
roleArn (string) -- [REQUIRED]
The role ARN.
embeddingDataDeliveryEnabled (boolean) --
Set to include embeddings data in the log delivery.
imageDataDeliveryEnabled (boolean) --
Set to include image data in the log delivery.
s3Config (dict) --
S3 configuration for storing log data.
bucketName (string) -- [REQUIRED]
S3 bucket name.
keyPrefix (string) --
S3 prefix.
textDataDeliveryEnabled (boolean) --
Set to include text data in the log delivery.
dict
Response Syntax
{}
Response Structure
(dict) --
Delete the invocation logging.
See also: AWS API Documentation
Request Syntax
client.delete_model_invocation_logging_configuration()
dict
Response Syntax
{}
Response Structure
(dict) --
Stops an active model customization job. For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.stop_model_customization_job( jobIdentifier='string' )
string
[REQUIRED]
Job identifier of the job to stop.
dict
Response Syntax
{}
Response Structure
(dict) --
Creates a fine-tuning job to customize a base model.
You specify the base foundation model and the location of the training data. After the model-customization job completes successfully, your custom model resource will be ready to use. Training data contains input and output text for each record in a JSONL format. Optionally, you can specify validation data in the same format as the training data. Bedrock returns validation loss metrics and output generations after the job completes.
Model-customization jobs are asynchronous and the completion time depends on the base model and the training/validation data size. To monitor a job, use the GetModelCustomizationJob operation to retrieve the job status.
For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.create_model_customization_job( baseModelIdentifier='string', clientRequestToken='string', customModelKmsKeyId='string', customModelName='string', customModelTags=[ { 'key': 'string', 'value': 'string' }, ], hyperParameters={ 'string': 'string' }, jobName='string', jobTags=[ { 'key': 'string', 'value': 'string' }, ], outputDataConfig={ 's3Uri': 'string' }, roleArn='string', trainingDataConfig={ 's3Uri': 'string' }, validationDataConfig={ 'validators': [ { 's3Uri': 'string' }, ] }, vpcConfig={ 'securityGroupIds': [ 'string', ], 'subnetIds': [ 'string', ] } )
string
[REQUIRED]
Name of the base model.
string
Unique token value that you can provide. The GetModelCustomizationJob response includes the same token value.
This field is autopopulated if not provided.
string
The custom model is encrypted at rest using this key.
string
[REQUIRED]
Enter a name for the custom model.
list
Assign tags to the custom model.
(dict) --
Definition of the key/value pair for a tag.
key (string) -- [REQUIRED]
Key for the tag.
value (string) -- [REQUIRED]
Value for the tag.
dict
[REQUIRED]
Parameters related to tuning the model.
(string) --
(string) --
string
[REQUIRED]
Enter a unique name for the fine-tuning job.
list
Assign tags to the job.
(dict) --
Definition of the key/value pair for a tag.
key (string) -- [REQUIRED]
Key for the tag.
value (string) -- [REQUIRED]
Value for the tag.
dict
[REQUIRED]
S3 location for the output data.
s3Uri (string) -- [REQUIRED]
The S3 URI where the output data is stored.
string
[REQUIRED]
The Amazon Resource Name (ARN) of an IAM role that Bedrock can assume to perform tasks on your behalf. For example, during model training, Bedrock needs your permission to read input data from an S3 bucket, write model artifacts to an S3 bucket. To pass this role to Bedrock, the caller of this API must have the iam:PassRole permission.
dict
[REQUIRED]
Information about the training dataset.
s3Uri (string) -- [REQUIRED]
The S3 URI where the training data is stored.
dict
Information about the validation dataset.
validators (list) -- [REQUIRED]
Information about the validators.
(dict) --
Information about a validator.
s3Uri (string) -- [REQUIRED]
The S3 URI where the validation data is stored.
dict
VPC configuration (optional). Configuration parameters for the private Virtual Private Cloud (VPC) that contains the resources you are using for this job.
securityGroupIds (list) -- [REQUIRED]
VPC configuration security group Ids.
(string) --
subnetIds (list) -- [REQUIRED]
VPC configuration subnets.
(string) --
dict
Response Syntax
{ 'jobArn': 'string' }
Response Structure
(dict) --
jobArn (string) --
ARN of the fine tuning job
Get the properties associated with a Bedrock custom model that you have created.For more information, see Custom models in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.get_custom_model( modelIdentifier='string' )
string
[REQUIRED]
Name or ARN of the custom model.
dict
Response Syntax
{ 'baseModelArn': 'string', 'creationTime': datetime(2015, 1, 1), 'hyperParameters': { 'string': 'string' }, 'jobArn': 'string', 'jobName': 'string', 'modelArn': 'string', 'modelKmsKeyArn': 'string', 'modelName': 'string', 'outputDataConfig': { 's3Uri': 'string' }, 'trainingDataConfig': { 's3Uri': 'string' }, 'trainingMetrics': { 'trainingLoss': ... }, 'validationDataConfig': { 'validators': [ { 's3Uri': 'string' }, ] }, 'validationMetrics': [ { 'validationLoss': ... }, ] }
Response Structure
(dict) --
baseModelArn (string) --
ARN of the base model.
creationTime (datetime) --
Creation time of the model.
hyperParameters (dict) --
Hyperparameter values associated with this model.
(string) --
(string) --
jobArn (string) --
Job ARN associated with this model.
jobName (string) --
Job name associated with this model.
modelArn (string) --
ARN associated with this model.
modelKmsKeyArn (string) --
The custom model is encrypted at rest using this key.
modelName (string) --
Model name associated with this model.
outputDataConfig (dict) --
Output data configuration associated with this custom model.
s3Uri (string) --
The S3 URI where the output data is stored.
trainingDataConfig (dict) --
Information about the training dataset.
s3Uri (string) --
The S3 URI where the training data is stored.
trainingMetrics (dict) --
The training metrics from the job creation.
trainingLoss (float) --
Loss metric associated with the custom job.
validationDataConfig (dict) --
Array of up to 10 validators.
validators (list) --
Information about the validators.
(dict) --
Information about a validator.
s3Uri (string) --
The S3 URI where the validation data is stored.
validationMetrics (list) --
The validation metrics from the job creation.
(dict) --
The metric for the validator.
validationLoss (float) --
The validation loss associated with this validator.
Associate tags with a resource. For more information, see Tagging resources in the Bedrock User Guide.
See also: AWS API Documentation
Request Syntax
client.tag_resource( resourceARN='string', tags=[ { 'key': 'string', 'value': 'string' }, ] )
string
[REQUIRED]
The ARN of the resource to tag.
list
[REQUIRED]
Tags to associate with the resource.
(dict) --
Definition of the key/value pair for a tag.
key (string) -- [REQUIRED]
Key for the tag.
value (string) -- [REQUIRED]
Value for the tag.
dict
Response Syntax
{}
Response Structure
(dict) --
Get details about a Bedrock foundation model.
See also: AWS API Documentation
Request Syntax
client.get_foundation_model( modelIdentifier='string' )
string
[REQUIRED]
The model identifier.
dict
Response Syntax
{ 'modelDetails': { 'customizationsSupported': [ 'FINE_TUNING', ], 'inferenceTypesSupported': [ 'ON_DEMAND'|'PROVISIONED', ], 'inputModalities': [ 'TEXT'|'IMAGE'|'EMBEDDING', ], 'modelArn': 'string', 'modelId': 'string', 'modelName': 'string', 'outputModalities': [ 'TEXT'|'IMAGE'|'EMBEDDING', ], 'providerName': 'string', 'responseStreamingSupported': True|False } }
Response Structure
(dict) --
modelDetails (dict) --
Information about the foundation model.
customizationsSupported (list) --
The customization that the model supports.
(string) --
inferenceTypesSupported (list) --
The inference types that the model supports.
(string) --
inputModalities (list) --
The input modalities that the model supports.
(string) --
modelArn (string) --
The model ARN.
modelId (string) --
The model identifier.
modelName (string) --
The model name.
outputModalities (list) --
The output modalities that the model supports.
(string) --
providerName (string) --
he model's provider name.
responseStreamingSupported (boolean) --
Indicates whether the model supports streaming.