# This file is automatically generated by botocraft. Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.services.bedrock_runtime import GuardrailContextualGroundingFilter
from .abstract import (
Boto3Model,
ReadonlyBoto3Model,
PrimaryBoto3Model,
ReadonlyPrimaryBoto3Model,
Boto3ModelManager,
ReadonlyBoto3ModelManager,
)
from botocraft.services.iam import IAMRole, IAMRoleManager
from botocraft.mixins.bedrock_runtime import FoundationModelRuntimeMixin
from botocraft.services.kms import KMSKey, KMSKeyManager
from .abstract import PrimaryBoto3ModelQuerySet
from botocraft.mixins.bedrock import PromptRouterModelMixin
from datetime import datetime
import builtins
from botocraft.services.bedrock_runtime import GuardrailContentFilter
from botocraft.mixins.bedrock import ModelInvocationLoggingConfigurationModelMixin
from botocraft.mixins.bedrock import ResourcePolicyManagerMixin
from typing import ClassVar, Literal, Any, cast
from botocraft.mixins.bedrock import InferenceProfileModelMixin
from botocraft.services.common import Tag
from botocraft.mixins.bedrock_runtime import GuardrailRuntimeMixin
from botocraft.services.bedrock_runtime import GuardrailTopic
from botocraft.services.ec2 import Subnet, SubnetManager
from botocraft.services.ec2 import SecurityGroup, SecurityGroupManager
from botocraft.mixins.bedrock import AutomatedReasoningPolicyModelMixin
from functools import cached_property
from pydantic import Field
from collections import OrderedDict
from botocraft.mixins.tags import TagsDictMixin
# ===============
# Managers
# ===============
[docs]class FoundationModelManager(ReadonlyBoto3ModelManager):
service_name: str = "bedrock"
[docs] def get(self, modelId: str) -> "FoundationModel | None":
"""
Get details about a Amazon Bedrock foundation model.
Args:
modelId: The model identifier.
"""
args: dict[str, Any] = dict(modelIdentifier=self.serialize(modelId))
_response = self.client.get_foundation_model(
**{k: v for k, v in args.items() if v is not None}
)
response = GetFoundationModelResponse(**_response)
if response and response.modelDetails:
self.sessionize(response.modelDetails)
return response.modelDetails
return None
[docs] def list(
self,
*,
byProvider: "str | None" = None,
byCustomizationType: "Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION'] | None" = None,
byOutputModality: "Literal['TEXT', 'IMAGE', 'EMBEDDING'] | None" = None,
byInferenceType: "Literal['ON_DEMAND', 'PROVISIONED'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Lists Amazon Bedrock foundation models that you can use. You can filter the results with the request parameters. For
more information, see `Foundation models <https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html>`_
in the `Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Keyword Args:
byProvider: Return models belonging to the model provider that you specify.
byCustomizationType: Return models that support the customization type that you specify. For more information, see
`Custom models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_ in the `Amazon Bedrock
User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
byOutputModality: Return models that support the output modality that you specify.
byInferenceType: Return models that support the inference type that you specify. For more information, see
`Provisioned Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in the `Amazon
Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
"""
args: dict[str, Any] = dict(
byProvider=self.serialize(byProvider),
byCustomizationType=self.serialize(byCustomizationType),
byOutputModality=self.serialize(byOutputModality),
byInferenceType=self.serialize(byInferenceType),
)
_response = self.client.list_foundation_models(
**{k: v for k, v in args.items() if v is not None}
)
response = ListFoundationModelsResponse(**_response)
if response and response.modelSummaries:
self.sessionize(response.modelSummaries)
return PrimaryBoto3ModelQuerySet(response.modelSummaries)
return PrimaryBoto3ModelQuerySet([])
[docs] def get_availability(
self, modelId: str
) -> "GetFoundationModelAvailabilityResponse":
"""
Get information about the Foundation model availability.
Args:
modelId: The model Id of the foundation model.
"""
args: dict[str, Any] = dict(modelId=self.serialize(modelId))
_response = self.client.get_foundation_model_availability(
**{k: v for k, v in args.items() if v is not None}
)
response = GetFoundationModelAvailabilityResponse(**_response)
results: "GetFoundationModelAvailabilityResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("GetFoundationModelAvailabilityResponse", results)
[docs]class FoundationModelAgreementManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(self, model: "FoundationModelAgreement") -> str:
"""
Request a model access agreement for the specified model.
Args:
model: The :py:class:`FoundationModelAgreement` to create.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(offerToken=data.get("offerToken"), modelId=data.get("modelId"))
_response = self.client.create_foundation_model_agreement(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateFoundationModelAgreementResponse(**_response)
self.sessionize(response.modelId)
return cast("str", response.modelId)
[docs] def delete(self, modelId: str) -> None:
"""
Delete the model access agreement for the specified model.
Args:
modelId: Model Id of the model access to delete.
"""
args: dict[str, Any] = dict(modelId=self.serialize(modelId))
self.client.delete_foundation_model_agreement(
**{k: v for k, v in args.items() if v is not None}
)
[docs] def list_offers(
self, modelId: str, *, offerType: "Literal['ALL', 'PUBLIC'] | None" = None
) -> "builtins.list[Offer]":
"""
Get the offers associated with the specified model.
Args:
modelId: Model Id of the foundation model.
Keyword Args:
offerType: Type of offer associated with the model.
"""
args: dict[str, Any] = dict(
modelId=self.serialize(modelId), offerType=self.serialize(offerType)
)
_response = self.client.list_foundation_model_agreement_offers(
**{k: v for k, v in args.items() if v is not None}
)
response = ListFoundationModelAgreementOffersResponse(**_response)
results: "builtins.list[Offer]" = None
if response is not None:
results = response.offers
self.sessionize(results)
return cast("builtins.list[Offer]", results)
[docs]class CustomModelManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "CustomModel",
modelSourceConfig: "ModelDataSource",
modelKmsKeyArn: "str | None" = None,
roleArn: "str | None" = None,
modelTags: "builtins.list[Tag] | None" = None,
clientRequestToken: "str | None" = None,
) -> str:
"""
Creates a new custom model in Amazon Bedrock. After the model is active, you can
use it for inference.
Args:
model: The :py:class:`CustomModelSummary` to create.
modelSourceConfig: The data source for the model. The Amazon S3 URI in the model source must be for the Amazon-
managed Amazon S3 bucket containing your model artifacts.
Keyword Args:
modelKmsKeyArn: The Amazon Resource Name (ARN) of the customer managed KMS key to encrypt the custom model. If you
don't provide a KMS key, Amazon Bedrock uses an Amazon Web Services-managed KMS key to encrypt the model.
roleArn: The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock assumes to perform tasks on your
behalf. This role must have permissions to access the Amazon S3 bucket containing your model artifacts and the KMS
key (if specified). For more information, see `Setting up an IAM service role for importing models
<https://docs.aws.amazon.com/bedrock/latest/userguide/model-import-iam-role.html>`_ in the Amazon Bedrock User
Guide.
modelTags: A list of key-value pairs to associate with the custom model resource. You can use these tags to organize
and identify your resources.
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
modelName=data.get("modelName"),
modelSourceConfig=self.serialize(modelSourceConfig),
modelKmsKeyArn=self.serialize(modelKmsKeyArn),
roleArn=self.serialize(roleArn),
modelTags=self.serialize(modelTags),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.create_custom_model(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateCustomModelResponse(**_response)
self.sessionize(response.modelArn)
return cast("str", response.modelArn)
[docs] def get(self, modelArn: str) -> "CustomModel | None":
"""
Get the properties associated with a Amazon Bedrock custom model that you have created. For more information, see
`Custom models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
modelArn: Name or Amazon Resource Name (ARN) of the custom model.
"""
args: dict[str, Any] = dict(modelIdentifier=self.serialize(modelArn))
_response = self.client.get_custom_model(
**{k: v for k, v in args.items() if v is not None}
)
response = CustomModel(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeBefore: "datetime | None" = None,
creationTimeAfter: "datetime | None" = None,
nameContains: "str | None" = None,
baseModelArnEquals: "str | None" = None,
foundationModelArnEquals: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
isOwned: "bool | None" = None,
modelStatus: "Literal['Active', 'Creating', 'Failed'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of the custom models that you have created with the
``CreateModelCustomizationJob`` operation.
Keyword Args:
creationTimeBefore: Return custom models created before the specified time.
creationTimeAfter: Return custom models created after the specified time.
nameContains: Return custom models only if the job name contains these characters.
baseModelArnEquals: Return custom models only if the base model Amazon Resource Name (ARN) matches this parameter.
foundationModelArnEquals: Return custom models only if the foundation model Amazon Resource Name (ARN) matches this
parameter.
sortBy: The field to sort by in the returned list of models.
sortOrder: The sort order of the results.
isOwned: Return custom models depending on if the current account owns them (``true``) or if they were shared with
the current account (``false``).
modelStatus: The status of them model to filter results by. Possible values include:
"""
paginator = self.client.get_paginator("list_custom_models")
args: dict[str, Any] = dict(
creationTimeBefore=self.serialize(creationTimeBefore),
creationTimeAfter=self.serialize(creationTimeAfter),
nameContains=self.serialize(nameContains),
baseModelArnEquals=self.serialize(baseModelArnEquals),
foundationModelArnEquals=self.serialize(foundationModelArnEquals),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
isOwned=self.serialize(isOwned),
modelStatus=self.serialize(modelStatus),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListCustomModelsResponse(**_response)
if response.modelSummaries:
results.extend(response.modelSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def delete(self, modelArn: str) -> None:
"""
Deletes a custom model that you created earlier. For more information, see `Custom
models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
modelArn: Name of the model to delete.
"""
args: dict[str, Any] = dict(modelIdentifier=self.serialize(modelArn))
self.client.delete_custom_model(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class ImportedModelManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def get(self, modelArn: str) -> "ImportedModel | None":
"""
Gets properties associated with a customized model you imported.
Args:
modelArn: Name or Amazon Resource Name (ARN) of the imported model.
"""
args: dict[str, Any] = dict(modelIdentifier=self.serialize(modelArn))
_response = self.client.get_imported_model(
**{k: v for k, v in args.items() if v is not None}
)
response = ImportedModel(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeBefore: "datetime | None" = None,
creationTimeAfter: "datetime | None" = None,
nameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of models you've imported. You can filter the results to return based on one or more criteria. For more
information, see `Import a customized model <https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-
import-model.html>`_ in the `Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-
service.html>`_.
Keyword Args:
creationTimeBefore: Return imported models that created before the specified time.
creationTimeAfter: Return imported models that were created after the specified time.
nameContains: Return imported models only if the model name contains these characters.
sortBy: The field to sort by in the returned list of imported models.
sortOrder: Specifies whetehr to sort the results in ascending or descending order.
"""
paginator = self.client.get_paginator("list_imported_models")
args: dict[str, Any] = dict(
creationTimeBefore=self.serialize(creationTimeBefore),
creationTimeAfter=self.serialize(creationTimeAfter),
nameContains=self.serialize(nameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListImportedModelsResponse(**_response)
if response.modelSummaries:
results.extend(response.modelSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def delete(self, modelArn: str) -> None:
"""
Deletes a custom model that you imported earlier. For more information, see `Import a customized
model <https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html>`_ in the `Amazon
Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
modelArn: Name of the imported model to delete.
"""
args: dict[str, Any] = dict(modelIdentifier=self.serialize(modelArn))
self.client.delete_imported_model(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class GuardrailManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "Guardrail",
topicPolicyConfig: "GuardrailTopicPolicyConfig | None" = None,
contentPolicyConfig: "GuardrailContentPolicyConfig | None" = None,
wordPolicyConfig: "GuardrailWordPolicyConfig | None" = None,
sensitiveInformationPolicyConfig: "GuardrailSensitiveInformationPolicyConfig | None" = None,
contextualGroundingPolicyConfig: "GuardrailContextualGroundingPolicyConfig | None" = None,
automatedReasoningPolicyConfig: "GuardrailAutomatedReasoningPolicyConfig | None" = None,
crossRegionConfig: "GuardrailCrossRegionConfig | None" = None,
kmsKeyId: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
clientRequestToken: "str | None" = None,
) -> str:
"""
Creates a guardrail to block topics and to implement safeguards for your
generative AI applications.
Args:
model: The :py:class:`GetGuardrailResponse` to create.
Keyword Args:
topicPolicyConfig: The topic policies to configure for the guardrail.
contentPolicyConfig: The content filter policies to configure for the guardrail.
wordPolicyConfig: The word policy you configure for the guardrail.
sensitiveInformationPolicyConfig: The sensitive information policy to configure for the guardrail.
contextualGroundingPolicyConfig: The contextual grounding policy configuration used to create a guardrail.
automatedReasoningPolicyConfig: Optional configuration for integrating Automated Reasoning policies with the new
guardrail.
crossRegionConfig: The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles
define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.
kmsKeyId: The ARN of the KMS key that you use to encrypt the guardrail.
tags: The tags that you want to attach to the guardrail.
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than once.
If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_ in the *Amazon S3 User
Guide*.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
name=data.get("name"),
blockedInputMessaging=data.get("blockedInputMessaging"),
blockedOutputsMessaging=data.get("blockedOutputsMessaging"),
description=data.get("description"),
topicPolicyConfig=self.serialize(topicPolicyConfig),
contentPolicyConfig=self.serialize(contentPolicyConfig),
wordPolicyConfig=self.serialize(wordPolicyConfig),
sensitiveInformationPolicyConfig=self.serialize(
sensitiveInformationPolicyConfig
),
contextualGroundingPolicyConfig=self.serialize(
contextualGroundingPolicyConfig
),
automatedReasoningPolicyConfig=self.serialize(
automatedReasoningPolicyConfig
),
crossRegionConfig=self.serialize(crossRegionConfig),
kmsKeyId=self.serialize(kmsKeyId),
tags=self.serialize(tags),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.create_guardrail(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateGuardrailResponse(**_response)
self.sessionize(response.guardrailArn)
return cast("str", response.guardrailArn)
[docs] def get(
self, guardrailId: str, *, guardrailVersion: "str | None" = None
) -> "Guardrail | None":
"""
Gets details about a guardrail. If you don't specify a version, the response
returns details for the ``DRAFT`` version.
Args:
guardrailId: The unique identifier of the guardrail for which to get details. This can be an ID or the ARN.
Keyword Args:
guardrailVersion: The version of the guardrail for which to get details. If you don't specify a version, the
response returns details for the ``DRAFT`` version.
"""
args: dict[str, Any] = dict(
guardrailIdentifier=self.serialize(guardrailId),
guardrailVersion=self.serialize(guardrailVersion),
)
_response = self.client.get_guardrail(
**{k: v for k, v in args.items() if v is not None}
)
response = Guardrail(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self, *, guardrailIdentifier: "str | None" = None
) -> PrimaryBoto3ModelQuerySet:
"""
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.
Keyword Args:
guardrailIdentifier: The unique identifier of the guardrail. This can be an ID or the ARN.
"""
paginator = self.client.get_paginator("list_guardrails")
args: dict[str, Any] = dict(
guardrailIdentifier=self.serialize(guardrailIdentifier)
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListGuardrailsResponse(**_response)
if response.guardrails:
results.extend(response.guardrails)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self,
model: "Guardrail",
topicPolicyConfig: "GuardrailTopicPolicyConfig | None" = None,
contentPolicyConfig: "GuardrailContentPolicyConfig | None" = None,
wordPolicyConfig: "GuardrailWordPolicyConfig | None" = None,
sensitiveInformationPolicyConfig: "GuardrailSensitiveInformationPolicyConfig | None" = None,
contextualGroundingPolicyConfig: "GuardrailContextualGroundingPolicyConfig | None" = None,
automatedReasoningPolicyConfig: "GuardrailAutomatedReasoningPolicyConfig | None" = None,
crossRegionConfig: "GuardrailCrossRegionConfig | None" = None,
kmsKeyId: "str | None" = None,
) -> str:
"""
Updates a guardrail with the values you specify.
Args:
model: The :py:class:`GetGuardrailResponse` to update.
Keyword Args:
topicPolicyConfig: The topic policy to configure for the guardrail.
contentPolicyConfig: The content policy to configure for the guardrail.
wordPolicyConfig: The word policy to configure for the guardrail.
sensitiveInformationPolicyConfig: The sensitive information policy to configure for the guardrail.
contextualGroundingPolicyConfig: The contextual grounding policy configuration used to update a guardrail.
automatedReasoningPolicyConfig: Updated configuration for Automated Reasoning policies associated with the
guardrail.
crossRegionConfig: The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles
define the destination Amazon Web Services Regions where guardrail inference requests can be automatically routed.
kmsKeyId: The ARN of the KMS key with which to encrypt the guardrail.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
guardrailIdentifier=data.get("guardrailId"),
name=data.get("name"),
blockedInputMessaging=data.get("blockedInputMessaging"),
blockedOutputsMessaging=data.get("blockedOutputsMessaging"),
description=data.get("description"),
topicPolicyConfig=self.serialize(topicPolicyConfig),
contentPolicyConfig=self.serialize(contentPolicyConfig),
wordPolicyConfig=self.serialize(wordPolicyConfig),
sensitiveInformationPolicyConfig=self.serialize(
sensitiveInformationPolicyConfig
),
contextualGroundingPolicyConfig=self.serialize(
contextualGroundingPolicyConfig
),
automatedReasoningPolicyConfig=self.serialize(
automatedReasoningPolicyConfig
),
crossRegionConfig=self.serialize(crossRegionConfig),
kmsKeyId=self.serialize(kmsKeyId),
)
_response = self.client.update_guardrail(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateGuardrailResponse(**_response)
self.sessionize(response.guardrailArn)
return cast("str", response.guardrailArn)
[docs] def delete(
self, guardrailId: str, *, guardrailVersion: "str | None" = None
) -> None:
"""
Deletes a guardrail.
Args:
guardrailId: The unique identifier of the guardrail. This can be an ID or the ARN.
Keyword Args:
guardrailVersion: The version of the guardrail.
"""
args: dict[str, Any] = dict(
guardrailIdentifier=self.serialize(guardrailId),
guardrailVersion=self.serialize(guardrailVersion),
)
self.client.delete_guardrail(**{k: v for k, v in args.items() if v is not None})
[docs] def create_version(
self,
guardrailId: str,
*,
description: "str | None" = None,
clientRequestToken: "str | None" = None,
) -> str:
"""
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.
Args:
guardrailId: The unique identifier of the guardrail. This can be an ID or the ARN.
Keyword Args:
description: A description of the guardrail version.
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than once.
If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_ in the *Amazon S3 User
Guide*.
"""
args: dict[str, Any] = dict(
guardrailIdentifier=self.serialize(guardrailId),
description=self.serialize(description),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.create_guardrail_version(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateGuardrailVersionResponse(**_response)
results: str = None
if response is not None:
results = response.version
self.sessionize(results)
return cast("str", results)
[docs]class AutomatedReasoningPolicyManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "AutomatedReasoningPolicy",
clientRequestToken: "str | None" = None,
policyDefinition: "AutomatedReasoningPolicyDefinition | None" = None,
kmsKeyId: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates an Automated Reasoning policy for Amazon Bedrock Guardrails. Automated
Reasoning policies use mathematical techniques to detect hallucinations, suggest
corrections, and highlight unstated assumptions in the responses of your GenAI
application.
Args:
model: The :py:class:`AutomatedReasoningPolicySummary` to create.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than once. If
this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.
policyDefinition: The policy definition that contains the formal logic rules, variables, and custom variable types
used to validate foundation model responses in your application.
kmsKeyId: The identifier of the KMS key to use for encrypting the automated reasoning policy and its associated
artifacts. If you don't specify a KMS key, Amazon Bedrock uses an KMS managed key for encryption. For enhanced
security and control, you can specify a customer managed KMS key.
tags: A list of tags to associate with the Automated Reasoning policy. Tags help you organize and manage your
policies.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
name=data.get("name"),
description=data.get("description"),
clientRequestToken=self.serialize(clientRequestToken),
policyDefinition=self.serialize(policyDefinition),
kmsKeyId=self.serialize(kmsKeyId),
tags=self.serialize(tags),
)
_response = self.client.create_automated_reasoning_policy(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateAutomatedReasoningPolicyResponse(**_response)
self.sessionize(response.policyArn)
return cast("str", response.policyArn)
[docs] def get(self, policyArn: str) -> "AutomatedReasoningPolicy | None":
"""
Retrieves details about an Automated Reasoning policy or policy version. Returns
information including the policy definition, metadata, and timestamps.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy to retrieve. Can be either the
unversioned ARN for the draft policy or an ARN for a specific policy version.
"""
args: dict[str, Any] = dict(policyArn=self.serialize(policyArn))
_response = self.client.get_automated_reasoning_policy(
**{k: v for k, v in args.items() if v is not None}
)
response = AutomatedReasoningPolicy(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(self, *, policyArn: "str | None" = None) -> PrimaryBoto3ModelQuerySet:
"""
Lists all Automated Reasoning policies in your account, with optional filtering
by policy ARN. This helps you manage and discover existing policies.
Keyword Args:
policyArn: Optional filter to list only the policy versions with the specified Amazon Resource Name (ARN). If not
provided, the DRAFT versions for all policies are listed.
"""
paginator = self.client.get_paginator("list_automated_reasoning_policies")
args: dict[str, Any] = dict(policyArn=self.serialize(policyArn))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListAutomatedReasoningPoliciesResponse(**_response)
if response.automatedReasoningPolicySummaries:
results.extend(response.automatedReasoningPolicySummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self,
model: "AutomatedReasoningPolicy",
policyDefinition: "AutomatedReasoningPolicyDefinition",
) -> str:
"""
Updates an existing Automated Reasoning policy with new rules, variables, or
configuration. This creates a new version of the policy while preserving the
previous version.
Args:
model: The :py:class:`AutomatedReasoningPolicySummary` to update.
policyDefinition: The updated policy definition containing the formal logic rules, variables, and types.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
policyArn=data.get("policyArn"),
policyDefinition=self.serialize(policyDefinition),
name=data.get("name"),
description=data.get("description"),
)
_response = self.client.update_automated_reasoning_policy(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateAutomatedReasoningPolicyResponse(**_response)
self.sessionize(response.policyArn)
return cast("str", response.policyArn)
[docs] def delete(self, policyArn: str, *, force: "bool | None" = None) -> None:
"""
Deletes an Automated Reasoning policy or policy version. This operation is
idempotent. If you delete a policy more than once, each call succeeds. Deleting
a policy removes it permanently and cannot be undone.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy to delete.
Keyword Args:
force: Specifies whether to force delete the automated reasoning policy even if it has active resources. When
``false``, Amazon Bedrock validates if all artifacts have been deleted (e.g. policy version, test case, test result)
for a policy before deletion. When ``true``, Amazon Bedrock will delete the policy and all its artifacts without
validation. Default is ``false``.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn), force=self.serialize(force)
)
self.client.delete_automated_reasoning_policy(
**{k: v for k, v in args.items() if v is not None}
)
[docs] def create_version(
self,
policyArn: str,
lastUpdatedDefinitionHash: str,
*,
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates a new version of an existing Automated Reasoning policy. This allows you
to iterate on your policy rules while maintaining previous versions for rollback
or comparison purposes.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy for which to create a version.
lastUpdatedDefinitionHash: The hash of the current policy definition used as a concurrency token to ensure the
policy hasn't been modified since you last retrieved it.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
tags: A list of tags to associate with the policy version.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
lastUpdatedDefinitionHash=self.serialize(lastUpdatedDefinitionHash),
clientRequestToken=self.serialize(clientRequestToken),
tags=self.serialize(tags),
)
_response = self.client.create_automated_reasoning_policy_version(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateAutomatedReasoningPolicyVersionResponse(**_response)
results: str = None
if response is not None:
results = response.version
self.sessionize(results)
return cast("str", results)
[docs] def export_version(self, policyArn: str) -> "AutomatedReasoningPolicyDefinition":
"""
Exports the policy definition for an Automated Reasoning policy version. Returns
the complete policy definition including rules, variables, and custom variable
types in a structured format.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy to export. Can be either the unversioned
ARN for the draft policy or a versioned ARN for a specific policy version.
"""
args: dict[str, Any] = dict(policyArn=self.serialize(policyArn))
_response = self.client.export_automated_reasoning_policy_version(
**{k: v for k, v in args.items() if v is not None}
)
response = ExportAutomatedReasoningPolicyVersionResponse(**_response)
results: "AutomatedReasoningPolicyDefinition" = None
if response is not None:
results = response.policyDefinition
self.sessionize(results)
return cast("AutomatedReasoningPolicyDefinition", results)
[docs] def start_build_workflow(
self,
policyArn: str,
buildWorkflowType: Literal[
"INGEST_CONTENT",
"REFINE_POLICY",
"IMPORT_POLICY",
"GENERATE_FIDELITY_REPORT",
"GENERATE_POLICY_SCENARIOS",
],
sourceContent: "AutomatedReasoningPolicyBuildWorkflowSource",
*,
clientRequestToken: "str | None" = None,
) -> str:
"""
Starts a new build workflow for an Automated Reasoning policy. This initiates
the process of analyzing source documents and generating policy rules,
variables, and types.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy for which to start the build workflow.
buildWorkflowType: The type of build workflow to start (e.g., DOCUMENT_INGESTION for processing new documents,
POLICY_REPAIR for fixing existing policies).
sourceContent: The source content for the build workflow, such as documents to analyze or repair instructions for
existing policies.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than once. If
this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowType=self.serialize(buildWorkflowType),
sourceContent=self.serialize(sourceContent),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.start_automated_reasoning_policy_build_workflow(
**{k: v for k, v in args.items() if v is not None}
)
response = StartAutomatedReasoningPolicyBuildWorkflowResponse(**_response)
results: str = None
if response is not None:
results = response.buildWorkflowId
self.sessionize(results)
return cast("str", results)
[docs]class AutomatedReasoningPolicyBuildWorkflowManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def get(
self, policyArn: str, buildWorkflowId: str
) -> "AutomatedReasoningPolicyBuildWorkflow | None":
"""
Retrieves detailed information about an Automated Reasoning policy build
workflow, including its status, configuration, and metadata.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose build workflow you want to
retrieve.
buildWorkflowId: The unique identifier of the build workflow to retrieve.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
)
_response = self.client.get_automated_reasoning_policy_build_workflow(
**{k: v for k, v in args.items() if v is not None}
)
response = AutomatedReasoningPolicyBuildWorkflow(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(self, policyArn: str) -> PrimaryBoto3ModelQuerySet:
"""
Lists all build workflows for an Automated Reasoning policy, showing the history
of policy creation and modification attempts.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose build workflows you want to list.
"""
paginator = self.client.get_paginator(
"list_automated_reasoning_policy_build_workflows"
)
args: dict[str, Any] = dict(policyArn=self.serialize(policyArn))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListAutomatedReasoningPolicyBuildWorkflowsResponse(**_response)
if response.automatedReasoningPolicyBuildWorkflowSummaries:
results.extend(response.automatedReasoningPolicyBuildWorkflowSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def cancel(
self, policyArn: str, buildWorkflowId: str
) -> "CancelAutomatedReasoningPolicyBuildWorkflowResponse":
"""
Cancels a running Automated Reasoning policy build workflow. This stops the
policy generation process and prevents further processing of the source
documents.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose build workflow you want to cancel.
buildWorkflowId: The unique identifier of the build workflow to cancel. You can get this ID from the
StartAutomatedReasoningPolicyBuildWorkflow response or by listing build workflows.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
)
_response = self.client.cancel_automated_reasoning_policy_build_workflow(
**{k: v for k, v in args.items() if v is not None}
)
response = CancelAutomatedReasoningPolicyBuildWorkflowResponse(**_response)
results: "CancelAutomatedReasoningPolicyBuildWorkflowResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("CancelAutomatedReasoningPolicyBuildWorkflowResponse", results)
[docs] def delete(
self, policyArn: str, buildWorkflowId: str, lastUpdatedAt: datetime
) -> None:
"""
Deletes an Automated Reasoning policy build workflow and its associated
artifacts. This permanently removes the workflow history and any generated
assets.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose build workflow you want to delete.
buildWorkflowId: The unique identifier of the build workflow to delete.
lastUpdatedAt: The timestamp when the build workflow was last updated. This is used for optimistic concurrency
control to prevent accidental deletion of workflows that have been modified.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
lastUpdatedAt=self.serialize(lastUpdatedAt),
)
self.client.delete_automated_reasoning_policy_build_workflow(
**{k: v for k, v in args.items() if v is not None}
)
[docs] def start_test_workflow(
self,
policyArn: str,
buildWorkflowId: str,
*,
testCaseIds: "builtins.list[str] | None" = None,
clientRequestToken: "str | None" = None,
) -> str:
"""
Initiates a test workflow to validate Automated Reasoning policy tests. The
workflow executes the specified tests against the policy and generates
validation results.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy to test.
buildWorkflowId: The build workflow identifier. The build workflow must show a ``COMPLETED`` status before running
tests.
Keyword Args:
testCaseIds: The list of test identifiers to run. If not provided, all tests for the policy are run.
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
testCaseIds=self.serialize(testCaseIds),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.start_automated_reasoning_policy_test_workflow(
**{k: v for k, v in args.items() if v is not None}
)
response = StartAutomatedReasoningPolicyTestWorkflowResponse(**_response)
results: str = None
if response is not None:
results = response.policyArn
self.sessionize(results)
return cast("str", results)
[docs]class AutomatedReasoningPolicyTestCaseManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "AutomatedReasoningPolicyTestCase",
clientRequestToken: "str | None" = None,
) -> str:
"""
Creates a test for an Automated Reasoning policy. Tests validate that your
policy works as expected by providing sample inputs and expected outcomes. Use
tests to verify policy behavior before deploying to production.
Args:
model: The :py:class:`AutomatedReasoningPolicyTestCase` to create.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
policyArn=data.get("policyArn"),
guardContent=data.get("guardContent"),
expectedAggregatedFindingsResult=data.get(
"expectedAggregatedFindingsResult"
),
queryContent=data.get("queryContent"),
clientRequestToken=self.serialize(clientRequestToken),
confidenceThreshold=data.get("confidenceThreshold"),
)
_response = self.client.create_automated_reasoning_policy_test_case(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateAutomatedReasoningPolicyTestCaseResponse(**_response)
self.sessionize(response.testCaseId)
return cast("str", response.testCaseId)
[docs] def get(
self, policyArn: str, testCaseId: str
) -> "AutomatedReasoningPolicyTestCase | None":
"""
Retrieves details about a specific Automated Reasoning policy test.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy that contains the test.
testCaseId: The unique identifier of the test to retrieve.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn), testCaseId=self.serialize(testCaseId)
)
_response = self.client.get_automated_reasoning_policy_test_case(
**{k: v for k, v in args.items() if v is not None}
)
response = GetAutomatedReasoningPolicyTestCaseResponse(**_response)
if response and response.testCase:
self.sessionize(response.testCase)
return response.testCase
return None
[docs] def list(self, policyArn: str) -> PrimaryBoto3ModelQuerySet:
"""
Lists tests for an Automated Reasoning policy. We recommend using pagination to
ensure that the operation returns quickly and successfully.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy for which to list tests.
"""
paginator = self.client.get_paginator(
"list_automated_reasoning_policy_test_cases"
)
args: dict[str, Any] = dict(policyArn=self.serialize(policyArn))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListAutomatedReasoningPolicyTestCasesResponse(**_response)
if response.testCases:
results.extend(response.testCases)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self,
model: "AutomatedReasoningPolicyTestCase",
clientRequestToken: "str | None" = None,
) -> str:
"""
Updates an existing Automated Reasoning policy test. You can modify the content,
query, expected result, and confidence threshold.
Args:
model: The :py:class:`AutomatedReasoningPolicyTestCase` to update.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
policyArn=data.get("policyArn"),
testCaseId=data.get("testCaseId"),
guardContent=data.get("guardContent"),
lastUpdatedAt=data.get("lastUpdatedAt"),
expectedAggregatedFindingsResult=data.get(
"expectedAggregatedFindingsResult"
),
queryContent=data.get("queryContent"),
confidenceThreshold=data.get("confidenceThreshold"),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.update_automated_reasoning_policy_test_case(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateAutomatedReasoningPolicyTestCaseResponse(**_response)
self.sessionize(response.testCaseId)
return cast("str", response.testCaseId)
[docs] def delete(self, policyArn: str, testCaseId: str, lastUpdatedAt: datetime) -> None:
"""
Deletes an Automated Reasoning policy test. This operation is idempotent; if you
delete a test more than once, each call succeeds.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy that contains the test.
testCaseId: The unique identifier of the test to delete.
lastUpdatedAt: The timestamp when the test was last updated. This is used as a concurrency token to prevent
conflicting modifications.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
testCaseId=self.serialize(testCaseId),
lastUpdatedAt=self.serialize(lastUpdatedAt),
)
self.client.delete_automated_reasoning_policy_test_case(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class AutomatedReasoningPolicyTestResultManager(ReadonlyBoto3ModelManager):
service_name: str = "bedrock"
[docs] def get(
self, policyArn: str, buildWorkflowId: str, testCaseId: str
) -> "AutomatedReasoningPolicyTestResult | None":
"""
Retrieves the test result for a specific Automated Reasoning policy test.
Returns detailed validation findings and execution status.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy.
buildWorkflowId: The build workflow identifier. The build workflow must display a ``COMPLETED`` status to get
results.
testCaseId: The unique identifier of the test for which to retrieve results.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
testCaseId=self.serialize(testCaseId),
)
_response = self.client.get_automated_reasoning_policy_test_result(
**{k: v for k, v in args.items() if v is not None}
)
response = GetAutomatedReasoningPolicyTestResultResponse(**_response)
if response and response.testResult:
self.sessionize(response.testResult)
return response.testResult
return None
[docs] def list(self, policyArn: str, buildWorkflowId: str) -> PrimaryBoto3ModelQuerySet:
"""
Lists test results for an Automated Reasoning policy, showing how the policy
performed against various test scenarios and validation checks.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose test results you want to list.
buildWorkflowId: The unique identifier of the build workflow whose test results you want to list.
"""
paginator = self.client.get_paginator(
"list_automated_reasoning_policy_test_results"
)
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListAutomatedReasoningPolicyTestResultsResponse(**_response)
if response.testResults:
results.extend(response.testResults)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs]class AutomatedReasoningPolicyNextScenarioManager(ReadonlyBoto3ModelManager):
service_name: str = "bedrock"
[docs] def get(
self, policyArn: str, buildWorkflowId: str
) -> "AutomatedReasoningPolicyNextScenario | None":
"""
Retrieves the next test scenario for validating an Automated Reasoning policy.
This is used during the interactive policy refinement process to test policy
behavior.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy for which you want to get the next test
scenario.
buildWorkflowId: The unique identifier of the build workflow associated with the test scenarios.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
)
_response = self.client.get_automated_reasoning_policy_next_scenario(
**{k: v for k, v in args.items() if v is not None}
)
response = AutomatedReasoningPolicyNextScenario(**_response)
if response:
self.sessionize(response)
return response
return None
[docs]class AutomatedReasoningPolicyBuildWorkflowResultAssetsManager(
ReadonlyBoto3ModelManager
):
service_name: str = "bedrock"
[docs] def get(
self,
policyArn: str,
buildWorkflowId: str,
assetType: Literal[
"BUILD_LOG",
"QUALITY_REPORT",
"POLICY_DEFINITION",
"GENERATED_TEST_CASES",
"POLICY_SCENARIOS",
"FIDELITY_REPORT",
"ASSET_MANIFEST",
"SOURCE_DOCUMENT",
],
*,
assetId: "str | None" = None,
) -> "AutomatedReasoningPolicyBuildWorkflowResultAssets | None":
"""
Retrieves the resulting assets from a completed Automated Reasoning policy build
workflow, including build logs, quality reports, and generated policy artifacts.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose build workflow assets you want to
retrieve.
buildWorkflowId: The unique identifier of the build workflow whose result assets you want to retrieve.
assetType: The type of asset to retrieve (e.g., BUILD_LOG, QUALITY_REPORT, POLICY_DEFINITION, GENERATED_TEST_CASES,
POLICY_SCENARIOS, FIDELITY_REPORT, ASSET_MANIFEST, SOURCE_DOCUMENT).
Keyword Args:
assetId: The unique identifier of the specific asset to retrieve when multiple assets of the same type exist. This
is required when retrieving SOURCE_DOCUMENT assets, as multiple source documents may have been used in the workflow.
The asset ID can be obtained from the asset manifest.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
assetType=self.serialize(assetType),
assetId=self.serialize(assetId),
)
_response = (
self.client.get_automated_reasoning_policy_build_workflow_result_assets(
**{k: v for k, v in args.items() if v is not None}
)
)
response = AutomatedReasoningPolicyBuildWorkflowResultAssets(**_response)
if response:
self.sessionize(response)
return response
return None
[docs]class AutomatedReasoningPolicyAnnotationsManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def get(
self, policyArn: str, buildWorkflowId: str
) -> "AutomatedReasoningPolicyAnnotations | None":
"""
Retrieves the current annotations for an Automated Reasoning policy build
workflow. Annotations contain corrections to the rules, variables and types to
be applied to the policy.
Args:
policyArn: The Amazon Resource Name (ARN) of the Automated Reasoning policy whose annotations you want to retrieve.
buildWorkflowId: The unique identifier of the build workflow whose annotations you want to retrieve.
"""
args: dict[str, Any] = dict(
policyArn=self.serialize(policyArn),
buildWorkflowId=self.serialize(buildWorkflowId),
)
_response = self.client.get_automated_reasoning_policy_annotations(
**{k: v for k, v in args.items() if v is not None}
)
response = AutomatedReasoningPolicyAnnotations(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def update(self, model: "AutomatedReasoningPolicyAnnotations") -> str:
"""
Updates the annotations for an Automated Reasoning policy build workflow. This
allows you to modify extracted rules, variables, and types before finalizing the
policy.
Args:
model: The :py:class:`GetAutomatedReasoningPolicyAnnotationsResponse` to update.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
policyArn=data.get("policyArn"),
buildWorkflowId=data.get("buildWorkflowId"),
annotations=data.get("annotations"),
lastUpdatedAnnotationSetHash=data.get("lastUpdatedAnnotationSetHash"),
)
_response = self.client.update_automated_reasoning_policy_annotations(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateAutomatedReasoningPolicyAnnotationsResponse(**_response)
self.sessionize(response.annotationSetHash)
return cast("str", response.annotationSetHash)
[docs]class PromptRouterManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "PromptRouter",
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates a prompt router that manages the routing of requests between multiple
foundation models based on the routing criteria.
Args:
model: The :py:class:`PromptRouterSummary` to create.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier that you provide to ensure idempotency of your requests. If
not specified, the Amazon Web Services SDK automatically generates one for you.
tags: An array of key-value pairs to apply to this resource as tags. You can use tags to categorize and manage your
Amazon Web Services resources.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
promptRouterName=data.get("promptRouterName"),
models=data.get("models"),
routingCriteria=data.get("routingCriteria"),
fallbackModel=data.get("fallbackModel"),
clientRequestToken=self.serialize(clientRequestToken),
description=data.get("description"),
tags=self.serialize(tags),
)
_response = self.client.create_prompt_router(
**{k: v for k, v in args.items() if v is not None}
)
response = CreatePromptRouterResponse(**_response)
self.sessionize(response.promptRouterArn)
return cast("str", response.promptRouterArn)
[docs] def get(self, promptRouterArn: str) -> "PromptRouter | None":
"""
Retrieves details about a prompt router.
Args:
promptRouterArn: The prompt router's ARN
"""
args: dict[str, Any] = dict(promptRouterArn=self.serialize(promptRouterArn))
_response = self.client.get_prompt_router(
**{k: v for k, v in args.items() if v is not None}
)
response = PromptRouter(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self, *, type: "Literal['custom', 'default'] | None" = None
) -> PrimaryBoto3ModelQuerySet:
"""
Retrieves a list of prompt routers.
Keyword Args:
type: The type of the prompt routers, such as whether it's default or custom.
"""
paginator = self.client.get_paginator("list_prompt_routers")
args: dict[str, Any] = dict(type=self.serialize(type))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListPromptRoutersResponse(**_response)
if response.promptRouterSummaries:
results.extend(response.promptRouterSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def delete(self, promptRouterArn: str) -> None:
"""
Deletes a specified prompt router. This action cannot be undone.
Args:
promptRouterArn: The Amazon Resource Name (ARN) of the prompt router to delete.
"""
args: dict[str, Any] = dict(promptRouterArn=self.serialize(promptRouterArn))
self.client.delete_prompt_router(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class EvaluationJobManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "EvaluationJob",
clientRequestToken: "str | None" = None,
jobTags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates an evaluation job.
Args:
model: The :py:class:`GetEvaluationJobResponse` to create.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
jobTags: Tags to attach to the model evaluation job.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
jobName=data.get("jobName"),
roleArn=data.get("roleArn"),
evaluationConfig=data.get("evaluationConfig"),
inferenceConfig=data.get("inferenceConfig"),
outputDataConfig=data.get("outputDataConfig"),
jobDescription=data.get("jobDescription"),
clientRequestToken=self.serialize(clientRequestToken),
customerEncryptionKeyId=data.get("customerEncryptionKeyId"),
jobTags=self.serialize(jobTags),
applicationType=data.get("applicationType"),
)
_response = self.client.create_evaluation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateEvaluationJobResponse(**_response)
self.sessionize(response.jobArn)
return cast("str", response.jobArn)
[docs] def get(self, jobArn: str) -> "EvaluationJob | None":
"""
Gets information about an evaluation job, such as the status of the job.
Args:
jobArn: The Amazon Resource Name (ARN) of the evaluation job you want get information on.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.get_evaluation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = EvaluationJob(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeAfter: "datetime | None" = None,
creationTimeBefore: "datetime | None" = None,
statusEquals: "Literal['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped', 'Deleting'] | None" = None,
applicationTypeEquals: "Literal['ModelEvaluation', 'RagEvaluation'] | None" = None,
nameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Lists all existing evaluation jobs.
Keyword Args:
creationTimeAfter: A filter to only list evaluation jobs created after a specified time.
creationTimeBefore: A filter to only list evaluation jobs created before a specified time.
statusEquals: A filter to only list evaluation jobs that are of a certain status.
applicationTypeEquals: A filter to only list evaluation jobs that are either model evaluations or knowledge base
evaluations.
nameContains: A filter to only list evaluation jobs that contain a specified string in the job name.
sortBy: Specifies a creation time to sort the list of evaluation jobs by when they were created.
sortOrder: Specifies whether to sort the list of evaluation jobs by either ascending or descending order.
"""
paginator = self.client.get_paginator("list_evaluation_jobs")
args: dict[str, Any] = dict(
creationTimeAfter=self.serialize(creationTimeAfter),
creationTimeBefore=self.serialize(creationTimeBefore),
statusEquals=self.serialize(statusEquals),
applicationTypeEquals=self.serialize(applicationTypeEquals),
nameContains=self.serialize(nameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListEvaluationJobsResponse(**_response)
if response.jobSummaries:
results.extend(response.jobSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def stop(self, jobArn: str) -> "StopEvaluationJobResponse":
"""
Stops an evaluation job that is current being created or running.
Args:
jobArn: The Amazon Resource Name (ARN) of the evaluation job you want to stop.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.stop_evaluation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = StopEvaluationJobResponse(**_response)
results: "StopEvaluationJobResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("StopEvaluationJobResponse", results)
[docs] def batch_delete(
self, jobArns: builtins.list[str]
) -> "BatchDeleteEvaluationJobResponse":
"""
Deletes a batch of evaluation jobs. An evaluation job can only be deleted if it
has following status ``FAILED``, ``COMPLETED``, and ``STOPPED``. You can request
up to 25 model evaluation jobs be deleted in a single request.
Args:
jobArns: A list of one or more evaluation job Amazon Resource Names (ARNs) you want to delete.
"""
args: dict[str, Any] = dict(jobIdentifiers=self.serialize(jobArns))
_response = self.client.batch_delete_evaluation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = BatchDeleteEvaluationJobResponse(**_response)
results: "BatchDeleteEvaluationJobResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("BatchDeleteEvaluationJobResponse", results)
[docs]class EnforcedGuardrailsConfigurationManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def list(
self,
) -> PrimaryBoto3ModelQuerySet:
"""
Lists the account-level enforced guardrail configurations.
"""
paginator = self.client.get_paginator("list_enforced_guardrails_configuration")
args: dict[str, Any] = dict()
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListEnforcedGuardrailsConfigurationResponse(**_response)
if response.guardrailsConfig:
results.extend(response.guardrailsConfig)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def put(
self,
guardrailInferenceConfig: "AccountEnforcedGuardrailInferenceInputConfiguration",
*,
configId: "str | None" = None,
) -> str:
"""
Sets the account-level enforced guardrail configuration.
Args:
guardrailInferenceConfig: Account-level enforced guardrail input configuration.
Keyword Args:
configId: Unique ID for the account enforced configuration.
"""
args: dict[str, Any] = dict(
guardrailInferenceConfig=self.serialize(guardrailInferenceConfig),
configId=self.serialize(configId),
)
_response = self.client.put_enforced_guardrail_configuration(
**{k: v for k, v in args.items() if v is not None}
)
response = PutEnforcedGuardrailConfigurationResponse(**_response)
results: str = None
if response is not None:
results = response.configId
self.sessionize(results)
return cast("str", results)
[docs] def delete(self, configId: str) -> None:
"""
Deletes the account-level enforced guardrail configuration.
Args:
configId: Unique ID for the account enforced configuration.
"""
args: dict[str, Any] = dict(configId=self.serialize(configId))
self.client.delete_enforced_guardrail_configuration(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class ModelCustomizationJobManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "ModelCustomizationJob",
customModelName: str,
baseModelIdentifier: str,
customModelKmsKeyId: "str | None" = None,
jobTags: "builtins.list[Tag] | None" = None,
customModelTags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates a fine-tuning job to customize a base model.
Args:
model: The :py:class:`GetModelCustomizationJobResponse` to create.
customModelName: A name for the resulting custom model.
baseModelIdentifier: Name of the base model.
Keyword Args:
customModelKmsKeyId: The custom model is encrypted at rest using this key.
jobTags: Tags to attach to the job.
customModelTags: Tags to attach to the resulting custom model.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
jobName=data.get("jobName"),
customModelName=self.serialize(customModelName),
roleArn=data.get("roleArn"),
baseModelIdentifier=self.serialize(baseModelIdentifier),
trainingDataConfig=data.get("trainingDataConfig"),
outputDataConfig=data.get("outputDataConfig"),
clientRequestToken=data.get("clientRequestToken"),
customizationType=data.get("customizationType"),
customModelKmsKeyId=self.serialize(customModelKmsKeyId),
jobTags=self.serialize(jobTags),
customModelTags=self.serialize(customModelTags),
validationDataConfig=data.get("validationDataConfig"),
hyperParameters=data.get("hyperParameters"),
vpcConfig=data.get("vpcConfig"),
customizationConfig=data.get("customizationConfig"),
)
_response = self.client.create_model_customization_job(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateModelCustomizationJobResponse(**_response)
self.sessionize(response.jobArn)
return cast("str", response.jobArn)
[docs] def get(self, jobArn: str) -> "ModelCustomizationJob | None":
"""
Retrieves the properties associated with a model-customization job, including the status of the job. For more
information, see `Custom models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_ in the `Amazon
Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
jobArn: Identifier for the customization job.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.get_model_customization_job(
**{k: v for k, v in args.items() if v is not None}
)
response = ModelCustomizationJob(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeAfter: "datetime | None" = None,
creationTimeBefore: "datetime | None" = None,
statusEquals: "Literal['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped'] | None" = None,
nameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of model customization jobs that you have submitted. You can
filter the jobs to return based on one or more criteria.
Keyword Args:
creationTimeAfter: Return customization jobs created after the specified time.
creationTimeBefore: Return customization jobs created before the specified time.
statusEquals: Return customization jobs with the specified status.
nameContains: Return customization jobs only if the job name contains these characters.
sortBy: The field to sort by in the returned list of jobs.
sortOrder: The sort order of the results.
"""
paginator = self.client.get_paginator("list_model_customization_jobs")
args: dict[str, Any] = dict(
creationTimeAfter=self.serialize(creationTimeAfter),
creationTimeBefore=self.serialize(creationTimeBefore),
statusEquals=self.serialize(statusEquals),
nameContains=self.serialize(nameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListModelCustomizationJobsResponse(**_response)
if response.modelCustomizationJobSummaries:
results.extend(response.modelCustomizationJobSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def stop(self, jobArn: str) -> "StopModelCustomizationJobResponse":
"""
Stops an active model customization job. For more information, see `Custom
models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
jobArn: Job identifier of the job to stop.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.stop_model_customization_job(
**{k: v for k, v in args.items() if v is not None}
)
response = StopModelCustomizationJobResponse(**_response)
results: "StopModelCustomizationJobResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("StopModelCustomizationJobResponse", results)
[docs]class InferenceProfileManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "InferenceProfile",
modelSource: "InferenceProfileModelSource",
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> str:
"""
Creates an application inference profile to track metrics and costs when invoking a model. To create an application
inference profile for a foundation model in one region, specify the ARN of the model in that region. To create an
application inference profile for a foundation model across multiple regions, specify the ARN of the system-defined
inference profile that contains the regions that you want to route requests to. For more information, see `Increase
throughput and resilience with cross-region inference in Amazon
Bedrock <https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html>`_. in the Amazon Bedrock User
Guide.
Args:
model: The :py:class:`InferenceProfileSummary` to create.
modelSource: The foundation model or system-defined inference profile that the inference profile will track metrics
and costs for.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
tags: An array of objects, each of which contains a tag and its value. For more information, see `Tagging resources
<https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_ in the `Amazon Bedrock User Guide
<https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
inferenceProfileName=data.get("inferenceProfileName"),
modelSource=self.serialize(modelSource),
description=data.get("description"),
clientRequestToken=self.serialize(clientRequestToken),
tags=self.serialize(tags),
)
_response = self.client.create_inference_profile(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateInferenceProfileResponse(**_response)
self.sessionize(response.inferenceProfileArn)
return cast("str", response.inferenceProfileArn)
[docs] def get(self, inferenceProfileArn: str) -> "InferenceProfile | None":
"""
Gets information about an inference profile. For more information, see `Increase throughput and resilience with cross-
region inference in Amazon Bedrock <https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html>`_.
in the Amazon Bedrock User Guide.
Args:
inferenceProfileArn: The ID or Amazon Resource Name (ARN) of the inference profile.
"""
args: dict[str, Any] = dict(
inferenceProfileIdentifier=self.serialize(inferenceProfileArn)
)
_response = self.client.get_inference_profile(
**{k: v for k, v in args.items() if v is not None}
)
response = InferenceProfile(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self, *, typeEquals: "Literal['SYSTEM_DEFINED', 'APPLICATION'] | None" = None
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of inference profiles that you can use. For more information, see `Increase throughput and resilience
with cross-region inference in Amazon Bedrock <https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-
inference.html>`_. in the Amazon Bedrock User Guide.
Keyword Args:
typeEquals: Filters for inference profiles that match the type you specify.
"""
paginator = self.client.get_paginator("list_inference_profiles")
args: dict[str, Any] = dict(typeEquals=self.serialize(typeEquals))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListInferenceProfilesResponse(**_response)
if response.inferenceProfileSummaries:
results.extend(response.inferenceProfileSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def delete(self, inferenceProfileArn: str) -> None:
"""
Deletes an application inference profile. For more information, see `Increase throughput and resilience with cross-
region inference in Amazon Bedrock <https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html>`_.
in the Amazon Bedrock User Guide.
Args:
inferenceProfileArn: The Amazon Resource Name (ARN) or ID of the application inference profile to delete.
"""
args: dict[str, Any] = dict(
inferenceProfileIdentifier=self.serialize(inferenceProfileArn)
)
self.client.delete_inference_profile(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class ModelCopyJobManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "ModelCopyJob",
modelKmsKeyId: "str | None" = None,
clientRequestToken: "str | None" = None,
) -> str:
"""
Copies a model to another region so that it can be used there. For more information, see `Copy models to be used in
other regions <https://docs.aws.amazon.com/bedrock/latest/userguide/copy-model.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
model: The :py:class:`ModelCopyJobSummary` to create.
Keyword Args:
modelKmsKeyId: The ARN of the KMS key that you use to encrypt the model copy.
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
sourceModelArn=data.get("sourceModelArn"),
targetModelName=data.get("targetModelName"),
modelKmsKeyId=self.serialize(modelKmsKeyId),
targetModelTags=data.get("targetModelTags"),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.create_model_copy_job(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateModelCopyJobResponse(**_response)
self.sessionize(response.jobArn)
return cast("str", response.jobArn)
[docs] def get(self, jobArn: str) -> "ModelCopyJob | None":
"""
Retrieves information about a model copy job. For more information, see `Copy models to be used in other
regions <https://docs.aws.amazon.com/bedrock/latest/userguide/copy-model.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
jobArn: The Amazon Resource Name (ARN) of the model copy job.
"""
args: dict[str, Any] = dict(jobArn=self.serialize(jobArn))
_response = self.client.get_model_copy_job(
**{k: v for k, v in args.items() if v is not None}
)
response = ModelCopyJob(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeAfter: "datetime | None" = None,
creationTimeBefore: "datetime | None" = None,
statusEquals: "Literal['InProgress', 'Completed', 'Failed'] | None" = None,
sourceAccountEquals: "str | None" = None,
sourceModelArnEquals: "str | None" = None,
targetModelNameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Returns a list of model copy jobs that you have submitted. You can filter the jobs to return based on one or more
criteria. For more information, see `Copy models to be used in other
regions <https://docs.aws.amazon.com/bedrock/latest/userguide/copy-model.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Keyword Args:
creationTimeAfter: Filters for model copy jobs created after the specified time.
creationTimeBefore: Filters for model copy jobs created before the specified time.
statusEquals: Filters for model copy jobs whose status matches the value that you specify.
sourceAccountEquals: Filters for model copy jobs in which the account that the source model belongs to is equal to
the value that you specify.
sourceModelArnEquals: Filters for model copy jobs in which the Amazon Resource Name (ARN) of the source model to is
equal to the value that you specify.
targetModelNameContains: Filters for model copy jobs in which the name of the copied model contains the string that
you specify.
sortBy: The field to sort by in the returned list of model copy jobs.
sortOrder: Specifies whether to sort the results in ascending or descending order.
"""
paginator = self.client.get_paginator("list_model_copy_jobs")
args: dict[str, Any] = dict(
creationTimeAfter=self.serialize(creationTimeAfter),
creationTimeBefore=self.serialize(creationTimeBefore),
statusEquals=self.serialize(statusEquals),
sourceAccountEquals=self.serialize(sourceAccountEquals),
sourceModelArnEquals=self.serialize(sourceModelArnEquals),
targetModelNameContains=self.serialize(targetModelNameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListModelCopyJobsResponse(**_response)
if response.modelCopyJobSummaries:
results.extend(response.modelCopyJobSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs]class ModelInvocationJobManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self, model: "ModelInvocationJob", tags: "builtins.list[Tag] | None" = None
) -> str:
"""
Creates a batch inference job to invoke a model on multiple prompts. Format your data according to `Format your
inference data <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-data>`_ and upload it to an Amazon S3
bucket. For more information, see `Process multiple prompts with batch
inference <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html>`_.
Args:
model: The :py:class:`ModelInvocationJobSummary` to create.
Keyword Args:
tags: Any tags to associate with the batch inference job. For more information, see `Tagging Amazon Bedrock
resources <https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html>`_.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
jobName=data.get("jobName"),
roleArn=data.get("roleArn"),
modelId=data.get("modelId"),
inputDataConfig=data.get("inputDataConfig"),
outputDataConfig=data.get("outputDataConfig"),
clientRequestToken=data.get("clientRequestToken"),
vpcConfig=data.get("vpcConfig"),
timeoutDurationInHours=data.get("timeoutDurationInHours"),
tags=self.serialize(tags),
modelInvocationType=data.get("modelInvocationType"),
)
_response = self.client.create_model_invocation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateModelInvocationJobResponse(**_response)
self.sessionize(response.jobArn)
return cast("str", response.jobArn)
[docs] def get(self, jobArn: str) -> "ModelInvocationJob | None":
"""
Gets details about a batch inference job. For more information, see `Monitor batch inference
jobs <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-monitor>`_
Args:
jobArn: The Amazon Resource Name (ARN) of the batch inference job.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.get_model_invocation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = ModelInvocationJob(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
submitTimeAfter: "datetime | None" = None,
submitTimeBefore: "datetime | None" = None,
statusEquals: "Literal['Submitted', 'InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped', 'PartiallyCompleted', 'Expired', 'Validating', 'Scheduled'] | None" = None,
nameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Lists all batch inference jobs in the account. For more information, see `View details about a batch inference
job <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-view.html>`_.
Keyword Args:
submitTimeAfter: Specify a time to filter for batch inference jobs that were submitted after the time you specify.
submitTimeBefore: Specify a time to filter for batch inference jobs that were submitted before the time you specify.
statusEquals: Specify a status to filter for batch inference jobs whose statuses match the string you specify.
nameContains: Specify a string to filter for batch inference jobs whose names contain the string.
sortBy: An attribute by which to sort the results.
sortOrder: Specifies whether to sort the results by ascending or descending order.
"""
paginator = self.client.get_paginator("list_model_invocation_jobs")
args: dict[str, Any] = dict(
submitTimeAfter=self.serialize(submitTimeAfter),
submitTimeBefore=self.serialize(submitTimeBefore),
statusEquals=self.serialize(statusEquals),
nameContains=self.serialize(nameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListModelInvocationJobsResponse(**_response)
if response.invocationJobSummaries:
results.extend(response.invocationJobSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def stop(self, jobArn: str) -> "StopModelInvocationJobResponse":
"""
Stops a batch inference job. You're only charged for tokens that were already processed. For more information, see `Stop
a batch inference job <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-stop.html>`_.
Args:
jobArn: The Amazon Resource Name (ARN) of the batch inference job to stop.
"""
args: dict[str, Any] = dict(jobIdentifier=self.serialize(jobArn))
_response = self.client.stop_model_invocation_job(
**{k: v for k, v in args.items() if v is not None}
)
response = StopModelInvocationJobResponse(**_response)
results: "StopModelInvocationJobResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("StopModelInvocationJobResponse", results)
[docs]class ModelInvocationLoggingConfigurationManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def get(
self,
) -> "ModelInvocationLoggingConfiguration | None":
"""
Get the current configuration values for model invocation logging.
"""
args: dict[str, Any] = dict()
_response = self.client.get_model_invocation_logging_configuration(
**{k: v for k, v in args.items() if v is not None}
)
response = GetModelInvocationLoggingConfigurationResponse(**_response)
if response and response.loggingConfig:
self.sessionize(response.loggingConfig)
return response.loggingConfig
return None
[docs] def put(
self, loggingConfig: "ModelInvocationLoggingConfiguration"
) -> "PutModelInvocationLoggingConfigurationResponse":
"""
Set the configuration values for model invocation logging.
Args:
loggingConfig: The logging configuration values to set.
"""
args: dict[str, Any] = dict(loggingConfig=self.serialize(loggingConfig))
_response = self.client.put_model_invocation_logging_configuration(
**{k: v for k, v in args.items() if v is not None}
)
response = PutModelInvocationLoggingConfigurationResponse(**_response)
results: "PutModelInvocationLoggingConfigurationResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("PutModelInvocationLoggingConfigurationResponse", results)
[docs] def delete(
self,
) -> None:
"""
Delete the invocation logging.
"""
args: dict[str, Any] = dict()
self.client.delete_model_invocation_logging_configuration(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class ResourcePolicyManager(ResourcePolicyManagerMixin, Boto3ModelManager):
service_name: str = "bedrock"
[docs] def put(self, resourceArn: str, resourcePolicy: str) -> str:
"""
Adds a resource policy for a Bedrock resource.
Args:
resourceArn: The ARN of the Bedrock resource to which this resource policy applies.
resourcePolicy: The JSON string representing the Bedrock resource policy.
"""
args: dict[str, Any] = dict(
resourceArn=self.serialize(resourceArn),
resourcePolicy=self.serialize(resourcePolicy),
)
_response = self.client.put_resource_policy(
**{k: v for k, v in args.items() if v is not None}
)
response = BedrockPutResourcePolicyResponse(**_response)
results: str = None
if response is not None:
results = response.resourceArn
self.sessionize(results)
return cast("str", results)
[docs] def delete(self, resourceArn: str) -> None:
"""
Deletes a previously created Bedrock resource policy.
Args:
resourceArn: The ARN of the Bedrock resource to which this resource policy applies.
"""
args: dict[str, Any] = dict(resourceArn=self.serialize(resourceArn))
self.client.delete_resource_policy(
**{k: v for k, v in args.items() if v is not None}
)
[docs]class MarketplaceModelEndpointManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "MarketplaceModelEndpoint",
endpointName: str,
acceptEula: "bool | None" = None,
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> "MarketplaceModelEndpoint":
"""
Creates an endpoint for a model from Amazon Bedrock Marketplace. The endpoint is
hosted by Amazon SageMaker.
Args:
model: The :py:class:`MarketplaceModelEndpoint` to create.
endpointName: The name of the endpoint. This name must be unique within your Amazon Web Services account and region.
Keyword Args:
acceptEula: Indicates whether you accept the end-user license agreement (EULA) for the model. Set to ``true`` to
accept the EULA.
clientRequestToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
This token is listed as not required because Amazon Web Services SDKs automatically generate it for you and set this
parameter. If you're not using the Amazon Web Services SDK or the CLI, you must provide this token or the action
will fail.
tags: An array of key-value pairs to apply to the underlying Amazon SageMaker endpoint. You can use these tags to
organize and identify your Amazon Web Services resources.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
modelSourceIdentifier=data.get("modelSourceIdentifier"),
endpointConfig=data.get("endpointConfig"),
endpointName=self.serialize(endpointName),
acceptEula=self.serialize(acceptEula),
clientRequestToken=self.serialize(clientRequestToken),
tags=self.serialize(tags),
)
_response = self.client.create_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateMarketplaceModelEndpointResponse(**_response)
self.sessionize(response.marketplaceModelEndpoint)
return cast("MarketplaceModelEndpoint", response.marketplaceModelEndpoint)
[docs] def get(self, endpointArn: str) -> "MarketplaceModelEndpoint | None":
"""
Retrieves details about a specific endpoint for a model from Amazon Bedrock
Marketplace.
Args:
endpointArn: The Amazon Resource Name (ARN) of the endpoint you want to get information about.
"""
args: dict[str, Any] = dict(endpointArn=self.serialize(endpointArn))
_response = self.client.get_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
response = GetMarketplaceModelEndpointResponse(**_response)
if response and response.marketplaceModelEndpoint:
self.sessionize(response.marketplaceModelEndpoint)
return response.marketplaceModelEndpoint
return None
[docs] def list(
self, *, modelSourceEquals: "str | None" = None
) -> PrimaryBoto3ModelQuerySet:
"""
Lists the endpoints for models from Amazon Bedrock Marketplace in your Amazon
Web Services account.
Keyword Args:
modelSourceEquals: If specified, only endpoints for the given model source identifier are returned.
"""
paginator = self.client.get_paginator("list_marketplace_model_endpoints")
args: dict[str, Any] = dict(modelSourceEquals=self.serialize(modelSourceEquals))
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListMarketplaceModelEndpointsResponse(**_response)
if response.marketplaceModelEndpoints:
results.extend(response.marketplaceModelEndpoints)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self, model: "MarketplaceModelEndpoint", clientRequestToken: "str | None" = None
) -> "MarketplaceModelEndpoint":
"""
Updates the configuration of an existing endpoint for a model from Amazon
Bedrock Marketplace.
Args:
model: The :py:class:`MarketplaceModelEndpoint` to update.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
This token is listed as not required because Amazon Web Services SDKs automatically generate it for you and set this
parameter. If you're not using the Amazon Web Services SDK or the CLI, you must provide this token or the action
will fail.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
endpointArn=data.get("endpointArn"),
endpointConfig=data.get("endpointConfig"),
clientRequestToken=self.serialize(clientRequestToken),
)
_response = self.client.update_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
response = UpdateMarketplaceModelEndpointResponse(**_response)
self.sessionize(response.marketplaceModelEndpoint)
return cast("MarketplaceModelEndpoint", response.marketplaceModelEndpoint)
[docs] def delete(self, endpointArn: str) -> None:
"""
Deletes an endpoint for a model from Amazon Bedrock Marketplace.
Args:
endpointArn: The Amazon Resource Name (ARN) of the endpoint you want to delete.
"""
args: dict[str, Any] = dict(endpointArn=self.serialize(endpointArn))
self.client.delete_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
[docs] def register(
self, endpointArn: str, modelSourceIdentifier: str
) -> "MarketplaceModelEndpoint":
"""
Registers an existing Amazon SageMaker endpoint with Amazon Bedrock Marketplace,
allowing it to be used with Amazon Bedrock APIs.
Args:
endpointArn: The ARN of the Amazon SageMaker endpoint you want to register with Amazon Bedrock Marketplace.
modelSourceIdentifier: The ARN of the model from Amazon Bedrock Marketplace that is deployed on the endpoint.
"""
args: dict[str, Any] = dict(
endpointIdentifier=self.serialize(endpointArn),
modelSourceIdentifier=self.serialize(modelSourceIdentifier),
)
_response = self.client.register_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
response = RegisterMarketplaceModelEndpointResponse(**_response)
results: "MarketplaceModelEndpoint" = None
if response is not None:
results = response.marketplaceModelEndpoint
self.sessionize(results)
return cast("MarketplaceModelEndpoint", results)
[docs] def deregister(
self, endpointArn: str
) -> "DeregisterMarketplaceModelEndpointResponse":
"""
Deregisters an endpoint for a model from Amazon Bedrock Marketplace. This
operation removes the endpoint's association with Amazon Bedrock but does not
delete the underlying Amazon SageMaker endpoint.
Args:
endpointArn: the value to set for endpointArn
"""
args: dict[str, Any] = dict(endpointArn=self.serialize(endpointArn))
_response = self.client.deregister_marketplace_model_endpoint(
**{k: v for k, v in args.items() if v is not None}
)
response = DeregisterMarketplaceModelEndpointResponse(**_response)
results: "DeregisterMarketplaceModelEndpointResponse" = None
if response is not None:
results = response
self.sessionize(results)
return cast("DeregisterMarketplaceModelEndpointResponse", results)
[docs]class ProvisionedModelThroughputManager(Boto3ModelManager):
service_name: str = "bedrock"
[docs] def create(
self,
model: "ProvisionedModelThroughput",
modelId: str,
clientRequestToken: "str | None" = None,
tags: "builtins.list[Tag] | None" = None,
) -> str:
"""
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 <http://aws.amazon.com/bedrock/pricing/>`_. For more information, see
`Provisioned Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in the `Amazon
Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
model: The :py:class:`ProvisionedModelSummary` to create.
modelId: The Amazon Resource Name (ARN) or name of the model to associate with this Provisioned Throughput. For a
list of models for which you can purchase Provisioned Throughput, see `Amazon Bedrock model IDs for purchasing
Provisioned Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#prov-throughput-
models>`_ in the `Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-
service.html>`_.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the API request completes no more than one
time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
For more information, see `Ensuring idempotency
<https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_ in the Amazon S3 User
Guide.
tags: Tags to associate with this Provisioned Throughput.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
modelUnits=data.get("modelUnits"),
provisionedModelName=data.get("provisionedModelName"),
modelId=self.serialize(modelId),
clientRequestToken=self.serialize(clientRequestToken),
commitmentDuration=data.get("commitmentDuration"),
tags=self.serialize(tags),
)
_response = self.client.create_provisioned_model_throughput(
**{k: v for k, v in args.items() if v is not None}
)
response = CreateProvisionedModelThroughputResponse(**_response)
self.sessionize(response.provisionedModelArn)
return cast("str", response.provisionedModelArn)
[docs] def get(self, provisionedModelArn: str) -> "ProvisionedModelThroughput | None":
"""
Returns details for a Provisioned Throughput. For more information, see `Provisioned
Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
provisionedModelArn: The Amazon Resource Name (ARN) or name of the Provisioned Throughput.
"""
args: dict[str, Any] = dict(
provisionedModelId=self.serialize(provisionedModelArn)
)
_response = self.client.get_provisioned_model_throughput(
**{k: v for k, v in args.items() if v is not None}
)
response = ProvisionedModelThroughput(**_response)
if response:
self.sessionize(response)
return response
return None
[docs] def list(
self,
*,
creationTimeAfter: "datetime | None" = None,
creationTimeBefore: "datetime | None" = None,
statusEquals: "Literal['Creating', 'InService', 'Updating', 'Failed'] | None" = None,
modelArnEquals: "str | None" = None,
nameContains: "str | None" = None,
sortBy: "Literal['CreationTime'] | None" = None,
sortOrder: "Literal['Ascending', 'Descending'] | None" = None,
) -> PrimaryBoto3ModelQuerySet:
"""
Lists the Provisioned Throughputs in the account. For more information, see `Provisioned
Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Keyword Args:
creationTimeAfter: A filter that returns Provisioned Throughputs created after the specified time.
creationTimeBefore: A filter that returns Provisioned Throughputs created before the specified time.
statusEquals: A filter that returns Provisioned Throughputs if their statuses matches the value that you specify.
modelArnEquals: A filter that returns Provisioned Throughputs whose model Amazon Resource Name (ARN) is equal to the
value that you specify.
nameContains: A filter that returns Provisioned Throughputs if their name contains the expression that you specify.
sortBy: The field by which to sort the returned list of Provisioned Throughputs.
sortOrder: The sort order of the results.
"""
paginator = self.client.get_paginator("list_provisioned_model_throughputs")
args: dict[str, Any] = dict(
creationTimeAfter=self.serialize(creationTimeAfter),
creationTimeBefore=self.serialize(creationTimeBefore),
statusEquals=self.serialize(statusEquals),
modelArnEquals=self.serialize(modelArnEquals),
nameContains=self.serialize(nameContains),
sortBy=self.serialize(sortBy),
sortOrder=self.serialize(sortOrder),
)
response_iterator = paginator.paginate(
**{k: v for k, v in args.items() if v is not None}
)
results = []
for _response in response_iterator:
if list(_response.keys()) == ["ResponseMetadata"]:
break
if "ResponseMetadata" in _response:
del _response["ResponseMetadata"]
response = ListProvisionedModelThroughputsResponse(**_response)
if response.provisionedModelSummaries:
results.extend(response.provisionedModelSummaries)
else:
if getattr(response, "NextToken", None):
continue
break
self.sessionize(results)
if results and isinstance(results[0], Boto3Model):
return PrimaryBoto3ModelQuerySet(results)
return results
[docs] def update(
self,
model: "ProvisionedModelThroughput",
desiredProvisionedModelName: "str | None" = None,
desiredModelId: "str | None" = None,
) -> None:
"""
Updates the name or associated model for a Provisioned Throughput. For more information, see `Provisioned
Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in the `Amazon Bedrock User
Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
model: The :py:class:`ProvisionedModelSummary` to update.
Keyword Args:
desiredProvisionedModelName: The new name for this Provisioned Throughput.
desiredModelId: The Amazon Resource Name (ARN) of the new model to associate with this Provisioned Throughput. You
can't specify this field if this Provisioned Throughput is associated with a base model.
"""
data = model.model_dump(exclude_none=True, by_alias=True)
args = dict(
provisionedModelId=data.get("provisionedModelArn"),
desiredProvisionedModelName=self.serialize(desiredProvisionedModelName),
desiredModelId=self.serialize(desiredModelId),
)
self.client.update_provisioned_model_throughput(
**{k: v for k, v in args.items() if v is not None}
)
[docs] def delete(self, provisionedModelArn: str) -> None:
"""
Deletes a Provisioned Throughput. You can't delete a Provisioned Throughput before the commitment term is over. For more
information, see `Provisioned Throughput <https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html>`_ in
the `Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html>`_.
Args:
provisionedModelArn: The Amazon Resource Name (ARN) or name of the Provisioned Throughput.
"""
args: dict[str, Any] = dict(
provisionedModelId=self.serialize(provisionedModelArn)
)
self.client.delete_provisioned_model_throughput(
**{k: v for k, v in args.items() if v is not None}
)
# ==============
# Service Models
# ==============
[docs]class FoundationModelLifecycle(Boto3Model):
"""
Details about whether a model version is available or deprecated.
"""
status: Literal["ACTIVE", "LEGACY"]
"""
Specifies whether a model version is available (``ACTIVE``) or deprecated
(``LEGACY``.
"""
startOfLifeTime: "datetime | None" = None
"""
Launch time when the model first becomes available.
"""
endOfLifeTime: "datetime | None" = None
"""
Time when the model is no longer available for use.
"""
legacyTime: "datetime | None" = None
"""
Time when the model enters legacy state.
Models in legacy state can still be used, but users should plan to transition to an
Active model before the end of life time
"""
publicExtendedAccessTime: "datetime | None" = None
"""
Public extended access portion of the legacy period, when users should expect higher
pricing.
"""
[docs]class FoundationModel(FoundationModelRuntimeMixin, ReadonlyPrimaryBoto3Model):
"""
Summary information for a foundation model.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = FoundationModelManager
inputModalities: "builtins.list[Literal['TEXT', 'IMAGE', 'EMBEDDING', 'VIDEO', 'SPEECH']] | None" = Field(
default_factory=list
)
"""
The input modalities that the model supports.
"""
outputModalities: "builtins.list[Literal['TEXT', 'IMAGE', 'EMBEDDING', 'VIDEO', 'SPEECH']] | None" = Field(
default_factory=list
)
"""
The output modalities that the model supports.
"""
customizationsSupported: "builtins.list[Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION']] | None" = Field(
default_factory=list
)
"""
Whether the model supports fine-tuning or continual pre-training.
"""
inferenceTypesSupported: "builtins.list[Literal['ON_DEMAND', 'PROVISIONED', 'INFERENCE_PROFILE']] | None" = Field(
default_factory=list
)
"""
The inference types that the model supports.
"""
modelArn: str
"""
The Amazon Resource Name (ARN) of the foundation model.
"""
modelId: str
"""
The model ID of the foundation model.
"""
modelName: "str | None" = None
"""
The name of the model.
"""
providerName: "str | None" = None
"""
The model's provider name.
"""
responseStreamingSupported: "bool | None" = None
"""
Indicates whether the model supports streaming.
"""
modelLifecycle: "FoundationModelLifecycle | None" = None
"""
Contains details about whether a model version is available or deprecated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`modelId` attribute.
Returns:
The primary key of the model instance.
"""
return self.modelId
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`modelArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.modelArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`modelName`
attribute.
Returns:
The name of the model instance.
"""
return self.modelName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`modelId` attribute.
"""
return hash(self.modelId)
[docs]class FoundationModelAgreement(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = FoundationModelAgreementManager
modelId: str
"""
Foundation model identifier for agreement lifecycle calls.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`modelId` attribute.
Returns:
The primary key of the model instance.
"""
return self.modelId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`modelId`
attribute.
Returns:
The name of the model instance.
"""
return self.modelId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`modelId` attribute.
"""
return hash(self.modelId)
[docs]class CustomModel(PrimaryBoto3Model):
"""
Summary information for a custom model.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = CustomModelManager
baseModelName: str | None = None
"""
Base model name when available from list responses.
"""
ownerAccountId: str | None = None
"""
Owning AWS account ID when available from list responses.
"""
modelArn: str
"""
The Amazon Resource Name (ARN) of the custom model.
"""
modelName: str
"""
The name of the custom model.
"""
creationTime: datetime
"""
Creation time of the model.
"""
baseModelArn: str
"""
The base model Amazon Resource Name (ARN).
"""
customizationType: "Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION', 'REINFORCEMENT_FINE_TUNING', 'IMPORTED'] | None" = None
"""
Specifies whether to carry out continued pre-training of a model or whether to fine-
tune it.
For more information, see
`Custom models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_.
"""
modelStatus: "Literal['Active', 'Creating', 'Failed'] | None" = None
"""
The current status of the custom model.
Possible values include:
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`modelArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.modelArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`modelArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.modelArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`modelName`
attribute.
Returns:
The name of the model instance.
"""
return self.modelName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`modelArn` attribute.
"""
return hash(self.modelArn)
@cached_property
def base_model(self) -> "FoundationModel | None":
"""
Return the foundation model that this custom model was derived from, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"modelId": self.baseModelArn,
}
)
except AttributeError:
return None
return FoundationModel.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ImportedModel(PrimaryBoto3Model):
"""
Information about the imported model.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ImportedModelManager
modelArn: str
"""
The Amazon Resource Name (ARN) of the imported model.
"""
modelName: str
"""
Name of the imported model.
"""
creationTime: datetime
"""
Creation time of the imported model.
"""
instructSupported: "bool | None" = None
"""
Specifies if the imported model supports converse.
"""
modelArchitecture: "str | None" = None
"""
The architecture of the imported model.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`modelArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.modelArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`modelArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.modelArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`modelName`
attribute.
Returns:
The name of the model instance.
"""
return self.modelName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`modelArn` attribute.
"""
return hash(self.modelArn)
[docs]class GuardrailTopicsTier(Boto3Model):
"""
The tier that your guardrail uses for denied topic filters.
"""
tierName: Literal["CLASSIC", "STANDARD"]
"""
The tier that your guardrail uses for denied topic filters.
Valid values include:
"""
[docs]class GuardrailTopicPolicy(Boto3Model):
"""
Contains details about topics that the guardrail should identify and deny.
This data type is used in the following API operations:
* `GetGuardrail response
body <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetGuardrail.html#API_GetGuardrail_ResponseSyntax>`_
"""
topics: "builtins.list[GuardrailTopic]"
"""
A list of policies related to topics that the guardrail should deny.
"""
tier: "GuardrailTopicsTier | None" = None
"""
The tier that your guardrail uses for denied topic filters.
"""
[docs]class GuardrailContentFiltersTier(Boto3Model):
"""
The tier that your guardrail uses for content filters.
"""
tierName: Literal["CLASSIC", "STANDARD"]
"""
The tier that your guardrail uses for content filters.
Valid values include:
"""
[docs]class GuardrailContentPolicy(Boto3Model):
"""
Contains details about how to handle harmful content.
This data type is used in the following API operations:
* `GetGuardrail response
body <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetGuardrail.html#API_GetGuardrail_ResponseSyntax>`_
"""
filters: "builtins.list[GuardrailContentFilter] | None" = Field(
default_factory=list
)
"""
Contains the type of the content filter and how strongly it should apply to prompts
and model responses.
"""
tier: "GuardrailContentFiltersTier | None" = None
"""
The tier that your guardrail uses for content filters.
"""
[docs]class GuardrailWord(Boto3Model):
"""
A word configured for the guardrail.
"""
text: str
"""
Text of the word configured for the guardrail to block.
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailManagedWords(Boto3Model):
"""
The managed word list that was configured for the guardrail.
(This is a list of words that are pre-defined and managed by guardrails only.)
"""
type: Literal["PROFANITY"]
"""
ManagedWords$type The managed word type that was configured for the guardrail.
(For now, we only offer profanity word list)
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailWordPolicy(Boto3Model):
"""
Contains details about the word policy configured for the guardrail.
"""
words: "builtins.list[GuardrailWord] | None" = Field(default_factory=list)
"""
A list of words configured for the guardrail.
"""
managedWordLists: "builtins.list[GuardrailManagedWords] | None" = Field(
default_factory=list
)
"""
A list of managed words configured for the guardrail.
"""
[docs]class GuardrailPiiEntity(Boto3Model):
"""
The PII entity configured for the guardrail.
"""
type: Literal[
"ADDRESS",
"AGE",
"AWS_ACCESS_KEY",
"AWS_SECRET_KEY",
"CA_HEALTH_NUMBER",
"CA_SOCIAL_INSURANCE_NUMBER",
"CREDIT_DEBIT_CARD_CVV",
"CREDIT_DEBIT_CARD_EXPIRY",
"CREDIT_DEBIT_CARD_NUMBER",
"DRIVER_ID",
"EMAIL",
"INTERNATIONAL_BANK_ACCOUNT_NUMBER",
"IP_ADDRESS",
"LICENSE_PLATE",
"MAC_ADDRESS",
"NAME",
"PASSWORD",
"PHONE",
"PIN",
"SWIFT_CODE",
"UK_NATIONAL_HEALTH_SERVICE_NUMBER",
"UK_NATIONAL_INSURANCE_NUMBER",
"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
"URL",
"USERNAME",
"US_BANK_ACCOUNT_NUMBER",
"US_BANK_ROUTING_NUMBER",
"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
"US_PASSPORT_NUMBER",
"US_SOCIAL_SECURITY_NUMBER",
"VEHICLE_IDENTIFICATION_NUMBER",
]
"""
The type of PII entity.
For example, Social Security Number.
"""
action: Literal["BLOCK", "ANONYMIZE", "NONE"]
"""
The configured guardrail action when PII entity is detected.
"""
inputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailRegex(Boto3Model):
"""
The regular expression configured for the guardrail.
"""
name: str
"""
The name of the regular expression for the guardrail.
"""
description: "str | None" = None
"""
The description of the regular expression for the guardrail.
"""
pattern: str
"""
The pattern of the regular expression configured for the guardrail.
"""
action: Literal["BLOCK", "ANONYMIZE", "NONE"]
"""
The action taken when a match to the regular expression is detected.
"""
inputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
The action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Indicates whether guardrail evaluation is enabled on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailContextualGroundingPolicy(Boto3Model):
"""
The details for the guardrails contextual grounding policy.
"""
filters: "builtins.list[GuardrailContextualGroundingFilter]"
"""
The filter details for the guardrails contextual grounding policy.
"""
[docs]class GuardrailAutomatedReasoningPolicy(Boto3Model):
"""
Represents the configuration of Automated Reasoning policies within a Amazon Bedrock
Guardrail, including the policies to apply and confidence thresholds.
"""
policies: "builtins.list[str]"
"""
The list of Automated Reasoning policy ARNs that should be applied as part of this
guardrail configuration.
"""
confidenceThreshold: "float | None" = None
"""
The minimum confidence level required for Automated Reasoning policy violations to
trigger guardrail actions.
Values range from 0.0 to 1.0.
"""
[docs]class GuardrailCrossRegionDetails(Boto3Model):
"""
Contains details about the system-defined guardrail profile that you're using with
your guardrail for cross-Region inference.
For more information, see the
`Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html>`_.
"""
guardrailProfileId: "str | None" = None
"""
The ID of the guardrail profile that your guardrail is using.
Profile availability depends on your current Amazon Web Services Region. For more
information, see the
`Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region-support.html>`_.
"""
guardrailProfileArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the guardrail profile that you're using with your
guardrail.
"""
[docs]class Guardrail(GuardrailRuntimeMixin, PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = GuardrailManager
guardrailName: str = Field(default=None, alias="name")
"""
The name of the guardrail.
"""
blockedInputMessaging: "str | None" = None
"""
The message that the guardrail returns when it blocks a prompt.
"""
blockedOutputsMessaging: "str | None" = None
"""
The message that the guardrail returns when it blocks a model response.
"""
description: "str | None" = None
"""
The description of the guardrail.
"""
guardrailId: str
"""
The unique identifier of the guardrail.
"""
guardrailArn: str
"""
The ARN of the guardrail.
"""
version: str
"""
The version of the guardrail.
"""
status: Literal["CREATING", "UPDATING", "VERSIONING", "READY", "FAILED", "DELETING"]
"""
The status of the guardrail.
"""
topicPolicy: "GuardrailTopicPolicy | None" = None
"""
The topic policy that was configured for the guardrail.
"""
contentPolicy: "GuardrailContentPolicy | None" = None
"""
The content policy that was configured for the guardrail.
"""
wordPolicy: "GuardrailWordPolicy | None" = None
"""
The word policy that was configured for the guardrail.
"""
sensitiveInformationPolicy: "GuardrailSensitiveInformationPolicy | None" = None
"""
The sensitive information policy that was configured for the guardrail.
"""
contextualGroundingPolicy: "GuardrailContextualGroundingPolicy | None" = None
"""
The contextual grounding policy used in the guardrail.
"""
automatedReasoningPolicy: "GuardrailAutomatedReasoningPolicy | None" = None
"""
The current Automated Reasoning policy configuration for the guardrail, if any is
configured.
"""
crossRegionDetails: "GuardrailCrossRegionDetails | None" = None
"""
Details about the system-defined guardrail profile that you're using with your
guardrail, including the guardrail profile ID and Amazon Resource Name (ARN).
"""
createdAt: datetime
"""
The date and time at which the guardrail was created.
"""
updatedAt: datetime
"""
The date and time at which the guardrail was updated.
"""
statusReasons: "builtins.list[str] | None" = Field(default_factory=list)
"""
Appears if the ``status`` is ``FAILED``.
A list of reasons for why the guardrail failed to be created, updated, versioned, or
deleted.
"""
failureRecommendations: "builtins.list[str] | None" = Field(default_factory=list)
"""
Appears if the ``status`` of the guardrail is ``FAILED``.
A list of recommendations to carry out before retrying the request.
"""
kmsKeyArn: "str | None" = None
"""
The ARN of the KMS key that encrypts the guardrail.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`guardrailId` attribute.
Returns:
The primary key of the model instance.
"""
return self.guardrailId
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`guardrailArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.guardrailArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`guardrailName` attribute.
Returns:
The name of the model instance.
"""
return self.guardrailName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`guardrailId` attribute.
"""
return hash(self.guardrailId)
@cached_property
def kms_key(self) -> "KMSKey | None":
"""
Return the KMS key that encrypts this guardrail, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"KeyId": self.kmsKeyArn,
}
)
except AttributeError:
return None
return KMSKey.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs] def create_version(self, description: str | None = None) -> "str":
"""
Create a version of this guardrail.
Keyword Args:
description: A description of the guardrail version.
"""
return (
cast("GuardrailManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.create_version(cast("str", self.guardrailId), description=description)
)
[docs]class AutomatedReasoningPolicyDefinitionTypeValue(Boto3Model):
"""
Represents a single value within a custom type definition, including its identifier
and description.
"""
value: str
"""
The actual value or identifier for this type value.
"""
description: "str | None" = None
"""
A human-readable description explaining what this type value represents and when it
should be used.
"""
[docs]class AutomatedReasoningPolicyDefinitionType(Boto3Model):
"""
Represents a custom user-defined viarble type in an Automated Reasoning policy.
Types are enum-based and provide additional context beyond predefined variable
types.
"""
name: str
"""
The name of the custom type.
"""
description: "str | None" = None
"""
The description of what the custom type represents.
"""
values: "builtins.list[AutomatedReasoningPolicyDefinitionTypeValue]"
"""
The possible values for this enum-based type, each with its own description.
"""
[docs]class AutomatedReasoningPolicyDefinitionRule(Boto3Model):
"""
Represents a formal logic rule in an Automated Reasoning policy.
For example, rules can be expressed as if-then statements that define logical
constraints.
"""
id: str
"""
The unique identifier of the rule within the policy.
"""
expression: str
"""
The formal logic expression of the rule.
"""
alternateExpression: "str | None" = None
"""
The human-readable form of the rule expression, often in natural language or
simplified notation.
"""
[docs]class AutomatedReasoningPolicyDefinitionVariable(Boto3Model):
"""
Represents a variable in an Automated Reasoning policy.
Variables represent concepts that can have values assigned during natural language
translation.
"""
name: str
"""
The name of the variable.
Use descriptive names that clearly indicate the concept being represented.
"""
type: str
"""
The data type of the variable.
Valid types include bool, int, real, enum, and custom types that you can provide.
"""
description: str
"""
The description of the variable that explains what it represents and how users might
refer to it.
Clear and comprehensive descriptions are essential for accurate natural language
translation.
"""
[docs]class AutomatedReasoningPolicyDefinition(Boto3Model):
"""
Contains the formal logic rules, variables, and custom variable types that define an
Automated Reasoning policy.
The policy definition specifies the constraints used to validate foundation model
responses for accuracy and logical consistency.
"""
version: "str | None" = None
"""
The version of the policy definition format.
"""
types: "builtins.list[AutomatedReasoningPolicyDefinitionType] | None" = Field(
default_factory=list
)
"""
The custom user-defined vairable types used in the policy.
Types are enum-based variable types that provide additional context beyond the
predefined variable types.
"""
rules: "builtins.list[AutomatedReasoningPolicyDefinitionRule] | None" = Field(
default_factory=list
)
"""
The formal logic rules extracted from the source document.
Rules define the logical constraints that determine whether model responses are
valid, invalid, or satisfiable.
"""
variables: "builtins.list[AutomatedReasoningPolicyDefinitionVariable] | None" = (
Field(default_factory=list)
)
"""
The variables that represent concepts in the policy.
Variables can have values assigned when translating natural language into formal
logic. Their descriptions are crucial for accurate translation.
"""
[docs]class AutomatedReasoningPolicyBuildWorkflowDocument(Boto3Model):
"""
Represents a source document used in the policy build workflow, containing the
content and metadata needed for policy generation.
"""
document: bytes
"""
The actual content of the source document that will be analyzed to extract policy
rules and concepts.
"""
documentContentType: Literal["pdf", "txt"]
"""
The MIME type of the document content (e.g., text/plain, application/pdf,
text/markdown).
"""
documentName: str
"""
A descriptive name for the document that helps identify its purpose and content.
"""
documentDescription: "str | None" = None
"""
A detailed description of the document's content and how it should be used in the
policy generation process.
"""
[docs]class AutomatedReasoningPolicyAddTypeAnnotation(Boto3Model):
"""
An annotation for adding a new custom type to an Automated Reasoning policy,
defining a set of possible values for variables.
"""
name: str
"""
The name of the new custom type.
This name will be used to reference the type in variable definitions and rules.
"""
description: str
"""
A description of what the custom type represents and how it should be used in the
policy.
"""
values: "builtins.list[AutomatedReasoningPolicyDefinitionTypeValue]"
"""
The list of possible values that variables of this type can take, each with its own
description and identifier.
"""
[docs]class AutomatedReasoningPolicyAddTypeValue(Boto3Model):
"""
Represents a single value that can be added to an existing custom type in the
policy.
"""
value: str
"""
The identifier or name of the new value to add to the type.
"""
description: "str | None" = None
"""
A description of what this new type value represents and when it should be used.
"""
[docs]class AutomatedReasoningPolicyUpdateTypeValue(Boto3Model):
"""
Represents a modification to a value within an existing custom type.
"""
value: str
"""
The current identifier or name of the type value to update.
"""
newValue: "str | None" = None
"""
The new identifier or name for the type value, if you want to rename it.
"""
description: "str | None" = None
"""
The new description for the type value, replacing the previous description.
"""
[docs]class AutomatedReasoningPolicyDeleteTypeValue(Boto3Model):
"""
Represents a value to be removed from an existing custom type in the policy.
"""
value: str
"""
The identifier or name of the value to remove from the type.
"""
[docs]class AutomatedReasoningPolicyTypeValueAnnotation(Boto3Model):
"""
An annotation for managing values within custom types, including adding, updating,
or removing specific type values.
"""
addTypeValue: "AutomatedReasoningPolicyAddTypeValue | None" = None
"""
An operation to add a new value to an existing custom type.
"""
updateTypeValue: "AutomatedReasoningPolicyUpdateTypeValue | None" = None
"""
An operation to modify an existing value within a custom type.
"""
deleteTypeValue: "AutomatedReasoningPolicyDeleteTypeValue | None" = None
"""
An operation to remove a value from an existing custom type.
"""
[docs]class AutomatedReasoningPolicyUpdateTypeAnnotation(Boto3Model):
"""
An annotation for modifying an existing custom type in an Automated Reasoning
policy.
"""
name: str
"""
The current name of the custom type to update.
"""
newName: "str | None" = None
"""
The new name for the custom type, if you want to rename it.
If not provided, the name remains unchanged.
"""
description: "str | None" = None
"""
The new description for the custom type, replacing the previous description.
"""
values: "builtins.list[AutomatedReasoningPolicyTypeValueAnnotation]"
"""
The updated list of values for the custom type, which can include additions,
modifications, or removals.
"""
[docs]class AutomatedReasoningPolicyDeleteTypeAnnotation(Boto3Model):
"""
An annotation for removing a custom type from an Automated Reasoning policy.
"""
name: str
"""
The name of the custom type to delete from the policy.
The type must not be referenced by any variables or rules.
"""
[docs]class AutomatedReasoningPolicyAddVariableAnnotation(Boto3Model):
"""
An annotation for adding a new variable to an Automated Reasoning policy, which can
be used in rule expressions.
"""
name: str
"""
The name of the new variable.
This name will be used to reference the variable in rule expressions.
"""
type: str
"""
The type of the variable, which can be a built-in type (like string or number) or a
custom type defined in the policy.
"""
description: str
"""
A description of what the variable represents and how it should be used in rules.
"""
[docs]class AutomatedReasoningPolicyUpdateVariableAnnotation(Boto3Model):
"""
An annotation for modifying an existing variable in an Automated Reasoning policy.
"""
name: str
"""
The current name of the variable to update.
"""
newName: "str | None" = None
"""
The new name for the variable, if you want to rename it.
If not provided, the name remains unchanged.
"""
description: "str | None" = None
"""
The new description for the variable, replacing the previous description.
"""
[docs]class AutomatedReasoningPolicyDeleteVariableAnnotation(Boto3Model):
"""
An annotation for removing a variable from an Automated Reasoning policy.
"""
name: str
"""
The name of the variable to delete from the policy.
The variable must not be referenced by any rules.
"""
[docs]class AutomatedReasoningPolicyAddRuleAnnotation(Boto3Model):
"""
An annotation for adding a new rule to an Automated Reasoning policy using a formal
logical expression.
"""
expression: str
"""
The formal logical expression that defines the rule, using mathematical notation and
referencing policy variables and types.
"""
[docs]class AutomatedReasoningPolicyUpdateRuleAnnotation(Boto3Model):
"""
An annotation for modifying an existing rule in an Automated Reasoning policy.
"""
ruleId: str
"""
The unique identifier of the rule to update.
"""
expression: str
"""
The new formal logical expression for the rule, replacing the previous expression.
"""
[docs]class AutomatedReasoningPolicyDeleteRuleAnnotation(Boto3Model):
"""
An annotation for removing a rule from an Automated Reasoning policy.
"""
ruleId: str
"""
The unique identifier of the rule to delete from the policy.
"""
[docs]class AutomatedReasoningPolicyAddRuleFromNaturalLanguageAnnotation(Boto3Model):
"""
An annotation for adding a new rule to the policy by converting a natural language
description into a formal logical expression.
"""
naturalLanguage: str
"""
The natural language description of the rule that should be converted into a formal
logical expression.
"""
[docs]class AutomatedReasoningPolicyUpdateFromRuleFeedbackAnnotation(Boto3Model):
"""
An annotation for updating the policy based on feedback about how specific rules
performed during testing or real-world usage.
"""
ruleIds: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of rule identifiers that the feedback applies to.
"""
feedback: str
"""
The feedback information about rule performance, including suggestions for
improvements or corrections.
"""
[docs]class AutomatedReasoningPolicyUpdateFromScenarioFeedbackAnnotation(Boto3Model):
"""
An annotation for updating the policy based on feedback about how it performed on
specific test scenarios.
"""
ruleIds: "builtins.list[str] | None" = Field(default_factory=list)
"""
The list of rule identifiers that were involved in the scenario being evaluated.
"""
scenarioExpression: str
"""
The logical expression that defines the test scenario that generated this feedback.
"""
feedback: "str | None" = None
"""
The feedback information about scenario performance, including any issues or
improvements identified.
"""
[docs]class AutomatedReasoningPolicyIngestContentAnnotation(Boto3Model):
"""
An annotation for processing and incorporating new content into an Automated
Reasoning policy.
"""
content: str
"""
The new content to be analyzed and incorporated into the policy, such as additional
documents or rule descriptions.
"""
[docs]class AutomatedReasoningPolicyAnnotation(Boto3Model):
"""
Contains the various operations that can be performed on an Automated Reasoning
policy, including adding, updating, and deleting rules, variables, and types.
"""
addType: "AutomatedReasoningPolicyAddTypeAnnotation | None" = None
"""
An operation to add a new custom type to the policy, defining a set of possible
values for policy variables.
"""
updateType: "AutomatedReasoningPolicyUpdateTypeAnnotation | None" = None
"""
An operation to modify an existing custom type in the policy, such as changing its
name, description, or allowed values.
"""
deleteType: "AutomatedReasoningPolicyDeleteTypeAnnotation | None" = None
"""
An operation to remove a custom type from the policy.
The type must not be referenced by any variables or rules.
"""
addVariable: "AutomatedReasoningPolicyAddVariableAnnotation | None" = None
"""
An operation to add a new variable to the policy, which can be used in rule
expressions to represent dynamic values.
"""
updateVariable: "AutomatedReasoningPolicyUpdateVariableAnnotation | None" = None
"""
An operation to modify an existing variable in the policy, such as changing its
name, type, or description.
"""
deleteVariable: "AutomatedReasoningPolicyDeleteVariableAnnotation | None" = None
"""
An operation to remove a variable from the policy.
The variable must not be referenced by any rules.
"""
addRule: "AutomatedReasoningPolicyAddRuleAnnotation | None" = None
"""
An operation to add a new logical rule to the policy using formal mathematical
expressions.
"""
updateRule: "AutomatedReasoningPolicyUpdateRuleAnnotation | None" = None
"""
An operation to modify an existing rule in the policy, such as changing its logical
expression or conditions.
"""
deleteRule: "AutomatedReasoningPolicyDeleteRuleAnnotation | None" = None
"""
An operation to remove a rule from the policy.
"""
addRuleFromNaturalLanguage: "AutomatedReasoningPolicyAddRuleFromNaturalLanguageAnnotation | None" = None
"""
An operation to add a new rule by converting natural language descriptions into
formal logical expressions.
"""
updateFromRulesFeedback: "AutomatedReasoningPolicyUpdateFromRuleFeedbackAnnotation | None" = None
"""
An operation to update the policy based on feedback about how specific rules
performed during testing or validation.
"""
updateFromScenarioFeedback: "AutomatedReasoningPolicyUpdateFromScenarioFeedbackAnnotation | None" = None
"""
An operation to update the policy based on feedback about how it performed on
specific test scenarios.
"""
ingestContent: "AutomatedReasoningPolicyIngestContentAnnotation | None" = None
"""
An operation to process and incorporate new content into the policy, extracting
additional rules and concepts.
"""
[docs]class AutomatedReasoningPolicyBuildWorkflowRepairContent(Boto3Model):
"""
Contains content and instructions for repairing or improving an existing Automated
Reasoning policy.
"""
annotations: "builtins.list[AutomatedReasoningPolicyAnnotation]"
"""
Specific annotations or modifications to apply during the policy repair process,
such as rule corrections or variable updates.
"""
[docs]class AutomatedReasoningPolicyGenerateFidelityReportContent(Boto3Model):
"""
Configuration for generating a fidelity report, which can either analyze new
documents or update an existing fidelity report with a new policy definition.
"""
documents: "builtins.list[AutomatedReasoningPolicyBuildWorkflowDocument] | None" = (
Field(default_factory=list)
)
"""
Source documents to analyze for generating a new fidelity report.
The documents will be processed to create atomic statements and grounding
information.
"""
[docs]class AutomatedReasoningPolicyWorkflowTypeContent(Boto3Model):
"""
Defines the content and configuration for different types of policy build workflows.
"""
documents: "builtins.list[AutomatedReasoningPolicyBuildWorkflowDocument] | None" = (
Field(default_factory=list)
)
"""
The list of documents to be processed in a document ingestion workflow.
"""
policyRepairAssets: "AutomatedReasoningPolicyBuildWorkflowRepairContent | None" = (
None
)
"""
The assets and instructions needed for a policy repair workflow, including repair
annotations and guidance.
"""
generateFidelityReportContent: "AutomatedReasoningPolicyGenerateFidelityReportContent | None" = None
"""
The content configuration for generating a fidelity report workflow.
This can include source documents to analyze or an existing fidelity report to
update with a new policy definition.
"""
[docs]class AutomatedReasoningPolicyBuildWorkflowSource(Boto3Model):
"""
Defines the source content for a policy build workflow, which can include documents,
repair instructions, or other input materials.
"""
policyDefinition: "AutomatedReasoningPolicyDefinition | None" = None
"""
An existing policy definition that serves as the starting point for the build
workflow, typically used in policy repair or update scenarios.
"""
workflowContent: "AutomatedReasoningPolicyWorkflowTypeContent | None" = None
"""
The actual content to be processed in the build workflow, such as documents to
analyze or repair instructions to apply.
"""
[docs]class AutomatedReasoningPolicy(AutomatedReasoningPolicyModelMixin, PrimaryBoto3Model):
"""
Contains summary information about an Automated Reasoning policy, including metadata
and timestamps.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = AutomatedReasoningPolicyManager
policyName: str = Field(default=None, alias="name")
"""
The name of the policy.
"""
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy.
"""
description: "str | None" = None
"""
The description of the policy.
"""
version: str
"""
The version of the policy.
"""
policyId: str
"""
The unique identifier of the policy.
"""
createdAt: datetime
"""
The timestamp when the policy was created.
"""
updatedAt: datetime
"""
The timestamp when the policy was last updated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`policyArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.policyArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`policyArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.policyArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`policyName`
attribute.
Returns:
The name of the model instance.
"""
return self.policyName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`policyArn` attribute.
"""
return hash(self.policyArn)
@cached_property
def build_workflows(self) -> "list[AutomatedReasoningPolicyBuildWorkflow] | None":
"""
Return the automated reasoning build workflows for this policy.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
}
)
except AttributeError:
return []
return AutomatedReasoningPolicyBuildWorkflow.objects.using(self.session).list(
**pk
) # type: ignore[arg-type]
@cached_property
def test_cases(self) -> "list[AutomatedReasoningPolicyTestCase] | None":
"""
Return the automated reasoning test cases for this policy.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
}
)
except AttributeError:
return []
return AutomatedReasoningPolicyTestCase.objects.using(self.session).list(**pk) # type: ignore[arg-type]
[docs] def create_version(self, lastUpdatedDefinitionHash: str) -> "str":
"""
Create a version of this automated reasoning policy.
Args:
lastUpdatedDefinitionHash: The hash of the current policy definition used as a concurrency token to ensure the
policy hasn't been modified since you last retrieved it.
"""
return (
cast("AutomatedReasoningPolicyManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.create_version(
cast("str", self.policyArn),
lastUpdatedDefinitionHash,
)
)
[docs] def export_version(self) -> "AutomatedReasoningPolicyDefinition":
"""
Export this automated reasoning policy version.
"""
return (
cast("AutomatedReasoningPolicyManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.export_version(
cast("str", self.policyArn),
)
)
[docs] def start_build_workflow(
self,
buildWorkflowType: str,
sourceContent: "AutomatedReasoningPolicyBuildWorkflowSource",
clientRequestToken: str | None = None,
) -> "str":
"""
Start a build workflow for this automated reasoning policy.
Args:
buildWorkflowType: The type of build workflow to start (e.g., DOCUMENT_INGESTION for processing new documents,
POLICY_REPAIR for fixing existing policies).
sourceContent: The source content for the build workflow, such as documents to analyze or repair instructions for
existing policies.
Keyword Args:
clientRequestToken: A unique, case-sensitive identifier to ensure that the operation completes no more than once. If
this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.
"""
return (
cast("AutomatedReasoningPolicyManager", self.objects) # type: ignore[attr-defined]
.using(self.session)
.start_build_workflow(
cast("str", self.policyArn),
buildWorkflowType,
sourceContent,
clientRequestToken=clientRequestToken,
)
)
[docs]class AutomatedReasoningPolicyBuildWorkflow(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyBuildWorkflowManager
)
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
buildWorkflowId: str
"""
The unique identifier of the build workflow.
"""
status: Literal[
"SCHEDULED",
"CANCEL_REQUESTED",
"PREPROCESSING",
"BUILDING",
"TESTING",
"COMPLETED",
"FAILED",
"CANCELLED",
]
"""
The current status of the build workflow (e.g., RUNNING, COMPLETED, FAILED,
CANCELLED).
"""
buildWorkflowType: Literal[
"INGEST_CONTENT",
"REFINE_POLICY",
"IMPORT_POLICY",
"GENERATE_FIDELITY_REPORT",
"GENERATE_POLICY_SCENARIOS",
]
"""
The type of build workflow being executed (e.g., DOCUMENT_INGESTION, POLICY_REPAIR).
"""
documentName: "str | None" = None
"""
The name of the source document used in the build workflow.
"""
documentContentType: "Literal['pdf', 'txt'] | None" = None
"""
The content type of the source document (e.g., text/plain, application/pdf).
"""
documentDescription: "str | None" = None
"""
A detailed description of the document's content and how it should be used in the
policy generation process.
"""
createdAt: datetime
"""
The timestamp when the build workflow was created.
"""
updatedAt: datetime
"""
The timestamp when the build workflow was last updated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`buildWorkflowId` attribute.
Returns:
The primary key of the model instance.
"""
return self.buildWorkflowId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`buildWorkflowId` attribute.
Returns:
The name of the model instance.
"""
return self.buildWorkflowId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`buildWorkflowId` attribute.
"""
return hash(self.buildWorkflowId)
@cached_property
def policy(self) -> "AutomatedReasoningPolicy | None":
"""
Return the automated reasoning policy that owns this build workflow, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
}
)
except AttributeError:
return None
return AutomatedReasoningPolicy.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class AutomatedReasoningPolicyTestCase(PrimaryBoto3Model):
"""
Represents a test for validating an Automated Reasoning policy.
tests contain sample inputs and expected outcomes to verify policy behavior.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyTestCaseManager
)
testCaseId: str
"""
The unique identifier of the test.
"""
guardContent: str
"""
The output content to be validated by the policy, typically representing a
foundation model response.
"""
queryContent: "str | None" = None
"""
The input query or prompt that generated the content.
This provides context for the validation.
"""
expectedAggregatedFindingsResult: "Literal['VALID', 'INVALID', 'SATISFIABLE', 'IMPOSSIBLE', 'TRANSLATION_AMBIGUOUS', 'TOO_COMPLEX', 'NO_TRANSLATION'] | None" = None
"""
The expected result of the Automated Reasoning check for this test.
"""
createdAt: datetime = Field(frozen=True)
"""
The timestamp when the test was created.
"""
updatedAt: datetime = Field(frozen=True)
"""
The timestamp when the test was last updated.
"""
confidenceThreshold: "float | None" = None
"""
The minimum confidence level for logic validation.
Content meeting this threshold is considered high-confidence and can be validated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`testCaseId` attribute.
Returns:
The primary key of the model instance.
"""
return self.testCaseId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`testCaseId`
attribute.
Returns:
The name of the model instance.
"""
return self.testCaseId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`testCaseId` attribute.
"""
return hash(self.testCaseId)
[docs]class AutomatedReasoningLogicStatement(Boto3Model):
"""
Represents a logical statement that can be expressed both in formal logic notation
and natural language, providing dual representations for better understanding and
validation.
"""
logic: str
"""
The formal logic representation of the statement using mathematical notation and
logical operators.
"""
naturalLanguage: "str | None" = None
"""
The natural language representation of the logical statement, providing a human-
readable interpretation of the formal logic.
"""
[docs]class AutomatedReasoningCheckInputTextReference(Boto3Model):
"""
References a portion of the original input text that corresponds to logical
elements.
"""
text: "str | None" = None
"""
The specific text from the original input that this reference points to.
"""
[docs]class AutomatedReasoningCheckTranslation(Boto3Model):
"""
Contains the logical translation of natural language input into formal logical
statements, including premises, claims, and confidence scores.
"""
premises: "builtins.list[AutomatedReasoningLogicStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that serve as the foundation or assumptions for the claims.
"""
claims: "builtins.list[AutomatedReasoningLogicStatement]"
"""
The logical statements that are being validated against the premises and policy
rules.
"""
untranslatedPremises: "builtins.list[AutomatedReasoningCheckInputTextReference] | None" = Field(
default_factory=list
)
"""
References to portions of the original input text that correspond to the premises
but could not be fully translated.
"""
untranslatedClaims: "builtins.list[AutomatedReasoningCheckInputTextReference] | None" = Field(
default_factory=list
)
"""
References to portions of the original input text that correspond to the claims but
could not be fully translated.
"""
confidence: float
"""
A confidence score between 0 and 1 indicating how certain the system is about the
logical translation.
"""
[docs]class AutomatedReasoningCheckScenario(Boto3Model):
"""
Represents a logical scenario where claims can be evaluated as true or false,
containing specific logical assignments.
"""
statements: "builtins.list[AutomatedReasoningLogicStatement] | None" = Field(
default_factory=list
)
"""
List of logical assignments and statements that define this scenario.
"""
[docs]class AutomatedReasoningCheckRule(Boto3Model):
"""
References a specific automated reasoning policy rule that was applied during
evaluation.
"""
id: "str | None" = None
"""
The unique identifier of the automated reasoning rule.
"""
policyVersionArn: "str | None" = None
"""
The ARN of the automated reasoning policy version that contains this rule.
"""
[docs]class AutomatedReasoningCheckLogicWarning(Boto3Model):
"""
Identifies logical issues in the translated statements that exist independent of any
policy rules, such as statements that are always true or always false.
"""
type: "Literal['ALWAYS_TRUE', 'ALWAYS_FALSE'] | None" = None
"""
The category of the detected logical issue, such as statements that are always true
or always false.
"""
premises: "builtins.list[AutomatedReasoningLogicStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that serve as premises under which the claims are validated.
"""
claims: "builtins.list[AutomatedReasoningLogicStatement] | None" = Field(
default_factory=list
)
"""
The logical statements that are validated while assuming the policy and premises.
"""
[docs]class AutomatedReasoningCheckValidFinding(Boto3Model):
"""
Indicates that the claims are definitively true and logically implied by the
premises, with no possible alternative interpretations.
"""
translation: "AutomatedReasoningCheckTranslation | None" = None
"""
The logical translation of the input that this finding validates.
"""
claimsTrueScenario: "AutomatedReasoningCheckScenario | None" = None
"""
An example scenario demonstrating how the claims are logically true.
"""
supportingRules: "builtins.list[AutomatedReasoningCheckRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that support why this result is considered
valid.
"""
logicWarning: "AutomatedReasoningCheckLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class AutomatedReasoningCheckInvalidFinding(Boto3Model):
"""
Indicates that the claims are logically false and contradictory to the established
rules or premises.
"""
translation: "AutomatedReasoningCheckTranslation | None" = None
"""
The logical translation of the input that this finding invalidates.
"""
contradictingRules: "builtins.list[AutomatedReasoningCheckRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that contradict the claims in the input.
"""
logicWarning: "AutomatedReasoningCheckLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class AutomatedReasoningCheckSatisfiableFinding(Boto3Model):
"""
Indicates that the claims could be either true or false depending on additional
assumptions not provided in the input.
"""
translation: "AutomatedReasoningCheckTranslation | None" = None
"""
The logical translation of the input that this finding evaluates.
"""
claimsTrueScenario: "AutomatedReasoningCheckScenario | None" = None
"""
An example scenario demonstrating how the claims could be logically true.
"""
claimsFalseScenario: "AutomatedReasoningCheckScenario | None" = None
"""
An example scenario demonstrating how the claims could be logically false.
"""
logicWarning: "AutomatedReasoningCheckLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class AutomatedReasoningCheckImpossibleFinding(Boto3Model):
"""
Indicates that no valid claims can be made due to logical contradictions in the
premises or rules.
"""
translation: "AutomatedReasoningCheckTranslation | None" = None
"""
The logical translation of the input that this finding evaluates.
"""
contradictingRules: "builtins.list[AutomatedReasoningCheckRule] | None" = Field(
default_factory=list
)
"""
The automated reasoning policy rules that contradict the claims and/or premises in
the input.
"""
logicWarning: "AutomatedReasoningCheckLogicWarning | None" = None
"""
Indication of a logic issue with the translation without needing to consider the
automated reasoning policy rules.
"""
[docs]class AutomatedReasoningCheckTranslationOption(Boto3Model):
"""
Represents one possible logical interpretation of ambiguous input content.
"""
translations: "builtins.list[AutomatedReasoningCheckTranslation] | None" = Field(
default_factory=list
)
"""
Different logical interpretations that were detected during translation of the
input.
"""
[docs]class AutomatedReasoningCheckTranslationAmbiguousFinding(Boto3Model):
"""
Indicates that the input has multiple valid logical interpretations, requiring
additional context or clarification.
"""
options: "builtins.list[AutomatedReasoningCheckTranslationOption] | None" = Field(
default_factory=list
)
"""
Different logical interpretations that were detected during translation of the
input.
"""
differenceScenarios: "builtins.list[AutomatedReasoningCheckScenario] | None" = (
Field(default_factory=list)
)
"""
Scenarios showing how the different translation options differ in meaning.
"""
[docs]class AutomatedReasoningCheckTooComplexFinding(Boto3Model):
"""
Indicates that the input exceeds the processing capacity due to the volume or
complexity of the logical information.
"""
[docs]class AutomatedReasoningCheckNoTranslationsFinding(Boto3Model):
"""
Indicates that no relevant logical information could be extracted from the input for
validation.
"""
[docs]class AutomatedReasoningCheckFinding(Boto3Model):
"""
Represents the result of an Automated Reasoning validation check, indicating whether
the content is logically valid, invalid, or falls into other categories based on the
policy rules.
"""
valid: "AutomatedReasoningCheckValidFinding | None" = None
"""
Indicates that the claims are true.
The claims are implied by the premises and the Automated Reasoning policy. Given the
Automated Reasoning policy and premises, it is not possible for these claims to be
false.
"""
invalid: "AutomatedReasoningCheckInvalidFinding | None" = None
"""
Indicates that the claims are false.
The claims are not implied by the premises and Automated Reasoning policy.
Furthermore, there exist different claims that are consistent with the premises and
Automated Reasoning policy.
"""
satisfiable: "AutomatedReasoningCheckSatisfiableFinding | None" = None
"""
Indicates that the claims can be true or false.
It depends on what assumptions are made for the claim to be implied from the
premises and Automated Reasoning policy rules. In this situation, different
assumptions can make input claims false and alternative claims true.
"""
impossible: "AutomatedReasoningCheckImpossibleFinding | None" = None
"""
Indicates that Automated Reasoning cannot make a statement about the claims.
This can happen if the premises are logically incorrect, or if there is a conflict
within the Automated Reasoning policy itself.
"""
translationAmbiguous: "AutomatedReasoningCheckTranslationAmbiguousFinding | None" = None
"""
Indicates that an ambiguity was detected in the translation, making it unsound to
continue with validity checking.
Additional context or follow-up questions might be needed to get translation to
succeed.
"""
tooComplex: "AutomatedReasoningCheckTooComplexFinding | None" = None
"""
Indicates that the input contains too much information for Automated Reasoning to
process within its latency limits.
"""
noTranslations: "AutomatedReasoningCheckNoTranslationsFinding | None" = None
"""
Identifies that some or all of the input prompt wasn't translated into logic.
This can happen if the input isn't relevant to the Automated Reasoning policy, or if
the policy doesn't have variables to model relevant input.
"""
[docs]class AutomatedReasoningPolicyTestResult(ReadonlyPrimaryBoto3Model):
"""
Contains the results of testing an Automated Reasoning policy against various
scenarios and validation checks.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyTestResultManager
)
testCase: AutomatedReasoningPolicyTestCase
"""
The test case that was executed, including the input content, expected results, and
configuration parameters used during validation.
"""
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy that was tested.
"""
testRunStatus: Literal[
"NOT_STARTED", "SCHEDULED", "IN_PROGRESS", "COMPLETED", "FAILED"
]
"""
The overall status of the test run (e.g., COMPLETED, FAILED, IN_PROGRESS).
"""
testFindings: "builtins.list[AutomatedReasoningCheckFinding] | None" = Field(
default_factory=list
)
"""
Detailed findings from the test run, including any issues, violations, or unexpected
behaviors discovered.
"""
testRunResult: "Literal['PASSED', 'FAILED'] | None" = None
"""
The overall result of the test run, indicating whether the policy passed or failed
validation.
"""
aggregatedTestFindingsResult: "Literal['VALID', 'INVALID', 'SATISFIABLE', 'IMPOSSIBLE', 'TRANSLATION_AMBIGUOUS', 'TOO_COMPLEX', 'NO_TRANSLATION'] | None" = None
"""
A summary of all test findings, aggregated to provide an overall assessment of
policy quality and correctness.
"""
updatedAt: datetime
"""
The timestamp when the test results were last updated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`testCase` attribute.
Returns:
The primary key of the model instance.
"""
return self.testCase
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`testCase` attribute.
"""
return hash(self.testCase)
[docs]class AutomatedReasoningPolicyScenario(Boto3Model):
"""
Represents a test scenario used to validate an Automated Reasoning policy, including
the test conditions and expected outcomes.
"""
expression: str
"""
The logical expression or condition that defines this test scenario.
"""
alternateExpression: str
"""
An alternative way to express the same test scenario, used for validation and
comparison purposes.
"""
expectedResult: Literal[
"VALID",
"INVALID",
"SATISFIABLE",
"IMPOSSIBLE",
"TRANSLATION_AMBIGUOUS",
"TOO_COMPLEX",
"NO_TRANSLATION",
]
"""
The expected outcome when this scenario is evaluated against the policy (e.g., PASS,
FAIL, VIOLATION).
"""
ruleIds: "builtins.list[str]"
"""
The list of rule identifiers that are expected to be triggered or evaluated by this
test scenario.
"""
[docs]class AutomatedReasoningPolicyNextScenario(ReadonlyPrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyNextScenarioManager
)
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
scenario: "AutomatedReasoningPolicyScenario | None" = None
"""
The next test scenario to validate, including the test expression and expected
results.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`policyArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.policyArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`policyArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.policyArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`policyArn` attribute.
"""
return hash(self.policyArn)
[docs]class AutomatedReasoningPolicyDefinitionTypeValuePair(Boto3Model):
"""
Associates a type name with a specific value name, used for referencing type values
in rules and other policy elements.
"""
typeName: str
"""
The name of the custom type that contains the referenced value.
"""
valueName: str
"""
The name of the specific value within the type.
"""
[docs]class AutomatedReasoningPolicyDisjointRuleSet(Boto3Model):
"""
Represents a set of rules that operate on completely separate variables, indicating
they address different concerns or domains within the policy.
"""
variables: "builtins.list[str]"
"""
The set of variables that are used by the rules in this disjoint set.
"""
rules: "builtins.list[str]"
"""
The list of rules that form this disjoint set, all operating on the same set of
variables.
"""
[docs]class AutomatedReasoningPolicyDefinitionQualityReport(Boto3Model):
"""
Provides a comprehensive analysis of the quality and completeness of an Automated
Reasoning policy definition, highlighting potential issues and optimization
opportunities.
"""
typeCount: int
"""
The total number of custom types defined in the policy.
"""
variableCount: int
"""
The total number of variables defined in the policy.
"""
ruleCount: int
"""
The total number of rules defined in the policy.
"""
unusedTypes: "builtins.list[str]"
"""
A list of custom types that are defined but not referenced by any variables or
rules, suggesting they may be unnecessary.
"""
unusedTypeValues: "builtins.list[AutomatedReasoningPolicyDefinitionTypeValuePair]"
"""
A list of type values that are defined but never used in any rules, indicating
potential cleanup opportunities.
"""
unusedVariables: "builtins.list[str]"
"""
A list of variables that are defined but not referenced by any rules, suggesting
they may be unnecessary.
"""
conflictingRules: "builtins.list[str]"
"""
A list of rules that may conflict with each other, potentially leading to
inconsistent policy behavior.
"""
disjointRuleSets: "builtins.list[AutomatedReasoningPolicyDisjointRuleSet]"
"""
Groups of rules that operate on completely separate sets of variables, indicating
the policy may be addressing multiple unrelated concerns.
"""
[docs]class AutomatedReasoningPolicyPlanning(Boto3Model):
"""
Represents the planning phase of policy build workflow, where the system analyzes
source content and determines what operations to perform.
"""
[docs]class AutomatedReasoningPolicyAddTypeMutation(Boto3Model):
"""
A mutation operation that adds a new custom type to the policy definition during the
build process.
"""
type: AutomatedReasoningPolicyDefinitionType
"""
The type definition that specifies the name, description, and possible values for
the new custom type being added to the policy.
"""
[docs]class AutomatedReasoningPolicyUpdateTypeMutation(Boto3Model):
"""
A mutation operation that modifies an existing custom type in the policy definition
during the build process.
"""
type: AutomatedReasoningPolicyDefinitionType
"""
The updated type definition containing the modified name, description, or values for
the existing custom type.
"""
[docs]class AutomatedReasoningPolicyDeleteTypeMutation(Boto3Model):
"""
A mutation operation that removes a custom type from the policy definition during
the build process.
"""
name: str
"""
The name of the custom type to delete.
"""
[docs]class AutomatedReasoningPolicyAddVariableMutation(Boto3Model):
"""
A mutation operation that adds a new variable to the policy definition during the
build process.
"""
variable: AutomatedReasoningPolicyDefinitionVariable
"""
The variable definition that specifies the name, type, and description for the new
variable being added to the policy.
"""
[docs]class AutomatedReasoningPolicyUpdateVariableMutation(Boto3Model):
"""
A mutation operation that modifies an existing variable in the policy definition
during the build process.
"""
variable: AutomatedReasoningPolicyDefinitionVariable
"""
The updated variable definition containing the modified name, type, or description
for the existing variable.
"""
[docs]class AutomatedReasoningPolicyDeleteVariableMutation(Boto3Model):
"""
A mutation operation that removes a variable from the policy definition during the
build process.
"""
name: str
"""
The name of the variable to delete.
"""
[docs]class AutomatedReasoningPolicyAddRuleMutation(Boto3Model):
"""
A mutation operation that adds a new rule to the policy definition during the build
process.
"""
rule: AutomatedReasoningPolicyDefinitionRule
"""
The rule definition that specifies the formal logical expression and metadata for
the new rule being added to the policy.
"""
[docs]class AutomatedReasoningPolicyUpdateRuleMutation(Boto3Model):
"""
A mutation operation that modifies an existing rule in the policy definition during
the build process.
"""
rule: AutomatedReasoningPolicyDefinitionRule
"""
The updated rule definition containing the modified formal logical expression and
any changed metadata for the existing rule.
"""
[docs]class AutomatedReasoningPolicyDeleteRuleMutation(Boto3Model):
"""
A mutation operation that removes a rule from the policy definition during the build
process.
"""
id: str
"""
The unique identifier of the rule to delete.
"""
[docs]class AutomatedReasoningPolicyMutation(Boto3Model):
"""
A container for various mutation operations that can be applied to an Automated
Reasoning policy, including adding, updating, and deleting policy elements.
"""
addType: "AutomatedReasoningPolicyAddTypeMutation | None" = None
"""
A mutation to add a new custom type to the policy.
"""
updateType: "AutomatedReasoningPolicyUpdateTypeMutation | None" = None
"""
A mutation to modify an existing custom type in the policy.
"""
deleteType: "AutomatedReasoningPolicyDeleteTypeMutation | None" = None
"""
A mutation to remove a custom type from the policy.
"""
addVariable: "AutomatedReasoningPolicyAddVariableMutation | None" = None
"""
A mutation to add a new variable to the policy.
"""
updateVariable: "AutomatedReasoningPolicyUpdateVariableMutation | None" = None
"""
A mutation to modify an existing variable in the policy.
"""
deleteVariable: "AutomatedReasoningPolicyDeleteVariableMutation | None" = None
"""
A mutation to remove a variable from the policy.
"""
addRule: "AutomatedReasoningPolicyAddRuleMutation | None" = None
"""
A mutation to add a new rule to the policy.
"""
updateRule: "AutomatedReasoningPolicyUpdateRuleMutation | None" = None
"""
A mutation to modify an existing rule in the policy.
"""
deleteRule: "AutomatedReasoningPolicyDeleteRuleMutation | None" = None
"""
A mutation to remove a rule from the policy.
"""
[docs]class AutomatedReasoningPolicyBuildStepContext(Boto3Model):
"""
Provides context about what type of operation was being performed during a build
step.
"""
planning: "AutomatedReasoningPolicyPlanning | None" = None
"""
Indicates that this build step was part of the planning phase, where the system
determines what operations to perform.
"""
mutation: "AutomatedReasoningPolicyMutation | None" = None
"""
Indicates that this build step involved modifying the policy structure, such as
adding or updating rules, variables, or types.
"""
[docs]class AutomatedReasoningPolicyDefinitionElement(Boto3Model):
"""
Represents a single element in an Automated Reasoning policy definition, such as a
rule, variable, or type definition.
"""
policyDefinitionVariable: "AutomatedReasoningPolicyDefinitionVariable | None" = None
"""
A variable element within the policy definition that represents a concept used in
logical expressions and rules.
"""
policyDefinitionType: "AutomatedReasoningPolicyDefinitionType | None" = None
"""
A custom type element within the policy definition that defines a set of possible
values for variables.
"""
policyDefinitionRule: "AutomatedReasoningPolicyDefinitionRule | None" = None
"""
A rule element within the policy definition that contains a formal logical
expression used for validation.
"""
[docs]class AutomatedReasoningPolicyBuildStepMessage(Boto3Model):
"""
Represents a message generated during a build step, providing information about what
happened or any issues encountered.
"""
message: str
"""
The content of the message, describing what occurred during the build step.
"""
messageType: Literal["INFO", "WARNING", "ERROR"]
"""
The type of message (e.g., INFO, WARNING, ERROR) indicating its severity and
purpose.
"""
[docs]class AutomatedReasoningPolicyBuildStep(Boto3Model):
"""
Represents a single step in the policy build process, containing context about what
was being processed and any messages or results.
"""
context: AutomatedReasoningPolicyBuildStepContext
"""
Contextual information about what was being processed during this build step, such
as the type of operation or the source material being analyzed.
"""
priorElement: "AutomatedReasoningPolicyDefinitionElement | None" = None
"""
Reference to the previous element or step in the build process, helping to trace the
sequence of operations.
"""
messages: "builtins.list[AutomatedReasoningPolicyBuildStepMessage]"
"""
A list of messages generated during this build step, including informational
messages, warnings, and error details.
"""
[docs]class AutomatedReasoningPolicyBuildLogEntry(Boto3Model):
"""
Represents a single entry in the policy build log, containing information about a
specific step or event in the build process.
"""
annotation: AutomatedReasoningPolicyAnnotation
"""
The annotation or operation that was being processed when this log entry was
created.
"""
status: Literal["APPLIED", "FAILED"]
"""
The status of the build step (e.g., SUCCESS, FAILED, IN_PROGRESS).
"""
buildSteps: "builtins.list[AutomatedReasoningPolicyBuildStep]"
"""
Detailed information about the specific build steps that were executed, including
any sub-operations or transformations.
"""
[docs]class AutomatedReasoningPolicyBuildLog(Boto3Model):
"""
Contains detailed logging information about the policy build process, including
steps taken, decisions made, and any issues encountered.
"""
entries: "builtins.list[AutomatedReasoningPolicyBuildLogEntry]"
"""
A list of log entries documenting each step in the policy build process, including
timestamps, status, and detailed messages.
"""
[docs]class AutomatedReasoningPolicyGeneratedTestCase(Boto3Model):
"""
Represents a generated test case, consisting of query content, guard content, and
expected results.
"""
queryContent: str
"""
The input query or prompt that generated the content.
This provides context for the validation.
"""
guardContent: str
"""
The output content that's validated by the Automated Reasoning policy.
This represents the foundation model response that will be checked for accuracy.
"""
expectedAggregatedFindingsResult: Literal[
"VALID",
"INVALID",
"SATISFIABLE",
"IMPOSSIBLE",
"TRANSLATION_AMBIGUOUS",
"TOO_COMPLEX",
"NO_TRANSLATION",
]
"""
The expected results of the generated test case.
Possible values include:
"""
[docs]class AutomatedReasoningPolicyGeneratedTestCases(Boto3Model):
"""
Contains a comprehensive test suite generated by the build workflow, providing
validation capabilities for automated reasoning policies.
"""
generatedTestCases: "builtins.list[AutomatedReasoningPolicyGeneratedTestCase]"
"""
Represents a collection of generated test cases.
"""
[docs]class AutomatedReasoningPolicyScenarios(Boto3Model):
"""
Contains a comprehensive entity encompassing all the scenarios generated by the
build workflow, which can be used to validate an Automated Reasoning policy.
"""
policyScenarios: "builtins.list[AutomatedReasoningPolicyScenario]"
"""
Represents a collection of generated policy scenarios.
"""
[docs]class AutomatedReasoningPolicyBuildResultAssetManifestEntry(Boto3Model):
"""
Represents a single entry in the asset manifest, describing one artifact produced by
the build workflow.
"""
assetType: Literal[
"BUILD_LOG",
"QUALITY_REPORT",
"POLICY_DEFINITION",
"GENERATED_TEST_CASES",
"POLICY_SCENARIOS",
"FIDELITY_REPORT",
"ASSET_MANIFEST",
"SOURCE_DOCUMENT",
]
"""
The type of asset (e.g., BUILD_LOG, QUALITY_REPORT, POLICY_DEFINITION,
GENERATED_TEST_CASES, POLICY_SCENARIOS, FIDELITY_REPORT, ASSET_MANIFEST,
SOURCE_DOCUMENT).
"""
assetName: "str | None" = None
"""
A human-readable name for the asset, if applicable.
This helps identify specific documents or reports within the workflow results.
"""
assetId: "str | None" = None
"""
A unique identifier for the asset, if applicable.
Use this ID when requesting specific assets through the API.
"""
[docs]class AutomatedReasoningPolicyBuildResultAssetManifest(Boto3Model):
"""
A catalog of all artifacts produced by a build workflow, providing a comprehensive
list of available assets including their types and identifiers.
"""
entries: "builtins.list[AutomatedReasoningPolicyBuildResultAssetManifestEntry]"
"""
The list of asset entries in the manifest, each describing an available artifact
that can be retrieved.
"""
[docs]class AutomatedReasoningPolicySourceDocument(Boto3Model):
"""
Represents a source document that was processed during a build workflow.
Contains the document content, metadata, and a hash for verification.
"""
document: bytes
"""
The raw content of the source document as a binary blob.
"""
documentContentType: Literal["pdf", "txt"]
"""
The MIME type of the document (e.g., application/pdf, text/plain).
"""
documentName: str
"""
The name of the source document for identification purposes.
"""
documentDescription: "str | None" = None
"""
An optional description providing context about the document's content and purpose.
"""
documentHash: str
"""
A SHA-256 hash of the document content, used for verification and integrity
checking.
"""
[docs]class AutomatedReasoningPolicyStatementReference(Boto3Model):
"""
References a specific atomic statement within a source document, used to link policy
elements back to their source material.
"""
documentId: str
"""
The unique identifier of the document containing the referenced statement.
"""
statementId: str
"""
The unique identifier of the specific atomic statement being referenced.
"""
[docs]class AutomatedReasoningPolicyRuleReport(Boto3Model):
"""
Provides detailed fidelity analysis for a specific policy rule, including which
source document statements support it and how accurate the rule is.
"""
rule: str
"""
The identifier of the policy rule being analyzed in this report.
"""
groundingStatements: "builtins.list[AutomatedReasoningPolicyStatementReference] | None" = Field(
default_factory=list
)
"""
References to statements from the source documents that provide the basis or
justification for this rule.
"""
groundingJustifications: "builtins.list[str] | None" = Field(default_factory=list)
"""
Explanations describing how the source statements support and justify this specific
rule.
"""
accuracyScore: "float | None" = None
"""
A score from 0.0 to 1.0 indicating how accurately this rule represents the source
material.
"""
accuracyJustification: "str | None" = None
"""
A textual explanation of the accuracy score, describing why the rule received this
particular accuracy rating.
"""
[docs]class AutomatedReasoningPolicyVariableReport(Boto3Model):
"""
Provides detailed fidelity analysis for a specific policy variable, including which
source document statements support it and how accurate the variable definition is.
"""
policyVariable: str
"""
The name of the policy variable being analyzed in this report.
"""
groundingStatements: "builtins.list[AutomatedReasoningPolicyStatementReference] | None" = Field(
default_factory=list
)
"""
References to statements from the source documents that provide the basis or
justification for this variable.
"""
groundingJustifications: "builtins.list[str] | None" = Field(default_factory=list)
"""
Explanations describing how the source statements support and justify this specific
variable definition.
"""
accuracyScore: "float | None" = None
"""
A score from 0.0 to 1.0 indicating how accurately this variable represents concepts
from the source material.
"""
accuracyJustification: "str | None" = None
"""
A textual explanation of the accuracy score, describing why the variable received
this particular accuracy rating.
"""
[docs]class AutomatedReasoningPolicyStatementLocation(Boto3Model):
"""
Describes the location of a statement within a source document using line numbers.
"""
lines: "builtins.list[int]"
"""
The line numbers in the source document where this statement appears.
"""
[docs]class AutomatedReasoningPolicyAtomicStatement(Boto3Model):
"""
Represents a single, indivisible statement extracted from a source document.
Atomic statements are the fundamental units used to ground policy rules and
variables to their source material.
"""
id: str
"""
A unique identifier for this atomic statement within the fidelity report.
"""
text: str
"""
The actual text content of the atomic statement as extracted from the source
document.
"""
location: AutomatedReasoningPolicyStatementLocation
"""
Information about where this statement appears in the source document, including
line numbers.
"""
[docs]class AutomatedReasoningPolicyAnnotatedLine(Boto3Model):
"""
Represents a single line of text from a source document, annotated with its line
number for precise referencing.
"""
lineNumber: "int | None" = None
"""
The line number of this text within the source document.
"""
lineText: "str | None" = None
"""
The actual text content of this line from the source document.
"""
[docs]class AutomatedReasoningPolicyAnnotatedContent(Boto3Model):
"""
Represents a content element within an annotated chunk.
This union type allows for different types of content elements to be included in
document chunks, such as individual lines of text with their line numbers.
"""
line: "AutomatedReasoningPolicyAnnotatedLine | None" = None
"""
An annotated line of text from the source document, including both the line number
and the text content.
"""
[docs]class AutomatedReasoningPolicyAnnotatedChunk(Boto3Model):
"""
Represents a portion of a source document with line number annotations.
Chunks help organize document content for easier navigation and reference.
"""
pageNumber: "int | None" = None
"""
The page number where this chunk begins, if the document is divided into pages.
"""
content: "builtins.list[AutomatedReasoningPolicyAnnotatedContent]"
"""
The lines of text contained within this chunk, each annotated with its line number.
"""
[docs]class AutomatedReasoningPolicyReportSourceDocument(Boto3Model):
"""
Represents a source document that was analyzed during fidelity report generation,
including the document's metadata and its content broken down into atomic
statements.
"""
documentName: str
"""
The name of the source document that was analyzed.
"""
documentHash: str
"""
A SHA-256 hash of the document content, used for verification and ensuring the
document hasn't changed since analysis.
"""
documentId: str
"""
A unique identifier for this document within the fidelity report.
"""
atomicStatements: "builtins.list[AutomatedReasoningPolicyAtomicStatement]"
"""
The list of atomic statements extracted from this document, representing the
fundamental units of meaning used for grounding.
"""
documentContent: "builtins.list[AutomatedReasoningPolicyAnnotatedChunk]"
"""
The document's content organized into annotated chunks with line number information
for precise referencing.
"""
[docs]class AutomatedReasoningPolicyFidelityReport(Boto3Model):
"""
A comprehensive analysis report that measures how accurately a generated policy
represents the source documents.
The report includes coverage and accuracy scores, detailed grounding information
linking policy elements to source statements, and annotated document content.
"""
coverageScore: float
"""
A score from 0.0 to 1.0 indicating how well the policy covers the statements in the
source documents.
A higher score means more of the source content is represented in the policy.
"""
accuracyScore: float
"""
A score from 0.0 to 1.0 indicating how accurate the policy rules are relative to the
source documents.
A higher score means the policy rules more faithfully represent the source material.
"""
ruleReports: dict[str, AutomatedReasoningPolicyRuleReport]
"""
A mapping from rule identifiers to detailed fidelity reports for each rule, showing
which source statements ground each rule and how accurate it is.
"""
variableReports: dict[str, AutomatedReasoningPolicyVariableReport]
"""
A mapping from variable names to detailed fidelity reports for each variable,
showing which source statements ground each variable and how accurate it is.
"""
documentSources: "builtins.list[AutomatedReasoningPolicyReportSourceDocument]"
"""
A list of source documents with their content broken down into atomic statements and
annotated with line numbers for precise referencing.
"""
[docs]class AutomatedReasoningPolicyBuildResultAssets(Boto3Model):
"""
Contains the various assets generated during a policy build workflow, including
logs, quality reports, test cases, and the final policy definition.
"""
policyDefinition: "AutomatedReasoningPolicyDefinition | None" = None
"""
The complete policy definition generated by the build workflow, containing all
rules, variables, and custom types extracted from the source documents.
"""
qualityReport: "AutomatedReasoningPolicyDefinitionQualityReport | None" = None
"""
A comprehensive report analyzing the quality of the generated policy, including
metrics about rule coverage, potential conflicts, and unused elements.
"""
buildLog: "AutomatedReasoningPolicyBuildLog | None" = None
"""
The complete build log containing detailed information about each step in the policy
generation process.
"""
generatedTestCases: "AutomatedReasoningPolicyGeneratedTestCases | None" = None
"""
A comprehensive test suite generated by the build workflow, providing validation
capabilities for automated reasoning policies.
"""
policyScenarios: "AutomatedReasoningPolicyScenarios | None" = None
"""
An entity encompassing all the policy scenarios generated by the build workflow,
which can be used to validate an Automated Reasoning policy.
"""
assetManifest: "AutomatedReasoningPolicyBuildResultAssetManifest | None" = None
"""
A manifest listing all available artifacts produced by the build workflow.
This provides a catalog of all assets that can be retrieved, including their types,
names, and identifiers.
"""
document: "AutomatedReasoningPolicySourceDocument | None" = None
"""
A source document that was used as input during the build workflow.
This allows you to retrieve the original documents that were processed to generate
the policy.
"""
fidelityReport: "AutomatedReasoningPolicyFidelityReport | None" = None
"""
A comprehensive fidelity report that measures how accurately the generated policy
represents the source documents.
The report includes coverage and accuracy scores, along with detailed grounding
information for rules and variables.
"""
[docs]class AutomatedReasoningPolicyBuildWorkflowResultAssets(ReadonlyPrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyBuildWorkflowResultAssetsManager
)
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
buildWorkflowId: str
"""
The unique identifier of the build workflow.
"""
buildWorkflowAssets: "AutomatedReasoningPolicyBuildResultAssets | None" = None
"""
The requested build workflow asset.
This is a union type that returns only one of the available asset types (logs,
reports, or generated artifacts) based on the specific asset type requested in the
API call.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`buildWorkflowId` attribute.
Returns:
The primary key of the model instance.
"""
return self.buildWorkflowId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`buildWorkflowId` attribute.
Returns:
The name of the model instance.
"""
return self.buildWorkflowId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`buildWorkflowId` attribute.
"""
return hash(self.buildWorkflowId)
@cached_property
def policy(self) -> "AutomatedReasoningPolicy | None":
"""
Return the automated reasoning policy that owns these build workflow assets, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
}
)
except AttributeError:
return None
return AutomatedReasoningPolicy.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def build_workflow(self) -> "AutomatedReasoningPolicyBuildWorkflow | None":
"""
Return the automated reasoning build workflow that produced these assets, if
any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
"buildWorkflowId": self.buildWorkflowId,
}
)
except AttributeError:
return None
return AutomatedReasoningPolicyBuildWorkflow.objects.using(self.session).get(
**pk
) # type: ignore[arg-type]
[docs]class AutomatedReasoningPolicyAnnotations(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = (
AutomatedReasoningPolicyAnnotationsManager
)
policyName: str = Field(default=None, alias="name")
"""
The name of the Automated Reasoning policy.
"""
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
buildWorkflowId: str
"""
The unique identifier of the build workflow.
"""
annotations: "builtins.list[AutomatedReasoningPolicyAnnotation]"
"""
The current set of annotations containing rules, variables, and types extracted from
the source documents.
These can be modified before finalizing the policy.
"""
annotationSetHash: str
"""
A hash value representing the current state of the annotations.
This is used for optimistic concurrency control when updating annotations.
"""
updatedAt: datetime
"""
The timestamp when the annotations were last updated.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`buildWorkflowId` attribute.
Returns:
The primary key of the model instance.
"""
return self.buildWorkflowId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`policyName`
attribute.
Returns:
The name of the model instance.
"""
return self.policyName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`buildWorkflowId` attribute.
"""
return hash(self.buildWorkflowId)
@cached_property
def policy(self) -> "AutomatedReasoningPolicy | None":
"""
Return the automated reasoning policy that these annotations belong to, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
}
)
except AttributeError:
return None
return AutomatedReasoningPolicy.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def build_workflow(self) -> "AutomatedReasoningPolicyBuildWorkflow | None":
"""
Return the automated reasoning build workflow that these annotations belong to,
if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"policyArn": self.policyArn,
"buildWorkflowId": self.buildWorkflowId,
}
)
except AttributeError:
return None
return AutomatedReasoningPolicyBuildWorkflow.objects.using(self.session).get(
**pk
) # type: ignore[arg-type]
[docs]class RoutingCriteria(Boto3Model):
"""
Routing criteria for a prompt router.
"""
responseQualityDifference: float
"""
The criteria's response quality difference.
"""
[docs]class PromptRouterTargetModel(Boto3Model):
"""
The target model for a prompt router.
"""
modelArn: str
"""
The target model's ARN.
"""
[docs]class PromptRouter(PromptRouterModelMixin, PrimaryBoto3Model):
"""
Details about a prompt router.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = PromptRouterManager
promptRouterName: str
"""
The router's name.
"""
routingCriteria: RoutingCriteria
"""
The router's routing criteria.
"""
description: "str | None" = None
"""
The router's description.
"""
createdAt: "datetime | None" = None
"""
When the router was created.
"""
updatedAt: "datetime | None" = None
"""
When the router was updated.
"""
promptRouterArn: str
"""
The router's ARN.
"""
models: "builtins.list[PromptRouterTargetModel]"
"""
The router's models.
"""
fallbackModel: PromptRouterTargetModel
"""
The router's fallback model.
"""
status: Literal["AVAILABLE"]
"""
The router's status.
"""
type: Literal["custom", "default"]
"""
The summary's type.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`promptRouterArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.promptRouterArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`promptRouterArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.promptRouterArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`promptRouterName` attribute.
Returns:
The name of the model instance.
"""
return self.promptRouterName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`promptRouterArn` attribute.
"""
return hash(self.promptRouterArn)
@cached_property
def fallback_model(self) -> "FoundationModel | None":
"""
Return the fallback foundation model for this prompt router, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"modelId": self.fallbackModel.modelArn,
}
)
except AttributeError:
return None
return FoundationModel.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class EvaluationJob(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = EvaluationJobManager
roleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the IAM service role used in the evaluation job.
"""
evaluationConfig: Any | None = None
"""
Contains the configuration details of either an automated or human-based evaluation
job.
"""
inferenceConfig: Any | None = None
"""
Contains the configuration details of the inference model used for the evaluation
job.
"""
outputDataConfig: Any | None = None
"""
Contains the configuration details of the Amazon S3 bucket for storing the results
of the evaluation job.
"""
jobName: str
"""
The name for the evaluation job.
"""
status: Literal[
"InProgress", "Completed", "Failed", "Stopping", "Stopped", "Deleting"
]
"""
The current status of the evaluation job.
"""
jobArn: str
"""
The Amazon Resource Name (ARN) of the evaluation job.
"""
jobDescription: "str | None" = None
"""
The description of the evaluation job.
"""
customerEncryptionKeyId: "str | None" = None
"""
The Amazon Resource Name (ARN) of the customer managed encryption key specified when
the evaluation job was created.
"""
jobType: Literal["Human", "Automated"]
"""
Specifies whether the evaluation job is automated or human-based.
"""
applicationType: "Literal['ModelEvaluation', 'RagEvaluation'] | None" = None
"""
Specifies whether the evaluation job is for evaluating a model or evaluating a
knowledge base (retrieval and response generation).
"""
creationTime: datetime
"""
The time the evaluation job was created.
"""
lastModifiedTime: "datetime | None" = None
"""
The time the evaluation job was last modified.
"""
failureMessages: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of strings that specify why the evaluation job failed to create.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`jobArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.jobArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`jobArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.jobArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`jobName`
attribute.
Returns:
The name of the model instance.
"""
return self.jobName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`jobArn` attribute.
"""
return hash(self.jobArn)
@cached_property
def role(self) -> "IAMRole | None":
"""
Return the IAM role used by this evaluation job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
if self.roleArn is None:
return None
pk = self.transform(
"roleArn",
r"^arn:aws[a-zA-Z-]*:iam::\d+:role/(?P<RoleName>.+)$",
)
return IAMRole.objects.using(self.session).get(**pk)
[docs]class SelectiveContentGuarding(Boto3Model):
"""
Selective content guarding controls for enforced guardrails.
"""
system: "Literal['SELECTIVE', 'COMPREHENSIVE'] | None" = None
"""
Selective guarding mode for system prompts.".
"""
messages: "Literal['SELECTIVE', 'COMPREHENSIVE'] | None" = None
"""
Selective guarding mode for user messages.
"""
[docs]class ModelEnforcement(Boto3Model):
"""
Model-specific information for the enforced guardrail configuration.
"""
includedModels: "builtins.list[str]"
"""
Models to enforce the guardrail on.
"""
excludedModels: "builtins.list[str]"
"""
Models to exclude from enforcement of the guardrail.
"""
[docs]class EnforcedGuardrailsConfiguration(PrimaryBoto3Model):
"""
Account enforced guardrail output configuration.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = (
EnforcedGuardrailsConfigurationManager
)
configId: "str | None" = None
"""
Unique ID for the account enforced configuration.
"""
guardrailArn: "str | None" = None
"""
ARN representation for the guardrail.
"""
guardrailId: "str | None" = None
"""
Unique ID for the guardrail.
"""
inputTags: "Literal['HONOR', 'IGNORE'] | None" = None
"""
Whether to honor or ignore input tags at runtime.
"""
selectiveContentGuarding: "SelectiveContentGuarding | None" = None
"""
Selective content guarding controls for enforced guardrails.
"""
guardrailVersion: "str | None" = None
"""
Numerical guardrail version.
"""
createdAt: "datetime | None" = None
"""
Timestamp.
"""
createdBy: "str | None" = None
"""
The ARN of the role used to update the configuration.
"""
updatedAt: "datetime | None" = None
"""
Timestamp.
"""
updatedBy: "str | None" = None
"""
The ARN of the role used to update the configuration.
"""
owner: "Literal['ACCOUNT'] | None" = None
"""
Configuration owner type.
"""
modelEnforcement: "ModelEnforcement | None" = None
"""
Model-specific information for the enforced guardrail configuration.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`configId` attribute.
Returns:
The primary key of the model instance.
"""
return self.configId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`configId`
attribute.
Returns:
The name of the model instance.
"""
return self.configId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`configId` attribute.
"""
return hash(self.configId)
@cached_property
def guardrail(self) -> "Guardrail | None":
"""
Return the enforced guardrail, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"guardrailId": self.guardrailId,
}
)
except AttributeError:
return None
return Guardrail.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class InferenceProfileModel(Boto3Model):
"""
Contains information about a model.
"""
modelArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the model.
"""
[docs]class InferenceProfile(InferenceProfileModelMixin, PrimaryBoto3Model):
"""
Contains information about an inference profile.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = InferenceProfileManager
inferenceProfileName: str
"""
The name of the inference profile.
"""
description: "str | None" = None
"""
The description of the inference profile.
"""
createdAt: "datetime | None" = None
"""
The time at which the inference profile was created.
"""
updatedAt: "datetime | None" = None
"""
The time at which the inference profile was last updated.
"""
inferenceProfileArn: str
"""
The Amazon Resource Name (ARN) of the inference profile.
"""
models: "builtins.list[InferenceProfileModel]"
"""
A list of information about each model in the inference profile.
"""
inferenceProfileId: str
"""
The unique identifier of the inference profile.
"""
status: Literal["ACTIVE"]
"""
The status of the inference profile.
``ACTIVE`` means that the inference profile is ready to be used.
"""
type: Literal["SYSTEM_DEFINED", "APPLICATION"]
"""
The type of the inference profile.
The following types are possible:
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`inferenceProfileArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.inferenceProfileArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`inferenceProfileArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.inferenceProfileArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`inferenceProfileName` attribute.
Returns:
The name of the model instance.
"""
return self.inferenceProfileName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`inferenceProfileArn` attribute.
"""
return hash(self.inferenceProfileArn)
[docs]class InvocationLogSource(Boto3Model):
"""
A storage location for invocation logs.
"""
s3Uri: "str | None" = None
"""
The URI of an invocation log in a bucket.
"""
[docs]class InvocationLogsConfig(Boto3Model):
"""
Settings for using invocation logs to customize a model.
"""
usePromptResponse: "bool | None" = None
"""
Whether to use the model's response for training, or just the prompt.
The default value is ``False``.
"""
invocationLogSource: InvocationLogSource
"""
The source of the invocation logs.
"""
requestMetadataFilters: "RequestMetadataFilters | None" = None
"""
Rules for filtering invocation logs based on request metadata.
"""
[docs]class TrainingDataConfig(Boto3Model):
"""
S3 Location of the training data.
"""
s3Uri: "str | None" = None
"""
The S3 URI where the training data is stored.
"""
invocationLogsConfig: "InvocationLogsConfig | None" = None
"""
Settings for using invocation logs to customize a model.
"""
[docs]class Validator(Boto3Model):
"""
Information about a validator.
"""
s3Uri: str
"""
The S3 URI where the validation data is stored.
"""
[docs]class ValidationDataConfig(Boto3Model):
"""
Array of up to 10 validators.
"""
validators: "builtins.list[Validator]"
"""
Information about the validators.
"""
[docs]class OutputDataConfig(Boto3Model):
"""
S3 Location of the output data.
"""
s3Uri: str
"""
The S3 URI where the output data is stored.
"""
[docs]class ValidationDetails(Boto3Model):
"""
For a Distillation job, the status details for the validation sub-task of the job.
"""
status: "Literal['InProgress', 'Completed', 'Stopping', 'Stopped', 'Failed', 'NotStarted'] | None" = None
"""
The status of the validation sub-task of the job.
"""
creationTime: "datetime | None" = None
"""
The start time of the validation sub-task of the job.
"""
lastModifiedTime: "datetime | None" = None
"""
The latest update to the validation sub-task of the job.
"""
[docs]class DataProcessingDetails(Boto3Model):
"""
For a Distillation job, the status details for the data processing sub-task of the
job.
"""
status: "Literal['InProgress', 'Completed', 'Stopping', 'Stopped', 'Failed', 'NotStarted'] | None" = None
"""
The status of the data processing sub-task of the job.
"""
creationTime: "datetime | None" = None
"""
The start time of the data processing sub-task of the job.
"""
lastModifiedTime: "datetime | None" = None
"""
The latest update to the data processing sub-task of the job.
"""
[docs]class TrainingDetails(Boto3Model):
"""
For a Distillation job, the status details for the training sub-task of the job.
"""
status: "Literal['InProgress', 'Completed', 'Stopping', 'Stopped', 'Failed', 'NotStarted'] | None" = None
"""
The status of the training sub-task of the job.
"""
creationTime: "datetime | None" = None
"""
The start time of the training sub-task of the job.
"""
lastModifiedTime: "datetime | None" = None
"""
The latest update to the training sub-task of the job.
"""
[docs]class StatusDetails(Boto3Model):
"""For a Distillation job, the status details for sub-tasks of the job. Possible statuses for each sub-task include the
following:
* NotStarted
* InProgress
* Completed
* Stopping
* Stopped
* Failed
"""
validationDetails: "ValidationDetails | None" = None
"""
The status details for the validation sub-task of the job.
"""
dataProcessingDetails: "DataProcessingDetails | None" = None
"""
The status details for the data processing sub-task of the job.
"""
trainingDetails: "TrainingDetails | None" = None
"""
The status details for the training sub-task of the job.
"""
[docs]class TrainingMetrics(Boto3Model):
"""
Metrics associated with the custom job.
"""
trainingLoss: "float | None" = None
"""
Loss metric associated with the custom job.
"""
[docs]class ValidatorMetric(Boto3Model):
"""
The metric for the validator.
"""
validationLoss: "float | None" = None
"""
The validation loss associated with this validator.
"""
[docs]class BedrockVpcConfig(Boto3Model):
"""
The configuration of a virtual private cloud (VPC).
For more information, see
`Protect your data using Amazon Virtual Private Cloud and Amazon Web Services PrivateLink <https://docs.aws.amazon.com/bedrock/latest/userguide/usingVPC.html>`_.
"""
subnetIds: "builtins.list[str]"
"""
An array of IDs for each subnet in the VPC to use.
"""
securityGroupIds: "builtins.list[str]"
"""
An array of IDs for each security group in the VPC to use.
"""
[docs]class TeacherModelConfig(Boto3Model):
"""
Details about a teacher model used for model customization.
"""
teacherModelIdentifier: str
"""
The identifier of the teacher model.
"""
maxResponseLengthForInference: "int | None" = None
"""
The maximum number of tokens requested when the customization job invokes the
teacher model.
"""
[docs]class DistillationConfig(Boto3Model):
"""
Settings for distilling a foundation model into a smaller and more efficient model.
"""
teacherModelConfig: TeacherModelConfig
"""
The teacher model configuration.
"""
[docs]class LambdaGraderConfig(Boto3Model):
"""
Configuration for using an AWS Lambda function to grade model responses during
reinforcement fine-tuning training.
"""
lambdaArn: str
"""
ARN of the AWS Lambda function that will evaluate model responses and return reward
scores for RFT training.
"""
[docs]class GraderConfig(Boto3Model):
"""
Configuration for the grader used in reinforcement fine-tuning to evaluate model
responses and provide reward signals.
"""
lambdaGrader: "LambdaGraderConfig | None" = None
"""
Configuration for using an AWS Lambda function as the grader for evaluating model
responses and provide reward signals in reinforcement fine-tuning.
"""
[docs]class RFTHyperParameters(Boto3Model):
"""
Hyperparameters for controlling the reinforcement fine-tuning training process,
including learning settings and evaluation intervals.
"""
epochCount: "int | None" = None
"""
Number of training epochs to run during reinforcement fine-tuning.
Higher values may improve performance but increase training time.
"""
batchSize: "int | None" = None
"""
Number of training samples processed in each batch during reinforcement fine-tuning
(RFT) training.
Larger batches may improve training stability.
"""
learningRate: "float | None" = None
"""
Learning rate for the reinforcement fine-tuning.
Controls how quickly the model adapts to reward signals.
"""
maxPromptLength: "int | None" = None
"""
Maximum length of input prompts during RFT training, measured in tokens.
Longer prompts allow more context but increase memory usage and training-time.
"""
trainingSamplePerPrompt: "int | None" = None
"""
Number of response samples generated per prompt during RFT training.
More samples provide better reward signal estimation.
"""
inferenceMaxTokens: "int | None" = None
"""
Maximum number of tokens the model can generate in response to each prompt during
RFT training.
"""
reasoningEffort: "Literal['low', 'medium', 'high'] | None" = None
"""
Level of reasoning effort applied during RFT training.
Higher values may improve response quality but increase training time.
"""
evalInterval: "int | None" = None
"""
Interval between evaluation runs during RFT training, measured in training steps.
More frequent evaluation provides better monitoring.
"""
[docs]class RFTConfig(Boto3Model):
"""
Configuration settings for reinforcement fine-tuning (RFT), including grader
configuration and training hyperparameters.
"""
graderConfig: "GraderConfig | None" = None
"""
Configuration for the grader that evaluates model responses and provides reward
signals during RFT training.
"""
hyperParameters: "RFTHyperParameters | None" = None
"""
Hyperparameters that control the reinforcement fine-tuning training process,
including learning rate, batch size, and epoch count.
"""
[docs]class CustomizationConfig(Boto3Model):
"""
A model customization configuration.
"""
distillationConfig: "DistillationConfig | None" = None
"""
The Distillation configuration for the custom model.
"""
rftConfig: "RFTConfig | None" = None
"""
Configuration settings for reinforcement fine-tuning (RFT) model customization,
including grader configuration and hyperparameters.
"""
[docs]class ModelCustomizationJob(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = ModelCustomizationJobManager
outputModelName: "str | None" = None
"""
The name of the output model.
"""
roleArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the IAM role.
"""
trainingDataConfig: "TrainingDataConfig | None" = None
"""
Contains information about the training dataset.
"""
validationDataConfig: "ValidationDataConfig | None" = None
"""
Contains information about the validation dataset.
"""
outputDataConfig: "OutputDataConfig | None" = None
"""
Output data configuration.
"""
jobArn: str
"""
The Amazon Resource Name (ARN) of the customization job.
"""
jobName: str
"""
The name of the customization job.
"""
outputModelArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the output model.
"""
clientRequestToken: "str | None" = None
"""
The token that you specified in the ``CreateCustomizationJob`` request.
"""
status: "Literal['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped'] | None" = None
"""
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.
"""
statusDetails: "StatusDetails | None" = None
"""
For a Distillation job, the details about the statuses of the sub-tasks of the
customization job.
"""
failureMessage: "str | None" = None
"""
Information about why the job failed.
"""
creationTime: datetime
"""
Time that the resource was created.
"""
lastModifiedTime: "datetime | None" = None
"""
Time that the resource was last modified.
"""
endTime: "datetime | None" = None
"""
Time that the resource transitioned to terminal state.
"""
baseModelArn: str
"""
Amazon Resource Name (ARN) of the base model.
"""
hyperParameters: "dict[str, str] | None" = Field(default_factory=dict)
"""
The hyperparameter values for the job.
For details on the format for different models, see
`Custom model hyperparameters <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models-hp.html>`_.
"""
customizationType: "Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION', 'REINFORCEMENT_FINE_TUNING', 'IMPORTED'] | None" = None
"""
The type of model customization.
"""
outputModelKmsKeyArn: "str | None" = None
"""
The custom model is encrypted at rest using this key.
"""
trainingMetrics: "TrainingMetrics | None" = None
"""
Contains training metrics from the job creation.
"""
validationMetrics: "builtins.list[ValidatorMetric] | None" = Field(
default_factory=list
)
"""
The loss metric for each validator that you provided in the createjob request.
"""
vpcConfig: "BedrockVpcConfig | None" = None
"""
VPC configuration for the custom model job.
"""
customizationConfig: "CustomizationConfig | None" = None
"""
The customization configuration for the model customization job.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`jobArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.jobArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`jobArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.jobArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`jobName`
attribute.
Returns:
The name of the model instance.
"""
return self.jobName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`jobArn` attribute.
"""
return hash(self.jobArn)
@cached_property
def role(self) -> "IAMRole | None":
"""
Return the IAM role used by this customization job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
if self.roleArn is None:
return None
pk = self.transform(
"roleArn",
r"^arn:aws[a-zA-Z-]*:iam::\d+:role/(?P<RoleName>.+)$",
)
return IAMRole.objects.using(self.session).get(**pk)
@cached_property
def base_model(self) -> "FoundationModel | None":
"""
Return the foundation model used for this customization job.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"modelId": self.baseModelArn,
}
)
except AttributeError:
return None
return FoundationModel.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def output_model(self) -> "CustomModel | None":
"""
Return the output custom model produced by this customization job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"modelArn": self.outputModelArn,
}
)
except AttributeError:
return None
return CustomModel.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def output_model_kms_key(self) -> "KMSKey | None":
"""
Return the KMS key that encrypts the output model, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"KeyId": self.outputModelKmsKeyArn,
}
)
except AttributeError:
return None
return KMSKey.objects.using(self.session).get(**pk) # type: ignore[arg-type]
@cached_property
def subnets(self) -> "list[Subnet] | None":
"""
Return the subnets configured for this customization job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"SubnetIds": self.vpcConfig.subnetIds,
}
)
except AttributeError:
return []
return Subnet.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def security_groups(self) -> "list[SecurityGroup] | None":
"""
Return the security groups configured for this customization job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"GroupIds": self.vpcConfig.securityGroupIds,
}
)
except AttributeError:
return []
return SecurityGroup.objects.using(self.session).list(**pk) # type: ignore[arg-type]
[docs]class ModelCopyJob(PrimaryBoto3Model):
"""
Contains details about each model copy job.
This data type is used in the following API operations:
* `ListModelCopyJobs response <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListModelCopyJobs.html#API_Li
stModelCopyJobs_ResponseSyntax>`_
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ModelCopyJobManager
jobArn: str
"""
The Amazon Resoource Name (ARN) of the model copy job.
"""
status: Literal["InProgress", "Completed", "Failed"]
"""
The status of the model copy job.
"""
creationTime: datetime
"""
The time that the model copy job was created.
"""
targetModelArn: str
"""
The Amazon Resource Name (ARN) of the copied model.
"""
targetModelName: "str | None" = None
"""
The name of the copied model.
"""
sourceAccountId: str
"""
The unique identifier of the account that the model being copied originated from.
"""
sourceModelArn: str
"""
The Amazon Resource Name (ARN) of the original model being copied.
"""
targetModelKmsKeyArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the KMS key used to encrypt the copied model.
"""
targetModelTags: "builtins.list[Tag] | None" = Field(default_factory=list)
"""
Tags associated with the copied model.
"""
failureMessage: "str | None" = None
"""
If a model fails to be copied, a message describing why the job failed is included
here.
"""
sourceModelName: "str | None" = None
"""
The name of the original model being copied.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`jobArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.jobArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`jobArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.jobArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`jobArn`
attribute.
Returns:
The name of the model instance.
"""
return self.jobArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`jobArn` attribute.
"""
return hash(self.jobArn)
[docs]class ModelInvocationJobS3OutputDataConfig(Boto3Model):
"""
Contains the configuration of the S3 location of the output data.
"""
s3Uri: str
"""
The S3 location of the output data.
"""
s3EncryptionKeyId: "str | None" = None
"""
The unique identifier of the key that encrypts the S3 location of the output data.
"""
s3BucketOwner: "str | None" = None
"""
The ID of the Amazon Web Services account that owns the S3 bucket containing the
output data.
"""
[docs]class ModelInvocationJobOutputDataConfig(Boto3Model):
"""
Contains the configuration of the S3 location of the output data.
"""
s3OutputDataConfig: "ModelInvocationJobS3OutputDataConfig | None" = None
"""
Contains the configuration of the S3 location of the output data.
"""
[docs]class ModelInvocationJob(PrimaryBoto3Model):
"""
A summary of a batch inference job.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ModelInvocationJobManager
jobArn: str
"""
The Amazon Resource Name (ARN) of the batch inference job.
"""
jobName: str
"""
The name of the batch inference job.
"""
modelId: str
"""
The unique identifier of the foundation model used for model inference.
"""
clientRequestToken: "str | None" = None
"""
A unique, case-sensitive identifier to ensure that the API request completes no more
than one time.
If this token matches a previous request, Amazon Bedrock ignores the request, but
does not return an error. For more information, see
`Ensuring idempotency <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
"""
roleArn: str
"""
The Amazon Resource Name (ARN) of the service role with permissions to carry out and
manage batch inference.
You can use the console to create a default service role or follow the steps at
`Create a service role for batch inference <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html>`_.
"""
status: "Literal['Submitted', 'InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped', 'PartiallyCompleted', 'Expired', 'Validating', 'Scheduled'] | None" = None
"""
The status of the batch inference job.
"""
message: "str | None" = None
"""
If the batch inference job failed, this field contains a message describing why the
job failed.
"""
submitTime: datetime
"""
The time at which the batch inference job was submitted.
"""
lastModifiedTime: "datetime | None" = None
"""
The time at which the batch inference job was last modified.
"""
endTime: "datetime | None" = None
"""
The time at which the batch inference job ended.
"""
inputDataConfig: ModelInvocationJobInputDataConfig
"""
Details about the location of the input to the batch inference job.
"""
outputDataConfig: ModelInvocationJobOutputDataConfig
"""
Details about the location of the output of the batch inference job.
"""
vpcConfig: "BedrockVpcConfig | None" = None
"""
The configuration of the Virtual Private Cloud (VPC) for the data in the batch
inference job.
For more information, see
`Protect batch inference jobs using a VPC <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-vpc>`_.
"""
timeoutDurationInHours: "int | None" = None
"""
The number of hours after which the batch inference job was set to time out.
"""
jobExpirationTime: "datetime | None" = None
"""
The time at which the batch inference job times or timed out.
"""
modelInvocationType: "Literal['InvokeModel', 'Converse'] | None" = None
"""
The invocation endpoint for ModelInvocationJob.
"""
totalRecordCount: "int | None" = None
"""
The total number of records in the batch inference job.
"""
processedRecordCount: "int | None" = None
"""
The number of records that have been processed in the batch inference job.
"""
successRecordCount: "int | None" = None
"""
The number of records that were successfully processed in the batch inference job.
"""
errorRecordCount: "int | None" = None
"""
The number of records that failed to process in the batch inference job.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`jobArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.jobArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`jobArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.jobArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`jobName`
attribute.
Returns:
The name of the model instance.
"""
return self.jobName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`jobArn` attribute.
"""
return hash(self.jobArn)
@cached_property
def role(self) -> "IAMRole | None":
"""
Return the IAM role used by this invocation job.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
if self.roleArn is None:
return None
pk = self.transform(
"roleArn",
r"^arn:aws[a-zA-Z-]*:iam::\d+:role/(?P<RoleName>.+)$",
)
return IAMRole.objects.using(self.session).get(**pk)
@cached_property
def subnets(self) -> "list[Subnet] | None":
"""
Return the subnets configured for this invocation job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"SubnetIds": self.vpcConfig.subnetIds,
}
)
except AttributeError:
return []
return Subnet.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def security_groups(self) -> "list[SecurityGroup] | None":
"""
Return the security groups configured for this invocation job, if any.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"GroupIds": self.vpcConfig.securityGroupIds,
}
)
except AttributeError:
return []
return SecurityGroup.objects.using(self.session).list(**pk) # type: ignore[arg-type]
@cached_property
def foundation_model(self) -> "FoundationModel | None":
"""
Return the foundation model invoked by this batch job.
.. note::
The output of this property is cached on the model instance, so
calling this multiple times will not result in multiple calls to the
AWS API. If you need a fresh copy of the data, you can re-get the
model instance from the manager.
"""
try:
pk = OrderedDict(
{
"modelId": self.modelId,
}
)
except AttributeError:
return None
return FoundationModel.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class ModelInvocationLoggingConfiguration(
ModelInvocationLoggingConfigurationModelMixin, PrimaryBoto3Model
):
manager_class: ClassVar[type[Boto3ModelManager]] = (
ModelInvocationLoggingConfigurationManager
)
singletonId: str = "account"
"""
Singleton identity for model invocation logging configuration.
"""
audioDataDeliveryEnabled: bool | None = None
cloudWatchConfig: Any | None = None
embeddingDataDeliveryEnabled: bool | None = None
imageDataDeliveryEnabled: bool | None = None
s3Config: Any | None = None
textDataDeliveryEnabled: bool | None = None
videoDataDeliveryEnabled: bool | None = None
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`singletonId` attribute.
Returns:
The primary key of the model instance.
"""
return self.singletonId
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`singletonId`
attribute.
Returns:
The name of the model instance.
"""
return self.singletonId
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`singletonId` attribute.
"""
return hash(self.singletonId)
[docs]class ResourcePolicy(PrimaryBoto3Model):
manager_class: ClassVar[type[Boto3ModelManager]] = ResourcePolicyManager
resourceArn: str
"""
Resource ARN associated with this policy.
"""
resourcePolicy: str | None = None
"""
JSON policy document for this resource.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`resourceArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.resourceArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`resourceArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.resourceArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`resourceArn`
attribute.
Returns:
The name of the model instance.
"""
return self.resourceArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`resourceArn` attribute.
"""
return hash(self.resourceArn)
[docs]class SageMakerEndpoint(Boto3Model):
"""
Specifies the configuration for a Amazon SageMaker endpoint.
"""
initialInstanceCount: int
"""
The number of Amazon EC2 compute instances to deploy for initial endpoint creation.
"""
instanceType: str
"""
The Amazon EC2 compute instance type to deploy for hosting the model.
"""
executionRole: str
"""
The ARN of the IAM role that Amazon SageMaker can assume to access model artifacts
and docker image for deployment on Amazon EC2 compute instances or for batch
transform jobs.
"""
kmsEncryptionKey: "str | None" = None
"""
The Amazon Web Services KMS key that Amazon SageMaker uses to encrypt data on the
storage volume attached to the Amazon EC2 compute instance that hosts the endpoint.
"""
vpc: "BedrockVpcConfig | None" = None
"""
The VPC configuration for the endpoint.
"""
[docs]class EndpointConfig(Boto3Model):
"""
Specifies the configuration for the endpoint.
"""
sageMaker: "SageMakerEndpoint | None" = None
"""
The configuration specific to Amazon SageMaker for the endpoint.
"""
[docs]class MarketplaceModelEndpoint(PrimaryBoto3Model):
"""
Contains details about an endpoint for a model from Amazon Bedrock Marketplace.
"""
manager_class: ClassVar[type[Boto3ModelManager]] = MarketplaceModelEndpointManager
endpointConfig: "EndpointConfig | None" = None
"""
The configuration of the endpoint, including the number and type of instances used.
"""
endpointStatus: "str | None" = None
"""
The current status of the endpoint (e.g., Creating, InService, Updating, Failed).
"""
endpointArn: str
"""
The Amazon Resource Name (ARN) of the endpoint.
"""
modelSourceIdentifier: str
"""
The ARN of the model from Amazon Bedrock Marketplace that is deployed on this
endpoint.
"""
status: "Literal['REGISTERED', 'INCOMPATIBLE_ENDPOINT'] | None" = None
"""
The overall status of the endpoint in Amazon Bedrock Marketplace (e.g., ACTIVE,
INACTIVE).
"""
statusMessage: "str | None" = None
"""
Additional information about the overall status, if available.
"""
createdAt: datetime
"""
The timestamp when the endpoint was registered.
"""
updatedAt: datetime
"""
The timestamp when the endpoint was last updated.
"""
endpointStatusMessage: "str | None" = None
"""
Additional information about the endpoint status, if available.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`endpointArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.endpointArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the :py:attr:`endpointArn`
attribute.
Returns:
The ARN of the model instance.
"""
return self.endpointArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the :py:attr:`endpointArn`
attribute.
Returns:
The name of the model instance.
"""
return self.endpointArn
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`endpointArn` attribute.
"""
return hash(self.endpointArn)
[docs]class ProvisionedModelThroughput(PrimaryBoto3Model):
"""
A summary of information about a Provisioned Throughput.
This data type is used in the following API operations:
* `ListProvisionedThroughputs response <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListProvisionedModel
Throughputs.html#API_ListProvisionedModelThroughputs_ResponseSyntax>`_
"""
manager_class: ClassVar[type[Boto3ModelManager]] = ProvisionedModelThroughputManager
provisionedModelName: str
"""
The name of the Provisioned Throughput.
"""
provisionedModelArn: str
"""
The Amazon Resource Name (ARN) of the Provisioned Throughput.
"""
modelArn: str
"""
The Amazon Resource Name (ARN) of the model associated with the Provisioned
Throughput.
"""
desiredModelArn: str
"""
The Amazon Resource Name (ARN) of the model requested to be associated to this
Provisioned Throughput.
This value
differs from the ``modelArn`` if updating hasn't completed.
"""
foundationModelArn: str
"""
The Amazon Resource Name (ARN) of the base model for which the Provisioned
Throughput was created, or of the base model that the custom model for which the
Provisioned Throughput was created was customized.
"""
modelUnits: int
"""
The number of model units allocated to the Provisioned Throughput.
"""
desiredModelUnits: int
"""
The number of model units that was requested to be allocated to the Provisioned
Throughput.
"""
status: Literal["Creating", "InService", "Updating", "Failed"]
"""
The status of the Provisioned Throughput.
"""
commitmentDuration: "Literal['OneMonth', 'SixMonths'] | None" = None
"""
The duration for which the Provisioned Throughput was committed.
"""
commitmentExpirationTime: "datetime | None" = None
"""
The timestamp for when the commitment term of the Provisioned Throughput expires.
"""
creationTime: datetime
"""
The time that the Provisioned Throughput was created.
"""
lastModifiedTime: datetime
"""
The time that the Provisioned Throughput was last modified.
"""
@property
def pk(self) -> str | None:
"""
Return the primary key of the model. This is the value of the
:py:attr:`provisionedModelArn` attribute.
Returns:
The primary key of the model instance.
"""
return self.provisionedModelArn
@property
def arn(self) -> str | None:
"""
Return the ARN of the model. This is the value of the
:py:attr:`provisionedModelArn` attribute.
Returns:
The ARN of the model instance.
"""
return self.provisionedModelArn
@property
def name(self) -> str | None:
"""
Return the name of the model. This is the value of the
:py:attr:`provisionedModelName` attribute.
Returns:
The name of the model instance.
"""
return self.provisionedModelName
def __hash__(self) -> int:
"""
Return the hash of the model.
This is the value of the
:py:attr:`provisionedModelArn` attribute.
"""
return hash(self.provisionedModelArn)
# =======================
# Request/Response Models
# =======================
[docs]class FoundationModelDetails(Boto3Model):
"""
Information about a foundation model.
"""
modelArn: str
"""
The model Amazon Resource Name (ARN).
"""
modelId: str
"""
The model identifier.
"""
modelName: "str | None" = None
"""
The model name.
"""
providerName: "str | None" = None
"""
The model's provider name.
"""
inputModalities: "builtins.list[Literal['TEXT', 'IMAGE', 'EMBEDDING']] | None" = (
Field(default_factory=list)
)
"""
The input modalities that the model supports.
"""
outputModalities: "builtins.list[Literal['TEXT', 'IMAGE', 'EMBEDDING']] | None" = (
Field(default_factory=list)
)
"""
The output modalities that the model supports.
"""
responseStreamingSupported: "bool | None" = None
"""
Indicates whether the model supports streaming.
"""
customizationsSupported: "builtins.list[Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION']] | None" = Field(
default_factory=list
)
"""
The customization that the model supports.
"""
inferenceTypesSupported: "builtins.list[Literal['ON_DEMAND', 'PROVISIONED']] | None" = Field(
default_factory=list
)
"""
The inference types that the model supports.
"""
modelLifecycle: "FoundationModelLifecycle | None" = None
"""
Contains details about whether a model version is available or deprecated.
"""
[docs]class GetFoundationModelResponse(Boto3Model):
modelDetails: "FoundationModel | None" = None
"""
Information about the foundation model.
"""
[docs]class ListFoundationModelsResponse(Boto3Model):
modelSummaries: "builtins.list[FoundationModel] | None" = Field(
default_factory=list
)
"""
A list of Amazon Bedrock foundation models.
"""
[docs]class AgreementAvailability(Boto3Model):
"""
Information about the agreement availability.
"""
status: Literal["AVAILABLE", "PENDING", "NOT_AVAILABLE", "ERROR"]
"""
Status of the agreement.
"""
errorMessage: "str | None" = None
"""
Error message.
"""
[docs]class GetFoundationModelAvailabilityResponse(Boto3Model):
modelId: str
"""
The model Id of the foundation model.
"""
agreementAvailability: AgreementAvailability
"""
Agreement availability.
"""
authorizationStatus: Literal["AUTHORIZED", "NOT_AUTHORIZED"]
"""
Authorization status.
"""
entitlementAvailability: Literal["AVAILABLE", "NOT_AVAILABLE"]
"""
Entitlement availability.
"""
regionAvailability: Literal["AVAILABLE", "NOT_AVAILABLE"]
"""
Region availability.
"""
[docs]class CreateFoundationModelAgreementResponse(Boto3Model):
modelId: str
"""
Model Id of the model for the access request.
"""
[docs]class DeleteFoundationModelAgreementResponse(Boto3Model):
pass
[docs]class DimensionalPriceRate(Boto3Model):
"""
Dimensional price rate.
"""
dimension: "str | None" = None
"""
Dimension for the price rate.
"""
price: "str | None" = None
"""
Single-dimensional rate information.
"""
description: "str | None" = None
"""
Description of the price rate.
"""
unit: "str | None" = None
"""
Unit associated with the price.
"""
[docs]class PricingTerm(Boto3Model):
"""
Describes the usage-based pricing term.
"""
rateCard: "builtins.list[DimensionalPriceRate]"
"""
Describes a usage price for each dimension.
"""
[docs]class LegalTerm(Boto3Model):
"""
The legal term of the agreement.
"""
url: "str | None" = None
"""
URL to the legal term document.
"""
[docs]class SupportTerm(Boto3Model):
"""
Describes a support term.
"""
refundPolicyDescription: "str | None" = None
"""
Describes the refund policy.
"""
[docs]class ValidityTerm(Boto3Model):
"""
Describes the validity terms.
"""
agreementDuration: "str | None" = None
"""
Describes the agreement duration.
"""
[docs]class TermDetails(Boto3Model):
"""
Describes the usage terms of an offer.
"""
usageBasedPricingTerm: PricingTerm
"""
Describes the usage-based pricing term.
"""
legalTerm: LegalTerm
"""
Describes the legal terms.
"""
supportTerm: SupportTerm
"""
Describes the support terms.
"""
validityTerm: "ValidityTerm | None" = None
"""
Describes the validity terms.
"""
[docs]class Offer(Boto3Model):
"""
An offer dictates usage terms for the model.
"""
offerId: "str | None" = None
"""
Offer Id for a model offer.
"""
offerToken: str
"""
Offer token.
"""
termDetails: TermDetails
"""
Details about the terms of the offer.
"""
[docs]class ListFoundationModelAgreementOffersResponse(Boto3Model):
modelId: str
"""
Model Id of the foundation model.
"""
offers: "builtins.list[Offer]"
"""
List of the offers associated with the specified model.
"""
[docs]class S3DataSource(Boto3Model):
"""
The Amazon S3 data source of the model to import.
"""
s3Uri: str
"""
The URI of the Amazon S3 data source.
"""
[docs]class ModelDataSource(Boto3Model):
"""
The data source of the model to import.
"""
s3DataSource: "S3DataSource | None" = None
"""
The Amazon S3 data source of the model to import.
"""
[docs]class CreateCustomModelResponse(Boto3Model):
modelArn: str
"""
The Amazon Resource Name (ARN) of the new custom model.
"""
[docs]class GetCustomModelResponse(Boto3Model):
modelArn: str
"""
Amazon Resource Name (ARN) associated with this model.
"""
modelName: str
"""
Model name associated with this model.
"""
jobName: "str | None" = None
"""
Job name associated with this model.
"""
jobArn: "str | None" = None
"""
Job Amazon Resource Name (ARN) associated with this model.
For models that you create with the
`CreateCustomModel <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateCustomModel.html>`_ API operation,
this is ``NULL``.
"""
baseModelArn: "str | None" = None
"""
Amazon Resource Name (ARN) of the base model.
"""
customizationType: "Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION', 'REINFORCEMENT_FINE_TUNING', 'IMPORTED'] | None" = None
"""
The type of model customization.
"""
modelKmsKeyArn: "str | None" = None
"""
The custom model is encrypted at rest using this key.
"""
hyperParameters: "dict[str, str] | None" = Field(default_factory=dict)
"""
Hyperparameter values associated with this model.
For details on the format for different models, see
`Custom model hyperparameters <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models-hp.html>`_.
"""
trainingDataConfig: "TrainingDataConfig | None" = None
"""
Contains information about the training dataset.
"""
validationDataConfig: "ValidationDataConfig | None" = None
"""
Contains information about the validation dataset.
"""
outputDataConfig: "OutputDataConfig | None" = None
"""
Output data configuration associated with this custom model.
"""
trainingMetrics: "TrainingMetrics | None" = None
"""
Contains training metrics from the job creation.
"""
validationMetrics: "builtins.list[ValidatorMetric] | None" = Field(
default_factory=list
)
"""
The validation metrics from the job creation.
"""
creationTime: datetime
"""
Creation time of the model.
"""
customizationConfig: "CustomizationConfig | None" = None
"""
The customization configuration for the custom model.
"""
modelStatus: "Literal['Active', 'Creating', 'Failed'] | None" = None
"""
The current status of the custom model.
Possible values include:
"""
failureMessage: "str | None" = None
"""
A failure message for any issues that occurred when creating the custom model.
This is included for only a failed CreateCustomModel operation.
"""
[docs]class ListCustomModelsResponse(Boto3Model):
modelSummaries: "builtins.list[CustomModel] | None" = Field(
default_factory=list
)
"""
Model summaries.
"""
nextToken: "str | None" = None
"""
If the total number of results is greater than the ``maxResults`` value provided in
the request, use this token when making another request in the ``nextToken`` field
to return the next batch of results.
"""
[docs]class DeleteCustomModelResponse(Boto3Model):
pass
[docs]class CustomModelUnits(Boto3Model):
"""
A ``CustomModelUnit`` (CMU) is an abstract view of the hardware utilization that
Amazon Bedrock needs to host a single copy of your custom model. A model copy
represents a single instance of your imported model that is ready to serve inference
requests. Amazon Bedrock determines the number of custom model units that a model
copy needs when you import the custom model.
You can use ``CustomModelUnits`` to estimate the cost of running your custom model. For more information, see Calculate
the cost of running a custom model in the Amazon Bedrock user guide.
"""
customModelUnitsPerModelCopy: "int | None" = None
"""
The number of custom model units used to host a model copy.
"""
customModelUnitsVersion: "str | None" = None
"""
The version of the custom model unit.
Use to determine the billing rate for the custom model unit.
"""
[docs]class GetImportedModelResponse(Boto3Model):
modelArn: "str | None" = None
"""
The Amazon Resource Name (ARN) associated with this imported model.
"""
modelName: "str | None" = None
"""
The name of the imported model.
"""
jobName: "str | None" = None
"""
Job name associated with the imported model.
"""
jobArn: "str | None" = None
"""
Job Amazon Resource Name (ARN) associated with the imported model.
"""
modelDataSource: "ModelDataSource | None" = None
"""
The data source for this imported model.
"""
creationTime: "datetime | None" = None
"""
Creation time of the imported model.
"""
modelArchitecture: "str | None" = None
"""
The architecture of the imported model.
"""
modelKmsKeyArn: "str | None" = None
"""
The imported model is encrypted at rest using this key.
"""
instructSupported: "bool | None" = None
"""
Specifies if the imported model supports converse.
"""
customModelUnits: "CustomModelUnits | None" = None
"""
Information about the hardware utilization for a single copy of the model.
"""
[docs]class ListImportedModelsResponse(Boto3Model):
modelSummaries: "builtins.list[ImportedModel] | None" = Field(
default_factory=list
)
"""
Model summaries.
"""
nextToken: "str | None" = None
"""
If the total number of results is greater than the ``maxResults`` value provided in
the request, use this token when making another request in the ``nextToken`` field
to return the next batch of results.
"""
[docs]class DeleteImportedModelResponse(Boto3Model):
pass
[docs]class GuardrailTopicConfig(Boto3Model):
"""
Details about topics for the guardrail to identify and deny.
"""
name: str
"""
The name of the topic to deny.
"""
definition: str
"""
A definition of the topic to deny.
"""
examples: "builtins.list[str] | None" = Field(default_factory=list)
"""
A list of prompts, each of which is an example of a prompt that can be categorized
as belonging to the topic.
"""
type: Literal["DENY"]
"""
Specifies to deny the topic.
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailTopicsTierConfig(Boto3Model):
"""
The tier that your guardrail uses for denied topic filters.
Consider using a tier that balances performance, accuracy, and compatibility with
your existing generative AI workflows.
"""
tierName: Literal["CLASSIC", "STANDARD"]
"""
The tier that your guardrail uses for denied topic filters.
Valid values include:
"""
[docs]class GuardrailTopicPolicyConfig(Boto3Model):
"""
Contains details about topics that the guardrail should identify and deny.
"""
topicsConfig: "builtins.list[GuardrailTopicConfig]"
"""
A list of policies related to topics that the guardrail should deny.
"""
tierConfig: "GuardrailTopicsTierConfig | None" = None
"""
The tier that your guardrail uses for denied topic filters.
"""
[docs]class GuardrailContentFilterConfig(Boto3Model):
"""
Contains filter strengths for harmful content. Guardrails support the following
content filters to detect and filter harmful user inputs and FM-generated outputs.
* **Hate** - Describes language or a statement that discriminates, criticizes, insults, denounces, or dehumanizes a
person or group on the basis of an identity (such as race, ethnicity, gender, religion, sexual orientation, ability, and
national origin).
* **Insults** - Describes language or a statement that includes demeaning, humiliating, mocking, insulting, or
belittling language. This type of language is also labeled as bullying.
* **Sexual** - Describes language or a statement that indicates sexual interest, activity, or arousal using direct or
indirect references to body parts, physical traits, or sex.
* **Violence** - Describes language or a statement that includes glorification of or threats to inflict physical pain,
hurt, or injury toward a person, group or thing.
Content filtering depends on the confidence classification of user inputs and FM responses across each of the four
harmful categories. All input and output statements are classified into one of four confidence levels (NONE, LOW,
MEDIUM, HIGH) for each harmful category. For example, if a statement is classified as *Hate* with HIGH confidence, the
likelihood of the statement representing hateful content is high. A single statement can be classified across multiple
categories with varying confidence levels. For example, a single statement can be classified as *Hate* with HIGH
confidence, *Insults* with LOW confidence, *Sexual* with NONE confidence, and *Violence* with MEDIUM confidence.
For more information, see `Guardrails content filters <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-
filters.html>`_.
"""
type: Literal[
"SEXUAL", "VIOLENCE", "HATE", "INSULTS", "MISCONDUCT", "PROMPT_ATTACK"
]
"""
The harmful category that the content filter is applied to.
"""
inputStrength: Literal["NONE", "LOW", "MEDIUM", "HIGH"]
"""
The strength of the content filter to apply to prompts.
As you increase the filter strength, the likelihood of filtering harmful content
increases and the probability of seeing harmful content in your application reduces.
"""
outputStrength: Literal["NONE", "LOW", "MEDIUM", "HIGH"]
"""
The strength of the content filter to apply to model responses.
As you increase the filter strength, the likelihood of filtering harmful content
increases and the probability of seeing harmful content in your application reduces.
"""
inputModalities: "builtins.list[Literal['TEXT', 'IMAGE']] | None" = Field(
default_factory=list
)
"""
The input modalities selected for the guardrail content filter configuration.
"""
outputModalities: "builtins.list[Literal['TEXT', 'IMAGE']] | None" = Field(
default_factory=list
)
"""
The output modalities selected for the guardrail content filter configuration.
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailContentFiltersTierConfig(Boto3Model):
"""
The tier that your guardrail uses for content filters.
Consider using a tier that balances performance, accuracy, and compatibility with
your existing generative AI workflows.
"""
tierName: Literal["CLASSIC", "STANDARD"]
"""
The tier that your guardrail uses for content filters.
Valid values include:
"""
[docs]class GuardrailContentPolicyConfig(Boto3Model):
"""
Contains details about how to handle harmful content.
"""
filtersConfig: "builtins.list[GuardrailContentFilterConfig]"
"""
Contains the type of the content filter and how strongly it should apply to prompts
and model responses.
"""
tierConfig: "GuardrailContentFiltersTierConfig | None" = None
"""
The tier that your guardrail uses for content filters.
"""
[docs]class GuardrailWordConfig(Boto3Model):
"""
A word to configure for the guardrail.
"""
text: str
"""
Text of the word configured for the guardrail to block.
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the intput.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailManagedWordsConfig(Boto3Model):
"""
The managed word list to configure for the guardrail.
"""
type: Literal["PROFANITY"]
"""
The managed word type to configure for the guardrail.
"""
inputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailWordPolicyConfig(Boto3Model):
"""
Contains details about the word policy to configured for the guardrail.
"""
wordsConfig: "builtins.list[GuardrailWordConfig] | None" = Field(
default_factory=list
)
"""
A list of words to configure for the guardrail.
"""
managedWordListsConfig: "builtins.list[GuardrailManagedWordsConfig] | None" = Field(
default_factory=list
)
"""
A list of managed words to configure for the guardrail.
"""
[docs]class GuardrailPiiEntityConfig(Boto3Model):
"""
The PII entity to configure for the guardrail.
"""
type: Literal[
"ADDRESS",
"AGE",
"AWS_ACCESS_KEY",
"AWS_SECRET_KEY",
"CA_HEALTH_NUMBER",
"CA_SOCIAL_INSURANCE_NUMBER",
"CREDIT_DEBIT_CARD_CVV",
"CREDIT_DEBIT_CARD_EXPIRY",
"CREDIT_DEBIT_CARD_NUMBER",
"DRIVER_ID",
"EMAIL",
"INTERNATIONAL_BANK_ACCOUNT_NUMBER",
"IP_ADDRESS",
"LICENSE_PLATE",
"MAC_ADDRESS",
"NAME",
"PASSWORD",
"PHONE",
"PIN",
"SWIFT_CODE",
"UK_NATIONAL_HEALTH_SERVICE_NUMBER",
"UK_NATIONAL_INSURANCE_NUMBER",
"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
"URL",
"USERNAME",
"US_BANK_ACCOUNT_NUMBER",
"US_BANK_ROUTING_NUMBER",
"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
"US_PASSPORT_NUMBER",
"US_SOCIAL_SECURITY_NUMBER",
"VEHICLE_IDENTIFICATION_NUMBER",
]
"""
Configure guardrail type when the PII entity is detected.
"""
action: Literal["BLOCK", "ANONYMIZE", "NONE"]
"""
Configure guardrail action when the PII entity is detected.
"""
inputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailRegexConfig(Boto3Model):
"""
The regular expression to configure for the guardrail.
"""
name: str
"""
The name of the regular expression to configure for the guardrail.
"""
description: "str | None" = None
"""
The description of the regular expression to configure for the guardrail.
"""
pattern: str
"""
The regular expression pattern to configure for the guardrail.
"""
action: Literal["BLOCK", "ANONYMIZE", "NONE"]
"""
The guardrail action to configure when matching regular expression is detected.
"""
inputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the input.
Supported values include:
"""
outputAction: "Literal['BLOCK', 'ANONYMIZE', 'NONE'] | None" = None
"""
Specifies the action to take when harmful content is detected in the output.
Supported values include:
"""
inputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the input.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
outputEnabled: "bool | None" = None
"""
Specifies whether to enable guardrail evaluation on the output.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailContextualGroundingFilterConfig(Boto3Model):
"""
The filter configuration details for the guardrails contextual grounding filter.
"""
type: Literal["GROUNDING", "RELEVANCE"]
"""
The filter details for the guardrails contextual grounding filter.
"""
threshold: float
"""
The threshold details for the guardrails contextual grounding filter.
"""
action: "Literal['BLOCK', 'NONE'] | None" = None
"""
Specifies the action to take when content fails the contextual grounding evaluation.
Supported values include:
"""
enabled: "bool | None" = None
"""
Specifies whether to enable contextual grounding evaluation.
When disabled, you aren't charged for the evaluation. The evaluation doesn't appear
in the response.
"""
[docs]class GuardrailContextualGroundingPolicyConfig(Boto3Model):
"""
The policy configuration details for the guardrails contextual grounding policy.
"""
filtersConfig: "builtins.list[GuardrailContextualGroundingFilterConfig]"
"""
The filter configuration details for the guardrails contextual grounding policy.
"""
[docs]class GuardrailAutomatedReasoningPolicyConfig(Boto3Model):
"""
Configuration settings for integrating Automated Reasoning policies with Amazon
Bedrock Guardrails.
"""
policies: "builtins.list[str]"
"""
The list of Automated Reasoning policy ARNs to include in the guardrail
configuration.
"""
confidenceThreshold: "float | None" = None
"""
The confidence threshold for triggering guardrail actions based on Automated
Reasoning policy violations.
"""
[docs]class GuardrailCrossRegionConfig(Boto3Model):
"""
The system-defined guardrail profile that you're using with your guardrail.
Guardrail profiles define the destination Amazon Web Services Regions where
guardrail inference requests can be automatically routed. Using guardrail profiles
helps maintain guardrail performance and reliability when demand increases.
For more information, see the
`Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html>`_.
"""
guardrailProfileIdentifier: str
"""
The ID or Amazon Resource Name (ARN) of the guardrail profile that your guardrail is
using.
Guardrail profile availability depends on your current Amazon Web Services Region.
For more information, see the
`Amazon Bedrock User Guide <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region-support.html>`_.
"""
[docs]class CreateGuardrailResponse(Boto3Model):
guardrailId: str
"""
The unique identifier of the guardrail that was created.
"""
guardrailArn: str
"""
The ARN of the guardrail.
"""
version: str
"""
The version of the guardrail that was created.
This value will always be ``DRAFT``.
"""
createdAt: datetime
"""
The time at which the guardrail was created.
"""
[docs]class ListGuardrailsResponse(Boto3Model):
guardrails: "builtins.list[Guardrail] | None" = Field(default_factory=list)
"""
A list of objects, each of which contains details about a guardrail.
"""
nextToken: "str | None" = None
"""
If there are more results than were returned in the response, the response returns a
``nextToken`` that you can send in another ``ListGuardrails`` request to see the
next batch of results.
"""
[docs]class GuardrailSummary(Boto3Model):
"""
Contains details about a guardrail.
This data type is used in the following API operations:
* `ListGuardrails response
body <https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListGuardrails.html#API_ListGuardrails_ResponseSyntax>`_
"""
id: str
"""
The unique identifier of the guardrail.
"""
arn: str
"""
The ARN of the guardrail.
"""
status: Literal["CREATING", "UPDATING", "VERSIONING", "READY", "FAILED", "DELETING"]
"""
The status of the guardrail.
"""
name: str
"""
The name of the guardrail.
"""
description: "str | None" = None
"""
A description of the guardrail.
"""
version: str
"""
The version of the guardrail.
"""
createdAt: datetime
"""
The date and time at which the guardrail was created.
"""
updatedAt: datetime
"""
The date and time at which the guardrail was last updated.
"""
crossRegionDetails: "GuardrailCrossRegionDetails | None" = None
"""
Details about the system-defined guardrail profile that you're using with your
guardrail, including the guardrail profile ID and Amazon Resource Name (ARN).
"""
[docs]class UpdateGuardrailResponse(Boto3Model):
guardrailId: str
"""
The unique identifier of the guardrail.
"""
guardrailArn: str
"""
The ARN of the guardrail.
"""
version: str
"""
The version of the guardrail.
"""
updatedAt: datetime
"""
The date and time at which the guardrail was updated.
"""
[docs]class DeleteGuardrailResponse(Boto3Model):
pass
[docs]class CreateGuardrailVersionResponse(Boto3Model):
guardrailId: str
"""
The unique identifier of the guardrail.
"""
version: str
"""
The number of the version of the guardrail.
"""
[docs]class CreateAutomatedReasoningPolicyResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy that you created.
"""
version: str
"""
The version number of the newly created Automated Reasoning policy.
The initial version is always DRAFT.
"""
name: str
"""
The name of the Automated Reasoning policy.
"""
description: "str | None" = None
"""
The description of the Automated Reasoning policy.
"""
definitionHash: "str | None" = None
"""
The hash of the policy definition.
This is used as a concurrency token for creating policy versions that you can use in
your application.
"""
createdAt: datetime
"""
The timestamp when the policy was created.
"""
updatedAt: datetime
"""
The timestamp when the policy was last updated.
"""
[docs]class GetAutomatedReasoningPolicyResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy.
"""
name: str
"""
The name of the policy.
"""
version: str
"""
The version of the policy.
"""
policyId: str
"""
The unique identifier of the policy.
"""
description: "str | None" = None
"""
The description of the policy.
"""
definitionHash: str
"""
The hash of the policy definition used as a concurrency token.
"""
kmsKeyArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the KMS key used to encrypt the automated
reasoning policy and its associated artifacts.
If a KMS key is not provided during the initial
CreateAutomatedReasoningPolicyRequest, the kmsKeyArn won't be included in the
GetAutomatedReasoningPolicyResponse.
"""
createdAt: "datetime | None" = None
"""
The timestamp when the policy was created.
"""
updatedAt: datetime
"""
The timestamp when the policy was last updated.
"""
[docs]class ListAutomatedReasoningPoliciesResponse(Boto3Model):
automatedReasoningPolicySummaries: "builtins.list[AutomatedReasoningPolicy] | None" = Field(
default_factory=list
)
"""
A list of Automated Reasoning policy summaries.
"""
nextToken: "str | None" = None
"""
The pagination token to use in a subsequent request to retrieve the next page of
results.
"""
[docs]class UpdateAutomatedReasoningPolicyResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the updated policy.
"""
name: str
"""
The updated name of the policy.
"""
definitionHash: str
"""
The hash of the updated policy definition.
"""
updatedAt: datetime
"""
The timestamp when the policy was last updated.
"""
[docs]class DeleteAutomatedReasoningPolicyResponse(Boto3Model):
pass
[docs]class CreateAutomatedReasoningPolicyVersionResponse(Boto3Model):
policyArn: str
"""
The versioned Amazon Resource Name (ARN) of the policy version.
"""
version: str
"""
The version number of the policy version.
"""
name: str
"""
The name of the policy version.
"""
description: "str | None" = None
"""
The description of the policy version.
"""
definitionHash: str
"""
The hash of the policy definition for this version.
"""
createdAt: datetime
"""
The timestamp when the policy version was created.
"""
[docs]class ExportAutomatedReasoningPolicyVersionResponse(Boto3Model):
policyDefinition: AutomatedReasoningPolicyDefinition
"""
The exported policy definition containing the formal logic rules, variables, and
custom variable types.
"""
[docs]class StartAutomatedReasoningPolicyBuildWorkflowResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
buildWorkflowId: str
"""
The unique identifier of the newly started build workflow.
Use this ID to track the workflow's progress and retrieve its results.
"""
[docs]class ListAutomatedReasoningPolicyBuildWorkflowsResponse(Boto3Model):
automatedReasoningPolicyBuildWorkflowSummaries: "builtins.list[AutomatedReasoningPolicyBuildWorkflow] | None" = Field(
default_factory=list
)
"""
A list of build workflow summaries, each containing key information about a build
workflow including its status and timestamps.
"""
nextToken: "str | None" = None
"""
A pagination token to use in subsequent requests to retrieve additional build
workflows.
"""
[docs]class AutomatedReasoningPolicyBuildWorkflowSummary(Boto3Model):
"""
Provides a summary of a policy build workflow, including its current status, timing
information, and key identifiers.
"""
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy associated with
this build workflow.
"""
buildWorkflowId: str
"""
The unique identifier of the build workflow.
"""
status: Literal[
"SCHEDULED",
"CANCEL_REQUESTED",
"PREPROCESSING",
"BUILDING",
"TESTING",
"COMPLETED",
"FAILED",
"CANCELLED",
]
"""
The current status of the build workflow (e.g., RUNNING, COMPLETED, FAILED,
CANCELLED).
"""
buildWorkflowType: Literal[
"INGEST_CONTENT",
"REFINE_POLICY",
"IMPORT_POLICY",
"GENERATE_FIDELITY_REPORT",
"GENERATE_POLICY_SCENARIOS",
]
"""
The type of build workflow (e.g., DOCUMENT_INGESTION, POLICY_REPAIR).
"""
createdAt: datetime
"""
The timestamp when the build workflow was created.
"""
updatedAt: datetime
"""
The timestamp when the build workflow was last updated.
"""
[docs]class CancelAutomatedReasoningPolicyBuildWorkflowResponse(Boto3Model):
pass
[docs]class DeleteAutomatedReasoningPolicyBuildWorkflowResponse(Boto3Model):
pass
[docs]class StartAutomatedReasoningPolicyTestWorkflowResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy for which the test workflow was
started.
"""
[docs]class CreateAutomatedReasoningPolicyTestCaseResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy for which the test was created.
"""
testCaseId: str
"""
The unique identifier of the created test.
"""
[docs]class GetAutomatedReasoningPolicyTestCaseResponse(Boto3Model):
testCase: "AutomatedReasoningPolicyTestCase | None" = None
"""
The test details including the content, query, expected result, and metadata.
"""
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy that contains the test.
"""
[docs]class ListAutomatedReasoningPolicyTestCasesResponse(Boto3Model):
testCases: "builtins.list[AutomatedReasoningPolicyTestCase]"
"""
A list of tests for the specified policy.
"""
nextToken: "str | None" = None
"""
The pagination token to use in a subsequent request to retrieve the next page of
results.
"""
[docs]class UpdateAutomatedReasoningPolicyTestCaseResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the policy that contains the updated test.
"""
testCaseId: str
"""
The unique identifier of the updated test.
"""
[docs]class DeleteAutomatedReasoningPolicyTestCaseResponse(Boto3Model):
pass
[docs]class GetAutomatedReasoningPolicyTestResultResponse(Boto3Model):
testResult: "AutomatedReasoningPolicyTestResult | None" = None
"""
The test result containing validation findings, execution status, and detailed
analysis.
"""
[docs]class ListAutomatedReasoningPolicyTestResultsResponse(Boto3Model):
testResults: "builtins.list[AutomatedReasoningPolicyTestResult]"
"""
A list of test results, each containing information about how the policy performed
on specific test scenarios.
"""
nextToken: "str | None" = None
"""
A pagination token to use in subsequent requests to retrieve additional test
results.
"""
[docs]class UpdateAutomatedReasoningPolicyAnnotationsResponse(Boto3Model):
policyArn: str
"""
The Amazon Resource Name (ARN) of the Automated Reasoning policy.
"""
buildWorkflowId: str
"""
The unique identifier of the build workflow.
"""
annotationSetHash: str
"""
The new hash value representing the updated state of the annotations.
"""
updatedAt: datetime
"""
The timestamp when the annotations were updated.
"""
[docs]class CreatePromptRouterResponse(Boto3Model):
promptRouterArn: "str | None" = None
"""
The Amazon Resource Name (ARN) that uniquely identifies the prompt router.
"""
[docs]class GetPromptRouterResponse(Boto3Model):
promptRouterName: str
"""
The router's name.
"""
routingCriteria: RoutingCriteria
"""
The router's routing criteria.
"""
description: "str | None" = None
"""
The router's description.
"""
createdAt: "datetime | None" = None
"""
When the router was created.
"""
updatedAt: "datetime | None" = None
"""
When the router was updated.
"""
promptRouterArn: str
"""
The prompt router's ARN.
"""
models: "builtins.list[PromptRouterTargetModel]"
"""
The router's models.
"""
fallbackModel: PromptRouterTargetModel
"""
The router's fallback model.
"""
status: Literal["AVAILABLE"]
"""
The router's status.
"""
type: Literal["custom", "default"]
"""
The router's type.
"""
[docs]class ListPromptRoutersResponse(Boto3Model):
promptRouterSummaries: "builtins.list[PromptRouter] | None" = Field(
default_factory=list
)
"""
A list of prompt router summaries.
"""
nextToken: "str | None" = None
"""
Specify the pagination token from a previous request to retrieve the next page of
results.
"""
[docs]class DeletePromptRouterResponse(Boto3Model):
pass
[docs]class CreateEvaluationJobResponse(Boto3Model):
jobArn: str
"""
The Amazon Resource Name (ARN) of the evaluation job.
"""
[docs]class ListEvaluationJobsResponse(Boto3Model):
jobSummaries: "builtins.list[EvaluationJob] | None" = Field(
default_factory=list
)
"""
A list of summaries of the evaluation jobs.
"""
nextToken: "str | None" = None
"""
Continuation token from the previous response, for Amazon Bedrock to list the next
set of results.
"""
[docs]class EvaluationModelConfigSummary(Boto3Model):
"""
A summary of the models used in an Amazon Bedrock model evaluation job.
These resources can be models in Amazon Bedrock or models outside of Amazon Bedrock
that you use to generate your own inference response data.
"""
bedrockModelIdentifiers: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Amazon Resource Names (ARNs) of the models used for the evaluation job.
"""
precomputedInferenceSourceIdentifiers: "builtins.list[str] | None" = Field(
default_factory=list
)
"""
A label that identifies the models used for a model evaluation job where you provide
your own inference response data.
"""
[docs]class EvaluationRagConfigSummary(Boto3Model):
"""
A summary of the RAG resources used in an Amazon Bedrock Knowledge Base evaluation
job.
These resources can be Knowledge Bases in Amazon Bedrock or RAG sources outside of
Amazon Bedrock that you use to generate your own inference response data.
"""
bedrockKnowledgeBaseIdentifiers: "builtins.list[str] | None" = Field(
default_factory=list
)
"""
The Amazon Resource Names (ARNs) of the Knowledge Base resources used for a
Knowledge Base evaluation job where Amazon Bedrock invokes the Knowledge Base for
you.
"""
precomputedRagSourceIdentifiers: "builtins.list[str] | None" = Field(
default_factory=list
)
"""
A label that identifies the RAG sources used for a Knowledge Base evaluation job
where you provide your own inference response data.
"""
[docs]class EvaluationInferenceConfigSummary(Boto3Model):
"""
Identifies the models, Knowledge Bases, or other RAG sources evaluated in a model or
Knowledge Base evaluation job.
"""
modelConfigSummary: "EvaluationModelConfigSummary | None" = None
"""
A summary of the models used in an Amazon Bedrock model evaluation job.
These resources can be models in Amazon Bedrock or models outside of Amazon Bedrock
that you use to generate your own inference response data.
"""
ragConfigSummary: "EvaluationRagConfigSummary | None" = None
"""
A summary of the RAG resources used in an Amazon Bedrock Knowledge Base evaluation
job.
These resources can be Knowledge Bases in Amazon Bedrock or RAG sources outside of
Amazon Bedrock that you use to generate your own inference response data.
"""
[docs]class EvaluationSummary(Boto3Model):
"""
Summary information of an evaluation job.
"""
jobArn: str
"""
The Amazon Resource Name (ARN) of the evaluation job.
"""
jobName: str
"""
The name for the evaluation job.
"""
status: Literal[
"InProgress", "Completed", "Failed", "Stopping", "Stopped", "Deleting"
]
"""
The current status of the evaluation job.
"""
creationTime: datetime
"""
The time the evaluation job was created.
"""
jobType: Literal["Human", "Automated"]
"""
Specifies whether the evaluation job is automated or human-based.
"""
evaluationTaskTypes: "builtins.list[Literal['Summarization', 'Classification', 'QuestionAndAnswer', 'Generation', 'Custom']]"
"""
The type of task for model evaluation.
"""
modelIdentifiers: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Amazon Resource Names (ARNs) of the model(s) used for the evaluation job.
"""
ragIdentifiers: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Amazon Resource Names (ARNs) of the knowledge base resources used for a
knowledge base evaluation job.
"""
evaluatorModelIdentifiers: "builtins.list[str] | None" = Field(default_factory=list)
"""
The Amazon Resource Names (ARNs) of the models used to compute the metrics for a
knowledge base evaluation job.
"""
customMetricsEvaluatorModelIdentifiers: "builtins.list[str] | None" = Field(
default_factory=list
)
"""
The Amazon Resource Names (ARNs) of the models used to compute custom metrics in an
Amazon Bedrock evaluation job.
"""
inferenceConfigSummary: "EvaluationInferenceConfigSummary | None" = None
"""
Identifies the models, Knowledge Bases, or other RAG sources evaluated in a model or
Knowledge Base evaluation job.
"""
applicationType: "Literal['ModelEvaluation', 'RagEvaluation'] | None" = None
"""
Specifies whether the evaluation job is for evaluating a model or evaluating a
knowledge base (retrieval and response generation).
"""
[docs]class StopEvaluationJobResponse(Boto3Model):
pass
[docs]class BatchDeleteEvaluationJobError(Boto3Model):
"""
A JSON array that provides the status of the evaluation jobs being deleted.
"""
jobIdentifier: str
"""
The ARN of the evaluation job being deleted.
"""
code: str
"""
A HTTP status code of the evaluation job being deleted.
"""
message: "str | None" = None
"""
A status message about the evaluation job deletion.
"""
[docs]class BatchDeleteEvaluationJobItem(Boto3Model):
"""
An evaluation job for deletion, and it’s current status.
"""
jobIdentifier: str
"""
The Amazon Resource Name (ARN) of the evaluation job for deletion.
"""
jobStatus: Literal[
"InProgress", "Completed", "Failed", "Stopping", "Stopped", "Deleting"
]
"""
The status of the evaluation job for deletion.
"""
[docs]class BatchDeleteEvaluationJobResponse(Boto3Model):
errors: "builtins.list[BatchDeleteEvaluationJobError]"
"""
A JSON object containing the HTTP status codes and the ARNs of evaluation jobs that
failed to be deleted.
"""
evaluationJobs: "builtins.list[BatchDeleteEvaluationJobItem]"
"""
The list of evaluation jobs for deletion.
"""
[docs]class ListEnforcedGuardrailsConfigurationResponse(Boto3Model):
guardrailsConfig: "builtins.list[EnforcedGuardrailsConfiguration]"
"""
Array of AccountEnforcedGuardrailOutputConfiguration objects.
"""
nextToken: "str | None" = None
"""
Opaque continuation token of previous paginated response.
"""
[docs]class PutEnforcedGuardrailConfigurationResponse(Boto3Model):
configId: "str | None" = None
"""
Unique ID for the account enforced configuration.
"""
updatedAt: "datetime | None" = None
"""
Timestamp.
"""
updatedBy: "str | None" = None
"""
The ARN of the role used to update the configuration.
"""
[docs]class DeleteEnforcedGuardrailConfigurationResponse(Boto3Model):
pass
[docs]class CreateModelCustomizationJobResponse(Boto3Model):
jobArn: str
"""
Amazon Resource Name (ARN) of the fine tuning job.
"""
[docs]class ListModelCustomizationJobsResponse(Boto3Model):
modelCustomizationJobSummaries: "builtins.list[ModelCustomizationJob] | None" = Field(
default_factory=list
)
"""
Job summaries.
"""
nextToken: "str | None" = None
"""
If the total number of results is greater than the ``maxResults`` value provided in
the request, use this token when making another request in the ``nextToken`` field
to return the next batch of results.
"""
[docs]class ModelCustomizationJobSummary(Boto3Model):
"""
Information about one customization job.
"""
jobArn: str
"""
Amazon Resource Name (ARN) of the customization job.
"""
baseModelArn: str
"""
Amazon Resource Name (ARN) of the base model.
"""
jobName: str
"""
Name of the customization job.
"""
status: Literal["InProgress", "Completed", "Failed", "Stopping", "Stopped"]
"""
Status of the customization job.
"""
statusDetails: "StatusDetails | None" = None
"""
Details about the status of the data processing sub-task of the job.
"""
lastModifiedTime: "datetime | None" = None
"""
Time that the customization job was last modified.
"""
creationTime: datetime
"""
Creation time of the custom model.
"""
endTime: "datetime | None" = None
"""
Time that the customization job ended.
"""
customModelArn: "str | None" = None
"""
Amazon Resource Name (ARN) of the custom model.
"""
customModelName: "str | None" = None
"""
Name of the custom model.
"""
customizationType: "Literal['FINE_TUNING', 'CONTINUED_PRE_TRAINING', 'DISTILLATION', 'REINFORCEMENT_FINE_TUNING', 'IMPORTED'] | None" = None
"""
Specifies whether to carry out continued pre-training of a model or whether to fine-
tune it.
For more information, see
`Custom models <https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html>`_.
"""
[docs]class StopModelCustomizationJobResponse(Boto3Model):
pass
[docs]class InferenceProfileModelSource(Boto3Model):
"""
Contains information about the model or system-defined inference profile that is the
source for an inference profile..
"""
copyFrom: "str | None" = None
"""
The ARN of the model or system-defined inference profile that is the source for the
inference profile.
"""
[docs]class CreateInferenceProfileResponse(Boto3Model):
inferenceProfileArn: str
"""
The ARN of the inference profile that you created.
"""
status: "Literal['ACTIVE'] | None" = None
"""
The status of the inference profile.
``ACTIVE`` means that the inference profile is ready to be used.
"""
[docs]class GetInferenceProfileResponse(Boto3Model):
inferenceProfileName: str
"""
The name of the inference profile.
"""
description: "str | None" = None
"""
The description of the inference profile.
"""
createdAt: "datetime | None" = None
"""
The time at which the inference profile was created.
"""
updatedAt: "datetime | None" = None
"""
The time at which the inference profile was last updated.
"""
inferenceProfileArn: str
"""
The Amazon Resource Name (ARN) of the inference profile.
"""
models: "builtins.list[InferenceProfileModel]"
"""
A list of information about each model in the inference profile.
"""
inferenceProfileId: str
"""
The unique identifier of the inference profile.
"""
status: Literal["ACTIVE"]
"""
The status of the inference profile.
``ACTIVE`` means that the inference profile is ready to be used.
"""
type: Literal["SYSTEM_DEFINED", "APPLICATION"]
"""
The type of the inference profile.
The following types are possible:
"""
[docs]class ListInferenceProfilesResponse(Boto3Model):
inferenceProfileSummaries: "builtins.list[InferenceProfile] | None" = Field(
default_factory=list
)
"""
A list of information about each inference profile that you can use.
"""
nextToken: "str | None" = None
"""
If the total number of results is greater than the ``maxResults`` value provided in
the request, use this token when making another request in the ``nextToken`` field
to return the next batch of results.
"""
[docs]class DeleteInferenceProfileResponse(Boto3Model):
pass
[docs]class CreateModelCopyJobResponse(Boto3Model):
jobArn: str
"""
The Amazon Resource Name (ARN) of the model copy job.
"""
[docs]class GetModelCopyJobResponse(Boto3Model):
jobArn: str
"""
The Amazon Resource Name (ARN) of the model copy job.
"""
status: Literal["InProgress", "Completed", "Failed"]
"""
The status of the model copy job.
"""
creationTime: datetime
"""
The time at which the model copy job was created.
"""
targetModelArn: str
"""
The Amazon Resource Name (ARN) of the copied model.
"""
targetModelName: "str | None" = None
"""
The name of the copied model.
"""
sourceAccountId: str
"""
The unique identifier of the account that the model being copied originated from.
"""
sourceModelArn: str
"""
The Amazon Resource Name (ARN) of the original model being copied.
"""
targetModelKmsKeyArn: "str | None" = None
"""
The Amazon Resource Name (ARN) of the KMS key encrypting the copied model.
"""
targetModelTags: "builtins.list[Tag] | None" = Field(default_factory=list)
"""
The tags associated with the copied model.
"""
failureMessage: "str | None" = None
"""
An error message for why the model copy job failed.
"""
sourceModelName: "str | None" = None
"""
The name of the original model being copied.
"""
[docs]class ListModelCopyJobsResponse(Boto3Model):
modelCopyJobSummaries: "builtins.list[ModelCopyJob] | None" = Field(
default_factory=list
)
"""
A list of information about each model copy job.
"""
nextToken: "str | None" = None
"""
If the total number of results is greater than the ``maxResults`` value provided in
the request, use this token when making another request in the ``nextToken`` field
to return the next batch of results.
"""
[docs]class CreateModelInvocationJobResponse(Boto3Model):
jobArn: str
"""
The Amazon Resource Name (ARN) of the batch inference job.
"""
[docs]class GetModelInvocationJobResponse(Boto3Model):
jobArn: str
"""
The Amazon Resource Name (ARN) of the batch inference job.
"""
jobName: "str | None" = None
"""
The name of the batch inference job.
"""
modelId: str
"""
The unique identifier of the foundation model used for model inference.
"""
clientRequestToken: "str | None" = None
"""
A unique, case-sensitive identifier to ensure that the API request completes no more
than one time.
If this token matches a previous request, Amazon Bedrock ignores the request, but
does not return an error. For more information, see
`Ensuring idempotency <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_.
"""
roleArn: str
"""
The Amazon Resource Name (ARN) of the service role with permissions to carry out and
manage batch inference.
You can use the console to create a default service role or follow the steps at
`Create a service role for batch inference <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html>`_.
"""
status: "Literal['Submitted', 'InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped', 'PartiallyCompleted', 'Expired', 'Validating', 'Scheduled'] | None" = None
"""
The status of the batch inference job.
"""
message: "str | None" = None
"""
If the batch inference job failed, this field contains a message describing why the
job failed.
"""
submitTime: datetime
"""
The time at which the batch inference job was submitted.
"""
lastModifiedTime: "datetime | None" = None
"""
The time at which the batch inference job was last modified.
"""
endTime: "datetime | None" = None
"""
The time at which the batch inference job ended.
"""
inputDataConfig: ModelInvocationJobInputDataConfig
"""
Details about the location of the input to the batch inference job.
"""
outputDataConfig: ModelInvocationJobOutputDataConfig
"""
Details about the location of the output of the batch inference job.
"""
vpcConfig: "BedrockVpcConfig | None" = None
"""
The configuration of the Virtual Private Cloud (VPC) for the data in the batch
inference job.
For more information, see
`Protect batch inference jobs using a VPC <https://docs.aws.amazon.com/bedrock/latest/userguide/batch-vpc>`_.
"""
timeoutDurationInHours: "int | None" = None
"""
The number of hours after which batch inference job was set to time out.
"""
jobExpirationTime: "datetime | None" = None
"""
The time at which the batch inference job times or timed out.
"""
modelInvocationType: "Literal['InvokeModel', 'Converse'] | None" = None
"""
The invocation endpoint for ModelInvocationJob.
"""
totalRecordCount: "int | None" = None
"""
The total number of records in the batch inference job.
"""
processedRecordCount: "int | None" = None
"""
The number of records that have been processed in the batch inference job.
"""
successRecordCount: "int | None" = None
"""
The number of records that were successfully processed in the batch inference job.
"""
errorRecordCount: "int | None" = None
"""
The number of records that failed to process in the batch inference job.
"""
[docs]class ListModelInvocationJobsResponse(Boto3Model):
invocationJobSummaries: "builtins.list[ModelInvocationJob] | None" = Field(
default_factory=list
)
"""
A list of items, each of which contains a summary about a batch inference job.
"""
nextToken: "str | None" = None
"""
If there are more results than can fit in the response, a ``nextToken`` is returned.
Use the ``nextToken`` in a request
to return the next batch of results.
"""
[docs]class StopModelInvocationJobResponse(Boto3Model):
pass
[docs]class GetModelInvocationLoggingConfigurationResponse(Boto3Model):
loggingConfig: "ModelInvocationLoggingConfiguration | None" = None
"""
The current configuration values.
"""
[docs]class PutModelInvocationLoggingConfigurationResponse(Boto3Model):
pass
[docs]class DeleteModelInvocationLoggingConfigurationResponse(Boto3Model):
pass
[docs]class BedrockPutResourcePolicyResponse(Boto3Model):
resourceArn: "str | None" = None
"""
The ARN of the Bedrock resource to which this resource policy applies.
"""
[docs]class BedrockDeleteResourcePolicyResponse(Boto3Model):
pass
[docs]class CreateMarketplaceModelEndpointResponse(Boto3Model):
marketplaceModelEndpoint: MarketplaceModelEndpoint
"""
Details about the created endpoint.
"""
[docs]class GetMarketplaceModelEndpointResponse(Boto3Model):
marketplaceModelEndpoint: "MarketplaceModelEndpoint | None" = None
"""
Details about the requested endpoint.
"""
[docs]class ListMarketplaceModelEndpointsResponse(Boto3Model):
marketplaceModelEndpoints: "builtins.list[MarketplaceModelEndpoint] | None" = Field(
default_factory=list
)
"""
An array of endpoint summaries.
"""
nextToken: "str | None" = None
"""
The token for the next set of results.
Use this token to get the next set of results.
"""
[docs]class MarketplaceModelEndpointSummary(Boto3Model):
"""
Provides a summary of an endpoint for a model from Amazon Bedrock Marketplace.
"""
endpointArn: str
"""
The Amazon Resource Name (ARN) of the endpoint.
"""
modelSourceIdentifier: str
"""
The ARN of the model from Amazon Bedrock Marketplace that is deployed on this
endpoint.
"""
status: "Literal['REGISTERED', 'INCOMPATIBLE_ENDPOINT'] | None" = None
"""
The overall status of the endpoint in Amazon Bedrock Marketplace.
"""
statusMessage: "str | None" = None
"""
Additional information about the overall status, if available.
"""
createdAt: datetime
"""
The timestamp when the endpoint was created.
"""
updatedAt: datetime
"""
The timestamp when the endpoint was last updated.
"""
[docs]class UpdateMarketplaceModelEndpointResponse(Boto3Model):
marketplaceModelEndpoint: MarketplaceModelEndpoint
"""
Details about the updated endpoint.
"""
[docs]class DeleteMarketplaceModelEndpointResponse(Boto3Model):
pass
[docs]class RegisterMarketplaceModelEndpointResponse(Boto3Model):
marketplaceModelEndpoint: MarketplaceModelEndpoint
"""
Details about the registered endpoint.
"""
[docs]class DeregisterMarketplaceModelEndpointResponse(Boto3Model):
pass
[docs]class CreateProvisionedModelThroughputResponse(Boto3Model):
provisionedModelArn: str
"""
The Amazon Resource Name (ARN) for this Provisioned Throughput.
"""
[docs]class GetProvisionedModelThroughputResponse(Boto3Model):
modelUnits: int
"""
The number of model units allocated to this Provisioned Throughput.
"""
desiredModelUnits: int
"""
The number of model units that was requested for this Provisioned Throughput.
"""
provisionedModelName: str
"""
The name of the Provisioned Throughput.
"""
provisionedModelArn: str
"""
The Amazon Resource Name (ARN) of the Provisioned Throughput.
"""
modelArn: str
"""
The Amazon Resource Name (ARN) of the model associated with this Provisioned
Throughput.
"""
desiredModelArn: str
"""
The Amazon Resource Name (ARN) of the model requested to be associated to this
Provisioned Throughput.
This value
differs from the ``modelArn`` if updating hasn't completed.
"""
foundationModelArn: str
"""
The Amazon Resource Name (ARN) of the base model for which the Provisioned
Throughput was created, or of the base model that the custom model for which the
Provisioned Throughput was created was customized.
"""
status: Literal["Creating", "InService", "Updating", "Failed"]
"""
The status of the Provisioned Throughput.
"""
creationTime: datetime
"""
The timestamp of the creation time for this Provisioned Throughput.
"""
lastModifiedTime: datetime
"""
The timestamp of the last time that this Provisioned Throughput was modified.
"""
failureMessage: "str | None" = None
"""
A failure message for any issues that occurred during creation, updating, or
deletion of the Provisioned Throughput.
"""
commitmentDuration: "Literal['OneMonth', 'SixMonths'] | None" = None
"""
Commitment duration of the Provisioned Throughput.
"""
commitmentExpirationTime: "datetime | None" = None
"""
The timestamp for when the commitment term for the Provisioned Throughput expires.
"""
[docs]class ListProvisionedModelThroughputsResponse(Boto3Model):
provisionedModelSummaries: "builtins.list[ProvisionedModelThroughput] | None" = Field(
default_factory=list
)
"""
A list of summaries, one for each Provisioned Throughput in the response.
"""
nextToken: "str | None" = None
"""
If there are more results than the number you specified in the ``maxResults`` field,
this value is returned.
To see the
next batch of results, include this value in the ``nextToken`` field in another list request.
"""
[docs]class DeleteProvisionedModelThroughputResponse(Boto3Model):
pass