AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Implementation for accessing Bedrock

Describes the API operations for creating, managing, fine-turning, and evaluating Amazon Bedrock models.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonServiceClient
    Amazon.Bedrock.AmazonBedrockClient

Namespace: Amazon.Bedrock
Assembly: AWSSDK.Bedrock.dll
Version: 3.x.y.z

Syntax

C#
public class AmazonBedrockClient : AmazonServiceClient
         IAmazonBedrock, IAmazonService, IDisposable

The AmazonBedrockClient type exposes the following members

Constructors

NameDescription
Public Method AmazonBedrockClient()

Constructs AmazonBedrockClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonBedrockClient(RegionEndpoint)

Constructs AmazonBedrockClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonBedrockClient(AmazonBedrockConfig)

Constructs AmazonBedrockClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonBedrockClient(AWSCredentials)

Constructs AmazonBedrockClient with AWS Credentials

Public Method AmazonBedrockClient(AWSCredentials, RegionEndpoint)

Constructs AmazonBedrockClient with AWS Credentials

Public Method AmazonBedrockClient(AWSCredentials, AmazonBedrockConfig)

Constructs AmazonBedrockClient with AWS Credentials and an AmazonBedrockClient Configuration object.

Public Method AmazonBedrockClient(string, string)

Constructs AmazonBedrockClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonBedrockClient(string, string, RegionEndpoint)

Constructs AmazonBedrockClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonBedrockClient(string, string, AmazonBedrockConfig)

Constructs AmazonBedrockClient with AWS Access Key ID, AWS Secret Key and an AmazonBedrockClient Configuration object.

Public Method AmazonBedrockClient(string, string, string)

Constructs AmazonBedrockClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonBedrockClient(string, string, string, RegionEndpoint)

Constructs AmazonBedrockClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonBedrockClient(string, string, string, AmazonBedrockConfig)

Constructs AmazonBedrockClient with AWS Access Key ID, AWS Secret Key and an AmazonBedrockClient Configuration object.

Properties

NameTypeDescription
Public Property Config Amazon.Runtime.IClientConfig Inherited from Amazon.Runtime.AmazonServiceClient.
Public Property Paginators Amazon.Bedrock.Model.IBedrockPaginatorFactory

Paginators for the service

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method CreateEvaluationJob(CreateEvaluationJobRequest)

API operation for creating and managing Amazon Bedrock automatic model evaluation jobs and model evaluation jobs that use human workers. To learn more about the requirements for creating a model evaluation job see, Model evaluations.

Public Method CreateEvaluationJobAsync(CreateEvaluationJobRequest, CancellationToken)

API operation for creating and managing Amazon Bedrock automatic model evaluation jobs and model evaluation jobs that use human workers. To learn more about the requirements for creating a model evaluation job see, Model evaluations.

Public Method CreateGuardrail(CreateGuardrailRequest)

Creates a guardrail to block topics and to filter out harmful content.

  • Specify a name and optional description.

  • Specify messages for when the guardrail successfully blocks a prompt or a model response in the blockedInputMessaging and blockedOutputsMessaging fields.

  • Specify topics for the guardrail to deny in the topicPolicyConfig object. Each GuardrailTopicConfig object in the topicsConfig list pertains to one topic.

    • Give a name and description so that the guardrail can properly identify the topic.

    • Specify DENY in the type field.

    • (Optional) Provide up to five prompts that you would categorize as belonging to the topic in the examples list.

  • Specify filter strengths for the harmful categories defined in Amazon Bedrock in the contentPolicyConfig object. Each GuardrailContentFilterConfig object in the filtersConfig list pertains to a harmful category. For more information, see Content filters. For more information about the fields in a content filter, see GuardrailContentFilterConfig.

    • Specify the category in the type field.

    • Specify the strength of the filter for prompts in the inputStrength field and for model responses in the strength field of the GuardrailContentFilterConfig.

  • (Optional) For security, include the ARN of a KMS key in the kmsKeyId field.

  • (Optional) Attach any tags to the guardrail in the tags object. For more information, see Tag resources.

Public Method CreateGuardrailAsync(CreateGuardrailRequest, CancellationToken)

Creates a guardrail to block topics and to filter out harmful content.

  • Specify a name and optional description.

  • Specify messages for when the guardrail successfully blocks a prompt or a model response in the blockedInputMessaging and blockedOutputsMessaging fields.

  • Specify topics for the guardrail to deny in the topicPolicyConfig object. Each GuardrailTopicConfig object in the topicsConfig list pertains to one topic.

    • Give a name and description so that the guardrail can properly identify the topic.

    • Specify DENY in the type field.

    • (Optional) Provide up to five prompts that you would categorize as belonging to the topic in the examples list.

  • Specify filter strengths for the harmful categories defined in Amazon Bedrock in the contentPolicyConfig object. Each GuardrailContentFilterConfig object in the filtersConfig list pertains to a harmful category. For more information, see Content filters. For more information about the fields in a content filter, see GuardrailContentFilterConfig.

    • Specify the category in the type field.

    • Specify the strength of the filter for prompts in the inputStrength field and for model responses in the strength field of the GuardrailContentFilterConfig.

  • (Optional) For security, include the ARN of a KMS key in the kmsKeyId field.

  • (Optional) Attach any tags to the guardrail in the tags object. For more information, see Tag resources.

Public Method CreateGuardrailVersion(CreateGuardrailVersionRequest)

Creates a version of the guardrail. Use this API to create a snapshot of the guardrail when you are satisfied with a configuration, or to compare the configuration with another version.

Public Method CreateGuardrailVersionAsync(CreateGuardrailVersionRequest, CancellationToken)

Creates a version of the guardrail. Use this API to create a snapshot of the guardrail when you are satisfied with a configuration, or to compare the configuration with another version.

Public Method CreateModelCustomizationJob(CreateModelCustomizationJobRequest)

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. Amazon Bedrock returns validation loss metrics and output generations after the job completes.

For information on the format of training and validation data, see Prepare the datasets.

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 Amazon Bedrock User Guide.

Public Method CreateModelCustomizationJobAsync(CreateModelCustomizationJobRequest, CancellationToken)

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. Amazon Bedrock returns validation loss metrics and output generations after the job completes.

For information on the format of training and validation data, see Prepare the datasets.

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 Amazon Bedrock User Guide.

Public Method CreateProvisionedModelThroughput(CreateProvisionedModelThroughputRequest)

Creates dedicated throughput for a base or custom model with the model units and for the duration that you specify. For pricing details, see Amazon Bedrock Pricing. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method CreateProvisionedModelThroughputAsync(CreateProvisionedModelThroughputRequest, CancellationToken)

Creates dedicated throughput for a base or custom model with the model units and for the duration that you specify. For pricing details, see Amazon Bedrock Pricing. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method DeleteCustomModel(DeleteCustomModelRequest)

Deletes a custom model that you created earlier. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method DeleteCustomModelAsync(DeleteCustomModelRequest, CancellationToken)

Deletes a custom model that you created earlier. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method DeleteGuardrail(DeleteGuardrailRequest)

Deletes a guardrail.

  • To delete a guardrail, only specify the ARN of the guardrail in the guardrailIdentifier field. If you delete a guardrail, all of its versions will be deleted.

  • To delete a version of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field and the version in the guardrailVersion field.

Public Method DeleteGuardrailAsync(DeleteGuardrailRequest, CancellationToken)

Deletes a guardrail.

  • To delete a guardrail, only specify the ARN of the guardrail in the guardrailIdentifier field. If you delete a guardrail, all of its versions will be deleted.

  • To delete a version of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field and the version in the guardrailVersion field.

Public Method DeleteModelInvocationLoggingConfiguration(DeleteModelInvocationLoggingConfigurationRequest)

Delete the invocation logging.

Public Method DeleteModelInvocationLoggingConfigurationAsync(DeleteModelInvocationLoggingConfigurationRequest, CancellationToken)

Delete the invocation logging.

Public Method DeleteProvisionedModelThroughput(DeleteProvisionedModelThroughputRequest)

Deletes a Provisioned Throughput. You can't delete a Provisioned Throughput before the commitment term is over. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method DeleteProvisionedModelThroughputAsync(DeleteProvisionedModelThroughputRequest, CancellationToken)

Deletes a Provisioned Throughput. You can't delete a Provisioned Throughput before the commitment term is over. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method DetermineServiceOperationEndpoint(AmazonWebServiceRequest)

Returns the endpoint that will be used for a particular request.

Public Method Dispose() Inherited from Amazon.Runtime.AmazonServiceClient.
Public Method GetCustomModel(GetCustomModelRequest)

Get the properties associated with a Amazon Bedrock custom model that you have created.For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method GetCustomModelAsync(GetCustomModelRequest, CancellationToken)

Get the properties associated with a Amazon Bedrock custom model that you have created.For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method GetEvaluationJob(GetEvaluationJobRequest)

Retrieves the properties associated with a model evaluation job, including the status of the job. For more information, see Model evaluations.

Public Method GetEvaluationJobAsync(GetEvaluationJobRequest, CancellationToken)

Retrieves the properties associated with a model evaluation job, including the status of the job. For more information, see Model evaluations.

Public Method GetFoundationModel(GetFoundationModelRequest)

Get details about a Amazon Bedrock foundation model.

Public Method GetFoundationModelAsync(GetFoundationModelRequest, CancellationToken)

Get details about a Amazon Bedrock foundation model.

Public Method GetGuardrail(GetGuardrailRequest)

Gets details about a guardrail. If you don't specify a version, the response returns details for the DRAFT version.

Public Method GetGuardrailAsync(GetGuardrailRequest, CancellationToken)

Gets details about a guardrail. If you don't specify a version, the response returns details for the DRAFT version.

Public Method GetModelCustomizationJob(GetModelCustomizationJobRequest)

Retrieves the properties associated with a model-customization job, including the status of the job. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method GetModelCustomizationJobAsync(GetModelCustomizationJobRequest, CancellationToken)

Retrieves the properties associated with a model-customization job, including the status of the job. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method GetModelInvocationLoggingConfiguration(GetModelInvocationLoggingConfigurationRequest)

Get the current configuration values for model invocation logging.

Public Method GetModelInvocationLoggingConfigurationAsync(GetModelInvocationLoggingConfigurationRequest, CancellationToken)

Get the current configuration values for model invocation logging.

Public Method GetProvisionedModelThroughput(GetProvisionedModelThroughputRequest)

Returns details for a Provisioned Throughput. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method GetProvisionedModelThroughputAsync(GetProvisionedModelThroughputRequest, CancellationToken)

Returns details for a Provisioned Throughput. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method ListCustomModels(ListCustomModelsRequest)

Returns a list of the custom models that you have created with the CreateModelCustomizationJob operation.

For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method ListCustomModelsAsync(ListCustomModelsRequest, CancellationToken)

Returns a list of the custom models that you have created with the CreateModelCustomizationJob operation.

For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method ListEvaluationJobs(ListEvaluationJobsRequest)

Lists model evaluation jobs.

Public Method ListEvaluationJobsAsync(ListEvaluationJobsRequest, CancellationToken)

Lists model evaluation jobs.

Public Method ListFoundationModels(ListFoundationModelsRequest)

Lists Amazon Bedrock foundation models that you can use. You can filter the results with the request parameters. For more information, see Foundation models in the Amazon Bedrock User Guide.

Public Method ListFoundationModelsAsync(ListFoundationModelsRequest, CancellationToken)

Lists Amazon Bedrock foundation models that you can use. You can filter the results with the request parameters. For more information, see Foundation models in the Amazon Bedrock User Guide.

Public Method ListGuardrails(ListGuardrailsRequest)

Lists details about all the guardrails in an account. To list the DRAFT version of all your guardrails, don't specify the guardrailIdentifier field. To list all versions of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field.

You can set the maximum number of results to return in a response in the maxResults field. If there are more results than the number you set, the response returns a nextToken that you can send in another ListGuardrails request to see the next batch of results.

Public Method ListGuardrailsAsync(ListGuardrailsRequest, CancellationToken)

Lists details about all the guardrails in an account. To list the DRAFT version of all your guardrails, don't specify the guardrailIdentifier field. To list all versions of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field.

You can set the maximum number of results to return in a response in the maxResults field. If there are more results than the number you set, the response returns a nextToken that you can send in another ListGuardrails request to see the next batch of results.

Public Method ListModelCustomizationJobs(ListModelCustomizationJobsRequest)

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 Amazon Bedrock User Guide.

Public Method ListModelCustomizationJobsAsync(ListModelCustomizationJobsRequest, CancellationToken)

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 Amazon Bedrock User Guide.

Public Method ListProvisionedModelThroughputs(ListProvisionedModelThroughputsRequest)

Lists the Provisioned Throughputs in the account. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method ListProvisionedModelThroughputsAsync(ListProvisionedModelThroughputsRequest, CancellationToken)

Lists the Provisioned Throughputs in the account. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method ListTagsForResource(ListTagsForResourceRequest)

List the tags associated with the specified resource.

For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method ListTagsForResourceAsync(ListTagsForResourceRequest, CancellationToken)

List the tags associated with the specified resource.

For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method PutModelInvocationLoggingConfiguration(PutModelInvocationLoggingConfigurationRequest)

Set the configuration values for model invocation logging.

Public Method PutModelInvocationLoggingConfigurationAsync(PutModelInvocationLoggingConfigurationRequest, CancellationToken)

Set the configuration values for model invocation logging.

Public Method StopEvaluationJob(StopEvaluationJobRequest)

Stops an in progress model evaluation job.

Public Method StopEvaluationJobAsync(StopEvaluationJobRequest, CancellationToken)

Stops an in progress model evaluation job.

Public Method StopModelCustomizationJob(StopModelCustomizationJobRequest)

Stops an active model customization job. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method StopModelCustomizationJobAsync(StopModelCustomizationJobRequest, CancellationToken)

Stops an active model customization job. For more information, see Custom models in the Amazon Bedrock User Guide.

Public Method TagResource(TagResourceRequest)

Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method TagResourceAsync(TagResourceRequest, CancellationToken)

Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method UntagResource(UntagResourceRequest)

Remove one or more tags from a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method UntagResourceAsync(UntagResourceRequest, CancellationToken)

Remove one or more tags from a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.

Public Method UpdateGuardrail(UpdateGuardrailRequest)

Updates a guardrail with the values you specify.

  • Specify a name and optional description.

  • Specify messages for when the guardrail successfully blocks a prompt or a model response in the blockedInputMessaging and blockedOutputsMessaging fields.

  • Specify topics for the guardrail to deny in the topicPolicyConfig object. Each GuardrailTopicConfig object in the topicsConfig list pertains to one topic.

    • Give a name and description so that the guardrail can properly identify the topic.

    • Specify DENY in the type field.

    • (Optional) Provide up to five prompts that you would categorize as belonging to the topic in the examples list.

  • Specify filter strengths for the harmful categories defined in Amazon Bedrock in the contentPolicyConfig object. Each GuardrailContentFilterConfig object in the filtersConfig list pertains to a harmful category. For more information, see Content filters. For more information about the fields in a content filter, see GuardrailContentFilterConfig.

    • Specify the category in the type field.

    • Specify the strength of the filter for prompts in the inputStrength field and for model responses in the strength field of the GuardrailContentFilterConfig.

  • (Optional) For security, include the ARN of a KMS key in the kmsKeyId field.

  • (Optional) Attach any tags to the guardrail in the tags object. For more information, see Tag resources.

Public Method UpdateGuardrailAsync(UpdateGuardrailRequest, CancellationToken)

Updates a guardrail with the values you specify.

  • Specify a name and optional description.

  • Specify messages for when the guardrail successfully blocks a prompt or a model response in the blockedInputMessaging and blockedOutputsMessaging fields.

  • Specify topics for the guardrail to deny in the topicPolicyConfig object. Each GuardrailTopicConfig object in the topicsConfig list pertains to one topic.

    • Give a name and description so that the guardrail can properly identify the topic.

    • Specify DENY in the type field.

    • (Optional) Provide up to five prompts that you would categorize as belonging to the topic in the examples list.

  • Specify filter strengths for the harmful categories defined in Amazon Bedrock in the contentPolicyConfig object. Each GuardrailContentFilterConfig object in the filtersConfig list pertains to a harmful category. For more information, see Content filters. For more information about the fields in a content filter, see GuardrailContentFilterConfig.

    • Specify the category in the type field.

    • Specify the strength of the filter for prompts in the inputStrength field and for model responses in the strength field of the GuardrailContentFilterConfig.

  • (Optional) For security, include the ARN of a KMS key in the kmsKeyId field.

  • (Optional) Attach any tags to the guardrail in the tags object. For more information, see Tag resources.

Public Method UpdateProvisionedModelThroughput(UpdateProvisionedModelThroughputRequest)

Updates the name or associated model for a Provisioned Throughput. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Public Method UpdateProvisionedModelThroughputAsync(UpdateProvisionedModelThroughputRequest, CancellationToken)

Updates the name or associated model for a Provisioned Throughput. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

Events

NameDescription
Event AfterResponseEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event BeforeRequestEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event ExceptionEvent Inherited from Amazon.Runtime.AmazonServiceClient.

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5