Documentation
¶
Overview ¶
The CDK Construct Library for Amazon Bedrock
Index ¶
- func AgentAliasBase_IsConstruct(x interface{}) *bool
- func AgentAliasBase_IsOwnedResource(construct constructs.IConstruct) *bool
- func AgentAliasBase_IsResource(construct constructs.IConstruct) *bool
- func AgentAlias_IsConstruct(x interface{}) *bool
- func AgentAlias_IsOwnedResource(construct constructs.IConstruct) *bool
- func AgentAlias_IsResource(construct constructs.IConstruct) *bool
- func AgentAlias_PROPERTY_INJECTION_ID() *string
- func AgentBase_IsConstruct(x interface{}) *bool
- func AgentBase_IsOwnedResource(construct constructs.IConstruct) *bool
- func AgentBase_IsResource(construct constructs.IConstruct) *bool
- func Agent_IsConstruct(x interface{}) *bool
- func Agent_IsOwnedResource(construct constructs.IConstruct) *bool
- func Agent_IsResource(construct constructs.IConstruct) *bool
- func Agent_PROPERTY_INJECTION_ID() *string
- func ApplicationInferenceProfile_IsConstruct(x interface{}) *bool
- func ApplicationInferenceProfile_IsOwnedResource(construct constructs.IConstruct) *bool
- func ApplicationInferenceProfile_IsResource(construct constructs.IConstruct) *bool
- func ApplicationInferenceProfile_PROPERTY_INJECTION_ID() *string
- func GuardrailBase_IsConstruct(x interface{}) *bool
- func GuardrailBase_IsOwnedResource(construct constructs.IConstruct) *bool
- func GuardrailBase_IsResource(construct constructs.IConstruct) *bool
- func GuardrailBase_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func GuardrailBase_MetricAllInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func GuardrailBase_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func GuardrailBase_MetricAllInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func GuardrailBase_MetricAllTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_IsConstruct(x interface{}) *bool
- func Guardrail_IsOwnedResource(construct constructs.IConstruct) *bool
- func Guardrail_IsResource(construct constructs.IConstruct) *bool
- func Guardrail_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_MetricAllInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_MetricAllInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_MetricAllTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func Guardrail_PROPERTY_INJECTION_ID() *string
- func InferenceProfileBase_IsConstruct(x interface{}) *bool
- func InferenceProfileBase_IsOwnedResource(construct constructs.IConstruct) *bool
- func InferenceProfileBase_IsResource(construct constructs.IConstruct) *bool
- func NewAgentActionGroup_Override(a AgentActionGroup, props *AgentActionGroupProps)
- func NewAgentAliasBase_Override(a AgentAliasBase, scope constructs.Construct, id *string, ...)
- func NewAgentAlias_Override(a AgentAlias, scope constructs.Construct, id *string, props *AgentAliasProps)
- func NewAgentBase_Override(a AgentBase, scope constructs.Construct, id *string, ...)
- func NewAgentCollaboration_Override(a AgentCollaboration, config *AgentCollaborationConfig)
- func NewAgentCollaborator_Override(a AgentCollaborator, props *AgentCollaboratorProps)
- func NewAgent_Override(a Agent, scope constructs.Construct, id *string, props *AgentProps)
- func NewApiSchema_Override(a ApiSchema, s3File *awss3.Location, inlineSchema *string)
- func NewApplicationInferenceProfile_Override(a ApplicationInferenceProfile, scope constructs.Construct, id *string, ...)
- func NewAssetApiSchema_Override(a AssetApiSchema, path *string, options *awss3assets.AssetOptions)
- func NewBedrockFoundationModel_Override(b BedrockFoundationModel, value *string, props *BedrockFoundationModelProps)
- func NewChatMessage_Override(c ChatMessage, role ChatMessageRole, text *string)
- func NewFunctionParameter_Override(f FunctionParameter, props *FunctionParameterProps)
- func NewFunctionSchema_Override(f FunctionSchema, props *FunctionSchemaProps)
- func NewFunction_Override(f Function, props *FunctionProps)
- func NewGuardrailBase_Override(g GuardrailBase, scope constructs.Construct, id *string, ...)
- func NewGuardrail_Override(g Guardrail, scope constructs.Construct, id *string, props *GuardrailProps)
- func NewInferenceProfileBase_Override(i InferenceProfileBase, scope constructs.Construct, id *string, ...)
- func NewInlineApiSchema_Override(i InlineApiSchema, schema *string)
- func NewMemory_Override(m Memory, props *SessionSummaryMemoryProps)
- func NewPIIType_Override(p PIIType, value *string)
- func NewParentActionGroupSignature_Override(p ParentActionGroupSignature, value *string)
- func NewPromptBase_Override(p PromptBase, scope constructs.Construct, id *string, ...)
- func NewPromptGenAiResource_Override(p PromptGenAiResource)
- func NewPromptInferenceConfiguration_Override(p PromptInferenceConfiguration)
- func NewPromptRouter_Override(p PromptRouter, props *PromptRouterProps, region *string)
- func NewPromptTemplateConfiguration_Override(p PromptTemplateConfiguration)
- func NewPromptVersion_Override(p PromptVersion, scope constructs.Construct, id *string, ...)
- func NewPrompt_Override(p Prompt, scope constructs.Construct, id *string, props *PromptProps)
- func NewS3ApiSchema_Override(s S3ApiSchema, location *awss3.Location)
- func NewToolChoice_Override(t ToolChoice, any interface{}, auto interface{}, tool *string)
- func NewTool_Override(t Tool)
- func NewTopic_Override(t Topic, props *CustomTopicProps)
- func PromptBase_IsConstruct(x interface{}) *bool
- func PromptBase_IsOwnedResource(construct constructs.IConstruct) *bool
- func PromptBase_IsResource(construct constructs.IConstruct) *bool
- func PromptVersion_IsConstruct(x interface{}) *bool
- func Prompt_IsConstruct(x interface{}) *bool
- func Prompt_IsOwnedResource(construct constructs.IConstruct) *bool
- func Prompt_IsResource(construct constructs.IConstruct) *bool
- func Prompt_PROPERTY_INJECTION_ID() *string
- type ActionGroupExecutor
- type Agent
- type AgentActionGroup
- type AgentActionGroupProps
- type AgentAlias
- type AgentAliasAttributes
- type AgentAliasBase
- type AgentAliasProps
- type AgentAttributes
- type AgentBase
- type AgentCollaboration
- type AgentCollaborationConfig
- type AgentCollaborator
- type AgentCollaboratorProps
- type AgentCollaboratorType
- type AgentGenAiResourceProps
- type AgentPromptVariantProps
- type AgentProps
- type AgentStepType
- type ApiSchema
- type ApplicationInferenceProfile
- type ApplicationInferenceProfileAttributes
- type ApplicationInferenceProfileProps
- type AssetApiSchema
- func ApiSchema_FromLocalAsset(path *string) AssetApiSchema
- func AssetApiSchema_FromLocalAsset(path *string) AssetApiSchema
- func InlineApiSchema_FromLocalAsset(path *string) AssetApiSchema
- func NewAssetApiSchema(path *string, options *awss3assets.AssetOptions) AssetApiSchema
- func S3ApiSchema_FromLocalAsset(path *string) AssetApiSchema
- type BedrockFoundationModel
- func BedrockFoundationModel_AI21_JAMBA_1_5_LARGE_V1() BedrockFoundationModel
- func BedrockFoundationModel_AI21_JAMBA_1_5_MINI_V1() BedrockFoundationModel
- func BedrockFoundationModel_AI21_JAMBA_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_NOVA_LITE_V1() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_NOVA_MICRO_V1() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_NOVA_PREMIER_V1() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_NOVA_PRO_V1() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_TITAN_PREMIER_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_AMAZON_TITAN_TEXT_EXPRESS_V1() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_HAIKU_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_7_SONNET_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_4_5_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_INSTANT_V1_2() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_1_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_5_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_6_V1() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_7() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_5_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_6() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2() BedrockFoundationModel
- func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2_1() BedrockFoundationModel
- func BedrockFoundationModel_COHERE_EMBED_ENGLISH_V3() BedrockFoundationModel
- func BedrockFoundationModel_COHERE_EMBED_MULTILINGUAL_V3() BedrockFoundationModel
- func BedrockFoundationModel_DEEPSEEK_R1_V1() BedrockFoundationModel
- func BedrockFoundationModel_FromCdkFoundationModel(modelId awsbedrock.FoundationModel, props *BedrockFoundationModelProps) BedrockFoundationModel
- func BedrockFoundationModel_FromCdkFoundationModelId(modelId awsbedrock.FoundationModelIdentifier, ...) BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_1_8B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_1_70B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_2_1B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_2_3B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_2_11B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_3_3_70B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_4_MAVERICK_17B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_META_LLAMA_4_SCOUT_17B_INSTRUCT_V1() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_7B_INSTRUCT_V0() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_LARGE_2402_V1() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_LARGE_2407_V1() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_MIXTRAL_8X7B_INSTRUCT_V0() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_PIXTRAL_LARGE_2502_V1() BedrockFoundationModel
- func BedrockFoundationModel_MISTRAL_SMALL_2402_V1() BedrockFoundationModel
- func BedrockFoundationModel_TITAN_EMBED_TEXT_V1() BedrockFoundationModel
- func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_256() BedrockFoundationModel
- func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_512() BedrockFoundationModel
- func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_1024() BedrockFoundationModel
- func NewBedrockFoundationModel(value *string, props *BedrockFoundationModelProps) BedrockFoundationModel
- type BedrockFoundationModelProps
- type CanadaSpecificPIIType
- type ChatMessage
- type ChatMessageRole
- type ChatPromptVariantProps
- type ChatTemplateConfigurationProps
- type CommonPromptVariantProps
- type ContentFilter
- type ContentFilterStrength
- type ContentFilterType
- type ContextualGroundingFilter
- type ContextualGroundingFilterType
- type CrossRegionInferenceProfile
- type CrossRegionInferenceProfileProps
- type CrossRegionInferenceProfileRegion
- type CustomControl
- type CustomOrchestrationExecutor
- type CustomParserProps
- type CustomTopicProps
- type DefaultPromptRouterIdentifier
- type FinancePIIType
- func FinancePIIType_CREDIT_DEBIT_CARD_CVV() FinancePIIType
- func FinancePIIType_CREDIT_DEBIT_CARD_EXPIRY() FinancePIIType
- func FinancePIIType_CREDIT_DEBIT_CARD_NUMBER() FinancePIIType
- func FinancePIIType_INTERNATIONAL_BANK_ACCOUNT_NUMBER() FinancePIIType
- func FinancePIIType_PIN() FinancePIIType
- func FinancePIIType_SWIFT_CODE() FinancePIIType
- type Function
- type FunctionParameter
- type FunctionParameterProps
- type FunctionProps
- type FunctionSchema
- type FunctionSchemaProps
- type FunctionToolProps
- type GeneralPIIType
- func GeneralPIIType_ADDRESS() GeneralPIIType
- func GeneralPIIType_AGE() GeneralPIIType
- func GeneralPIIType_DRIVER_ID() GeneralPIIType
- func GeneralPIIType_EMAIL() GeneralPIIType
- func GeneralPIIType_LICENSE_PLATE() GeneralPIIType
- func GeneralPIIType_NAME() GeneralPIIType
- func GeneralPIIType_PASSWORD() GeneralPIIType
- func GeneralPIIType_PHONE() GeneralPIIType
- func GeneralPIIType_USERNAME() GeneralPIIType
- func GeneralPIIType_VEHICLE_IDENTIFICATION_NUMBER() GeneralPIIType
- type Guardrail
- type GuardrailAction
- type GuardrailAttributes
- type GuardrailBase
- type GuardrailCrossRegionConfigProperty
- type GuardrailProps
- type IAgent
- type IAgentAlias
- type IBedrockInvokable
- type IGuardrail
- type IInferenceProfile
- type IPrompt
- type IPromptRouter
- type IPromptVariant
- type InferenceConfiguration
- type InferenceProfileBase
- type InferenceProfileType
- type InformationTechnologyPIIType
- func InformationTechnologyPIIType_AWS_ACCESS_KEY() InformationTechnologyPIIType
- func InformationTechnologyPIIType_AWS_SECRET_KEY() InformationTechnologyPIIType
- func InformationTechnologyPIIType_IP_ADDRESS() InformationTechnologyPIIType
- func InformationTechnologyPIIType_MAC_ADDRESS() InformationTechnologyPIIType
- func InformationTechnologyPIIType_URL() InformationTechnologyPIIType
- type InlineApiSchema
- func ApiSchema_FromInline(schema *string) InlineApiSchema
- func AssetApiSchema_FromInline(schema *string) InlineApiSchema
- func InlineApiSchema_FromInline(schema *string) InlineApiSchema
- func NewInlineApiSchema(schema *string) InlineApiSchema
- func S3ApiSchema_FromInline(schema *string) InlineApiSchema
- type ManagedWordFilter
- type ManagedWordFilterType
- type Memory
- type ModalityType
- type OrchestrationType
- type PIIFilter
- type PIIType
- type ParameterType
- type ParentActionGroupSignature
- type Prompt
- type PromptAttributes
- type PromptBase
- type PromptGenAiResource
- type PromptInferenceConfiguration
- type PromptInferenceConfigurationProps
- type PromptKnowledgeBaseResponseGenerationConfigCustomParser
- type PromptMemorySummarizationConfigCustomParser
- type PromptOrchestrationConfigCustomParser
- type PromptOverrideConfiguration
- type PromptPostProcessingConfigCustomParser
- type PromptPreProcessingConfigCustomParser
- type PromptProps
- type PromptRouter
- type PromptRouterProps
- type PromptRoutingClassifierConfigCustomParser
- type PromptStepConfigBase
- type PromptTemplateConfiguration
- type PromptTemplateType
- type PromptVariant
- type PromptVersion
- type PromptVersionProps
- type RegexFilter
- type RequireConfirmation
- type S3ApiSchema
- func ApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
- func AssetApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
- func InlineApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
- func NewS3ApiSchema(location *awss3.Location) S3ApiSchema
- func S3ApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
- type SessionSummaryMemoryProps
- type TextPromptVariantProps
- type TextTemplateConfigurationProps
- type TierConfig
- type Tool
- type ToolChoice
- type ToolConfiguration
- type Topic
- type UKSpecificPIIType
- type USASpecificPIIType
- func USASpecificPIIType_US_BANK_ACCOUNT_NUMBER() USASpecificPIIType
- func USASpecificPIIType_US_BANK_ROUTING_NUMBER() USASpecificPIIType
- func USASpecificPIIType_US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER() USASpecificPIIType
- func USASpecificPIIType_US_PASSPORT_NUMBER() USASpecificPIIType
- func USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER() USASpecificPIIType
- type VectorType
- type WordFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentAliasBase_IsConstruct ¶
func AgentAliasBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func AgentAliasBase_IsOwnedResource ¶
func AgentAliasBase_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func AgentAliasBase_IsResource ¶
func AgentAliasBase_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func AgentAlias_IsConstruct ¶
func AgentAlias_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func AgentAlias_IsOwnedResource ¶
func AgentAlias_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func AgentAlias_IsResource ¶
func AgentAlias_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func AgentAlias_PROPERTY_INJECTION_ID ¶
func AgentAlias_PROPERTY_INJECTION_ID() *string
func AgentBase_IsConstruct ¶
func AgentBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func AgentBase_IsOwnedResource ¶
func AgentBase_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func AgentBase_IsResource ¶
func AgentBase_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func Agent_IsConstruct ¶
func Agent_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func Agent_IsOwnedResource ¶
func Agent_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func Agent_IsResource ¶
func Agent_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func Agent_PROPERTY_INJECTION_ID ¶
func Agent_PROPERTY_INJECTION_ID() *string
func ApplicationInferenceProfile_IsConstruct ¶
func ApplicationInferenceProfile_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func ApplicationInferenceProfile_IsOwnedResource ¶
func ApplicationInferenceProfile_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func ApplicationInferenceProfile_IsResource ¶
func ApplicationInferenceProfile_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func ApplicationInferenceProfile_PROPERTY_INJECTION_ID ¶
func ApplicationInferenceProfile_PROPERTY_INJECTION_ID() *string
func GuardrailBase_IsConstruct ¶
func GuardrailBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func GuardrailBase_IsOwnedResource ¶
func GuardrailBase_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func GuardrailBase_IsResource ¶
func GuardrailBase_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func GuardrailBase_MetricAll ¶
func GuardrailBase_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the given named metric for all guardrails.
By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the `statistic` and `period` properties. Experimental.
func GuardrailBase_MetricAllInvocationLatency ¶
func GuardrailBase_MetricAllInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocation latency metric for all guardrails. Experimental.
func GuardrailBase_MetricAllInvocations ¶
func GuardrailBase_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocations metric for all guardrails. Experimental.
func GuardrailBase_MetricAllInvocationsIntervened ¶
func GuardrailBase_MetricAllInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocations intervened metric for all guardrails. Experimental.
func GuardrailBase_MetricAllTextUnitCount ¶
func GuardrailBase_MetricAllTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the text unit count metric for all guardrails. Experimental.
func Guardrail_IsConstruct ¶
func Guardrail_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func Guardrail_IsOwnedResource ¶
func Guardrail_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func Guardrail_IsResource ¶
func Guardrail_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func Guardrail_MetricAll ¶
func Guardrail_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the given named metric for all guardrails.
By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the `statistic` and `period` properties. Experimental.
func Guardrail_MetricAllInvocationLatency ¶
func Guardrail_MetricAllInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocation latency metric for all guardrails. Experimental.
func Guardrail_MetricAllInvocations ¶
func Guardrail_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocations metric for all guardrails. Experimental.
func Guardrail_MetricAllInvocationsIntervened ¶
func Guardrail_MetricAllInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the invocations intervened metric for all guardrails. Experimental.
func Guardrail_MetricAllTextUnitCount ¶
func Guardrail_MetricAllTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the text unit count metric for all guardrails. Experimental.
func Guardrail_PROPERTY_INJECTION_ID ¶
func Guardrail_PROPERTY_INJECTION_ID() *string
func InferenceProfileBase_IsConstruct ¶
func InferenceProfileBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func InferenceProfileBase_IsOwnedResource ¶
func InferenceProfileBase_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func InferenceProfileBase_IsResource ¶
func InferenceProfileBase_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func NewAgentActionGroup_Override ¶
func NewAgentActionGroup_Override(a AgentActionGroup, props *AgentActionGroupProps)
Experimental.
func NewAgentAliasBase_Override ¶
func NewAgentAliasBase_Override(a AgentAliasBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)
Experimental.
func NewAgentAlias_Override ¶
func NewAgentAlias_Override(a AgentAlias, scope constructs.Construct, id *string, props *AgentAliasProps)
Experimental.
func NewAgentBase_Override ¶
func NewAgentBase_Override(a AgentBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)
Experimental.
func NewAgentCollaboration_Override ¶
func NewAgentCollaboration_Override(a AgentCollaboration, config *AgentCollaborationConfig)
Experimental.
func NewAgentCollaborator_Override ¶
func NewAgentCollaborator_Override(a AgentCollaborator, props *AgentCollaboratorProps)
Experimental.
func NewAgent_Override ¶
func NewAgent_Override(a Agent, scope constructs.Construct, id *string, props *AgentProps)
Experimental.
func NewApiSchema_Override ¶
Experimental.
func NewApplicationInferenceProfile_Override ¶
func NewApplicationInferenceProfile_Override(a ApplicationInferenceProfile, scope constructs.Construct, id *string, props *ApplicationInferenceProfileProps)
Experimental.
func NewAssetApiSchema_Override ¶
func NewAssetApiSchema_Override(a AssetApiSchema, path *string, options *awss3assets.AssetOptions)
Experimental.
func NewBedrockFoundationModel_Override ¶
func NewBedrockFoundationModel_Override(b BedrockFoundationModel, value *string, props *BedrockFoundationModelProps)
Experimental.
func NewChatMessage_Override ¶
func NewChatMessage_Override(c ChatMessage, role ChatMessageRole, text *string)
Experimental.
func NewFunctionParameter_Override ¶
func NewFunctionParameter_Override(f FunctionParameter, props *FunctionParameterProps)
Experimental.
func NewFunctionSchema_Override ¶
func NewFunctionSchema_Override(f FunctionSchema, props *FunctionSchemaProps)
Experimental.
func NewFunction_Override ¶
func NewFunction_Override(f Function, props *FunctionProps)
Experimental.
func NewGuardrailBase_Override ¶
func NewGuardrailBase_Override(g GuardrailBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)
Experimental.
func NewGuardrail_Override ¶
func NewGuardrail_Override(g Guardrail, scope constructs.Construct, id *string, props *GuardrailProps)
Experimental.
func NewInferenceProfileBase_Override ¶
func NewInferenceProfileBase_Override(i InferenceProfileBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)
Experimental.
func NewInlineApiSchema_Override ¶
func NewInlineApiSchema_Override(i InlineApiSchema, schema *string)
Experimental.
func NewMemory_Override ¶
func NewMemory_Override(m Memory, props *SessionSummaryMemoryProps)
Experimental.
func NewPIIType_Override ¶
The string value of the PII type. Experimental.
func NewParentActionGroupSignature_Override ¶
func NewParentActionGroupSignature_Override(p ParentActionGroupSignature, value *string)
Constructor should be used as a temporary solution when a new signature is supported but its implementation in CDK hasn't been added yet. Experimental.
func NewPromptBase_Override ¶
func NewPromptBase_Override(p PromptBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)
Experimental.
func NewPromptGenAiResource_Override ¶
func NewPromptGenAiResource_Override(p PromptGenAiResource)
Experimental.
func NewPromptInferenceConfiguration_Override ¶
func NewPromptInferenceConfiguration_Override(p PromptInferenceConfiguration)
Experimental.
func NewPromptRouter_Override ¶
func NewPromptRouter_Override(p PromptRouter, props *PromptRouterProps, region *string)
Experimental.
func NewPromptTemplateConfiguration_Override ¶
func NewPromptTemplateConfiguration_Override(p PromptTemplateConfiguration)
Experimental.
func NewPromptVersion_Override ¶
func NewPromptVersion_Override(p PromptVersion, scope constructs.Construct, id *string, props *PromptVersionProps)
**************************************************************************** CONSTRUCTOR ***************************************************************************. Experimental.
func NewPrompt_Override ¶
func NewPrompt_Override(p Prompt, scope constructs.Construct, id *string, props *PromptProps)
**************************************************************************** CONSTRUCTOR ***************************************************************************. Experimental.
func NewS3ApiSchema_Override ¶
func NewS3ApiSchema_Override(s S3ApiSchema, location *awss3.Location)
Experimental.
func NewToolChoice_Override ¶
func NewToolChoice_Override(t ToolChoice, any interface{}, auto interface{}, tool *string)
Experimental.
func PromptBase_IsConstruct ¶
func PromptBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func PromptBase_IsOwnedResource ¶
func PromptBase_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func PromptBase_IsResource ¶
func PromptBase_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func PromptVersion_IsConstruct ¶
func PromptVersion_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func Prompt_IsConstruct ¶
func Prompt_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func Prompt_IsOwnedResource ¶
func Prompt_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func Prompt_IsResource ¶
func Prompt_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func Prompt_PROPERTY_INJECTION_ID ¶
func Prompt_PROPERTY_INJECTION_ID() *string
Types ¶
type ActionGroupExecutor ¶
type ActionGroupExecutor interface {
// The custom control type for the action group executor.
//
// Currently only supports 'RETURN_CONTROL' which returns results directly in the InvokeAgent response.
// Experimental.
CustomControl() CustomControl
// The Lambda function that will be called by the action group.
//
// Contains the business logic for handling the action group's invocation.
// Experimental.
LambdaFunction() awslambda.IFunction
}
Defines how fulfillment of the action group is handled after the necessary information has been elicited from the user.
Valid executors are: - Lambda function - Return Control.
Example:
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
See: https://docs.aws.amazon.com/bedrock/latest/userguide/action-handle.html
Experimental.
func ActionGroupExecutor_FromLambda ¶
func ActionGroupExecutor_FromLambda(lambdaFunction awslambda.IFunction) ActionGroupExecutor
Defines an action group with a Lambda function containing the business logic. See: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html
Experimental.
func ActionGroupExecutor_RETURN_CONTROL ¶
func ActionGroupExecutor_RETURN_CONTROL() ActionGroupExecutor
type Agent ¶
type Agent interface {
AgentBase
IAgent
// action groups associated with the ageny.
// Experimental.
ActionGroups() *[]AgentActionGroup
// The ARN of the agent.
// Experimental.
AgentArn() *string
// The unique identifier for the agent.
// Experimental.
AgentId() *string
// The version of the agent.
// Experimental.
AgentVersion() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The principal to grant permissions to.
// Experimental.
GrantPrincipal() awsiam.IPrincipal
// The guardrail that will be associated with the agent.
// Experimental.
Guardrail() IGuardrail
// Experimental.
SetGuardrail(val IGuardrail)
// Optional KMS encryption key associated with this agent.
// Experimental.
KmsKey() awskms.IKey
// When this agent was last updated.
// Experimental.
LastUpdated() *string
// The name of the agent.
// Experimental.
Name() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The IAM role associated to the agent.
// Experimental.
Role() awsiam.IRole
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Default alias of the agent.
// Experimental.
TestAlias() IAgentAlias
// Adds an action group to the agent and configures necessary permissions.
// Default: - Default permissions:
// - Lambda function invoke permissions if executor is present
// - S3 GetObject permissions if apiSchema.s3File is present
//
// Experimental.
AddActionGroup(actionGroup AgentActionGroup)
// Configuration for agent collaboration.
// Default: - No collaboration configuration.
//
// Experimental.
AddActionGroups(actionGroups ...AgentActionGroup)
// Add guardrail to the agent.
// Experimental.
AddGuardrail(guardrail IGuardrail)
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Generates a physical name for the agent.
//
// Returns: A unique name for the agent with appropriate length constraints.
// Default: - Generated name format: 'agent-{hash}-{uniqueName}' with:
// - maxLength: MAXLENGTH_FOR_ROLE_NAME - '-bedrockagent'.length
// - lower: true
// - separator: '-'.
//
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant invoke permissions on this agent to an IAM principal.
//
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Default: - Default grant configuration:
// - actions: ['bedrock:InvokeAgent']
// - resourceArns: [this.agentArn]
//
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Creates a CloudWatch metric for tracking agent invocations.
//
// Returns: A CloudWatch Metric configured for agent invocation counts.
// Default: - Default metric configuration:
// - namespace: 'AWS/Bedrock'
// - metricName: 'Invocations'
// - dimensionsMap: { AgentId: this.agentId }
//
// Experimental.
MetricCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Creates an EventBridge rule for agent events.
//
// Returns: An EventBridge Rule configured for agent events.
// Default: - Default event pattern:
// - source: ['aws.bedrock']
// - detail: { 'agent-id': [this.agentId] }
//
// Experimental.
OnEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create (or import) an Agent with CDK.
Example:
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda")),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
Parser: parserFunction,
PreProcessingStep: &PromptPreProcessingConfigCustomParser{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
UseCustomParser: jsii.Boolean(true),
},
}),
})
Experimental.
func NewAgent ¶
func NewAgent(scope constructs.Construct, id *string, props *AgentProps) Agent
Experimental.
type AgentActionGroup ¶
type AgentActionGroup interface {
// The api schema for this action group (if defined).
// Experimental.
ApiSchema() ApiSchema
// A description of the action group.
// Experimental.
Description() *string
// Whether this action group is available for the agent to invoke or not.
// Experimental.
Enabled() *bool
// The action group executor for this action group (if defined).
// Experimental.
Executor() ActionGroupExecutor
// Whether to delete the resource even if it's in use.
// Experimental.
ForceDelete() *bool
// The function schema for this action group (if defined).
// Experimental.
FunctionSchema() FunctionSchema
// The name of the action group.
// Experimental.
Name() *string
// The AWS Defined signature (if defined).
// Experimental.
ParentActionGroupSignature() ParentActionGroupSignature
}
**************************************************************************** DEF - Action Group Class ***************************************************************************.
Example:
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
func AgentActionGroup_CodeInterpreter ¶
func AgentActionGroup_CodeInterpreter(enabled *bool) AgentActionGroup
Defines an action group that allows your agent to request the user for additional information when trying to complete a task. Experimental.
func AgentActionGroup_UserInput ¶
func AgentActionGroup_UserInput(enabled *bool) AgentActionGroup
Defines an action group that allows your agent to request the user for additional information when trying to complete a task. Experimental.
func NewAgentActionGroup ¶
func NewAgentActionGroup(props *AgentActionGroupProps) AgentActionGroup
Experimental.
type AgentActionGroupProps ¶
type AgentActionGroupProps struct {
// The API Schema defining the functions available to the agent.
// Default: undefined - No API Schema is provided.
//
// Experimental.
ApiSchema ApiSchema `field:"optional" json:"apiSchema" yaml:"apiSchema"`
// A description of the action group.
// Default: undefined - No description is provided.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// Specifies whether the action group is available for the agent to invoke or not when sending an InvokeAgent request.
// Default: true - The action group is enabled.
//
// Experimental.
Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
// The action group executor that implements the API functions.
// Default: undefined - No executor is provided.
//
// Experimental.
Executor ActionGroupExecutor `field:"optional" json:"executor" yaml:"executor"`
// Specifies whether to delete the resource even if it's in use.
// Default: false - The resource will not be deleted if it's in use.
//
// Experimental.
ForceDelete *bool `field:"optional" json:"forceDelete" yaml:"forceDelete"`
// Defines functions that each define parameters that the agent needs to invoke from the user.
//
// NO L2 yet as this doesn't make much sense IMHO.
// Default: undefined - No function schema is provided.
//
// Experimental.
FunctionSchema FunctionSchema `field:"optional" json:"functionSchema" yaml:"functionSchema"`
// The name of the action group.
// Default: - A unique name is generated in the format 'action_group_quick_start_UUID'.
//
// Experimental.
Name *string `field:"optional" json:"name" yaml:"name"`
// The AWS Defined signature for enabling certain capabilities in your agent.
//
// When this property is specified, you must leave the description, apiSchema,
// and actionGroupExecutor fields blank for this action group.
// Default: undefined - No parent action group signature is provided.
//
// Experimental.
ParentActionGroupSignature ParentActionGroupSignature `field:"optional" json:"parentActionGroupSignature" yaml:"parentActionGroupSignature"`
}
**************************************************************************** PROPS - Action Group Class ***************************************************************************.
Example:
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
type AgentAlias ¶
type AgentAlias interface {
AgentAliasBase
// The underlying agent for this alias.
// Experimental.
Agent() IAgent
// The ARN of the agent alias.
// Experimental.
AliasArn() *string
// The unique identifier of the agent alias.
// Experimental.
AliasId() *string
// The name of the agent alias.
//
// This is either provided by the user or generated from a hash.
// Experimental.
AliasName() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given principal identity permissions to perform actions on this agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account grant is not supported.
// [disable-awslint:no-grants].
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to get the agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account agent read is not supported.
// [disable-awslint:no-grants].
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Grant the given identity permissions to invoke the agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account invocation is not supported.
// [disable-awslint:no-grants].
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Define an EventBridge rule that triggers when something happens to this agent alias.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
OnCloudTrailEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create an Agent Alias with CDK.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
func NewAgentAlias ¶
func NewAgentAlias(scope constructs.Construct, id *string, props *AgentAliasProps) AgentAlias
Experimental.
type AgentAliasAttributes ¶
type AgentAliasAttributes struct {
// The underlying agent for this alias.
// Experimental.
Agent IAgent `field:"required" json:"agent" yaml:"agent"`
// The agent version for this alias.
// Experimental.
AgentVersion *string `field:"required" json:"agentVersion" yaml:"agentVersion"`
// The Id of the agent alias.
// Experimental.
AliasId *string `field:"required" json:"aliasId" yaml:"aliasId"`
// The name of the agent alias.
// Default: undefined - No alias name is provided.
//
// Experimental.
AliasName *string `field:"optional" json:"aliasName" yaml:"aliasName"`
}
Attributes needed to create an import.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
// Assuming you have an existing agent and alias
agent := bedrock.Agent_FromAgentAttributes(this, jsii.String("ImportedAgent"), &AgentAttributes{
AgentArn: jsii.String("arn:aws:bedrock:region:account:agent/agent-id"),
RoleArn: jsii.String("arn:aws:iam::account:role/agent-role"),
})
agentAlias := bedrock.AgentAlias_FromAttributes(this, jsii.String("ImportedAlias"), &AgentAliasAttributes{
AliasId: jsii.String("alias-id"),
AliasName: jsii.String("my-alias"),
AgentVersion: jsii.String("1"),
Agent: agent,
})
agentVariant := bedrock.PromptVariant_Agent(&AgentPromptVariantProps{
VariantName: jsii.String("agent-variant"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
AgentAlias: agentAlias,
PromptText: jsii.String("Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations."),
PromptVariables: []*string{
jsii.String("task"),
},
})
bedrock.NewPrompt(this, jsii.String("agentPrompt"), &PromptProps{
PromptName: jsii.String("agent-prompt"),
Description: jsii.String("Prompt for agent interactions"),
DefaultVariant: agentVariant,
Variants: []IPromptVariant{
agentVariant,
},
KmsKey: cmk,
})
Experimental.
type AgentAliasBase ¶
type AgentAliasBase interface {
awscdk.Resource
IAgentAlias
// The underlying agent for this alias.
// Experimental.
Agent() IAgent
// The ARN of the agent alias.
// Experimental.
AliasArn() *string
// The unique identifier of the agent alias.
// Experimental.
AliasId() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given principal identity permissions to perform actions on this agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account grant is not supported.
// [disable-awslint:no-grants].
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to get the agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account agent read is not supported.
// [disable-awslint:no-grants].
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Grant the given identity permissions to invoke the agent alias.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent alias is defined. Cross-account invocation is not supported.
// [disable-awslint:no-grants].
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Define an EventBridge rule that triggers when something happens to this agent alias.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
OnCloudTrailEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Abstract base class for an Agent.
Contains methods and attributes valid for Agents either created with CDK or imported. Experimental.
type AgentAliasProps ¶
type AgentAliasProps struct {
// The agent associated to this alias.
// Experimental.
Agent IAgent `field:"required" json:"agent" yaml:"agent"`
// The name for the agent alias.
//
// This will be used as the physical name of the agent alias.
// Default: "latest".
//
// Experimental.
AgentAliasName *string `field:"optional" json:"agentAliasName" yaml:"agentAliasName"`
// The version of the agent to associate with the agent alias.
// Default: - Creates a new version of the agent.
//
// Experimental.
AgentVersion *string `field:"optional" json:"agentVersion" yaml:"agentVersion"`
// Description for the agent alias.
// Default: undefined - No description is provided.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
}
Properties for creating a CDK-Managed Agent Alias.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
type AgentAttributes ¶
type AgentAttributes struct {
// The ARN of the agent.
// Experimental.
AgentArn *string `field:"required" json:"agentArn" yaml:"agentArn"`
// The ARN of the IAM role associated to the agent.
// Experimental.
RoleArn *string `field:"required" json:"roleArn" yaml:"roleArn"`
// The agent version.
//
// If no explicit versions have been created,
// leave this empty to use the DRAFT version. Otherwise, use the
// version number (e.g. 1).
// Default: 'DRAFT'.
//
// Experimental.
AgentVersion *string `field:"optional" json:"agentVersion" yaml:"agentVersion"`
// Optional KMS encryption key associated with this agent.
// Default: undefined - An AWS managed key is used.
//
// Experimental.
KmsKeyArn *string `field:"optional" json:"kmsKeyArn" yaml:"kmsKeyArn"`
// When this agent was last updated.
// Default: undefined - No last updated timestamp is provided.
//
// Experimental.
LastUpdated *string `field:"optional" json:"lastUpdated" yaml:"lastUpdated"`
}
Attributes for specifying an imported Bedrock Agent.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
// Assuming you have an existing agent and alias
agent := bedrock.Agent_FromAgentAttributes(this, jsii.String("ImportedAgent"), &AgentAttributes{
AgentArn: jsii.String("arn:aws:bedrock:region:account:agent/agent-id"),
RoleArn: jsii.String("arn:aws:iam::account:role/agent-role"),
})
agentAlias := bedrock.AgentAlias_FromAttributes(this, jsii.String("ImportedAlias"), &AgentAliasAttributes{
AliasId: jsii.String("alias-id"),
AliasName: jsii.String("my-alias"),
AgentVersion: jsii.String("1"),
Agent: agent,
})
agentVariant := bedrock.PromptVariant_Agent(&AgentPromptVariantProps{
VariantName: jsii.String("agent-variant"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
AgentAlias: agentAlias,
PromptText: jsii.String("Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations."),
PromptVariables: []*string{
jsii.String("task"),
},
})
bedrock.NewPrompt(this, jsii.String("agentPrompt"), &PromptProps{
PromptName: jsii.String("agent-prompt"),
Description: jsii.String("Prompt for agent interactions"),
DefaultVariant: agentVariant,
Variants: []IPromptVariant{
agentVariant,
},
KmsKey: cmk,
})
Experimental.
type AgentBase ¶
type AgentBase interface {
awscdk.Resource
IAgent
// The ARN of the agent.
// Experimental.
AgentArn() *string
// The ID of the Agent.
// Experimental.
AgentId() *string
// The version of the agent.
// Experimental.
AgentVersion() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The principal to grant permissions to.
// Experimental.
GrantPrincipal() awsiam.IPrincipal
// Optional KMS encryption key associated with this agent.
// Experimental.
KmsKey() awskms.IKey
// When this agent was last updated.
// Experimental.
LastUpdated() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The IAM role associated to the agent.
// Experimental.
Role() awsiam.IRole
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant invoke permissions on this agent to an IAM principal.
//
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Default: - Default grant configuration:
// - actions: ['bedrock:InvokeAgent']
// - resourceArns: [this.agentArn]
//
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Creates a CloudWatch metric for tracking agent invocations.
//
// Returns: A CloudWatch Metric configured for agent invocation counts.
// Default: - Default metric configuration:
// - namespace: 'AWS/Bedrock'
// - metricName: 'Invocations'
// - dimensionsMap: { AgentId: this.agentId }
//
// Experimental.
MetricCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Creates an EventBridge rule for agent events.
//
// Returns: An EventBridge Rule configured for agent events.
// Default: - Default event pattern:
// - source: ['aws.bedrock']
// - detail: { 'agent-id': [this.agentId] }
//
// Experimental.
OnEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Abstract base class for an Agent.
Contains methods and attributes valid for Agents either created with CDK or imported. Experimental.
type AgentCollaboration ¶
type AgentCollaboration interface {
// Collaborators that this agent will work with.
// Experimental.
Collaborators() *[]AgentCollaborator
// The collaboration type for the agent.
// Experimental.
Type() AgentCollaboratorType
}
Class to manage agent collaboration configuration.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
func NewAgentCollaboration ¶
func NewAgentCollaboration(config *AgentCollaborationConfig) AgentCollaboration
Experimental.
type AgentCollaborationConfig ¶
type AgentCollaborationConfig struct {
// Collaborators that this agent will work with.
// Experimental.
Collaborators *[]AgentCollaborator `field:"required" json:"collaborators" yaml:"collaborators"`
// The collaboration type for the agent.
// Experimental.
Type AgentCollaboratorType `field:"required" json:"type" yaml:"type"`
}
Configuration for agent collaboration settings.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var agentCollaborator AgentCollaborator
agentCollaborationConfig := &AgentCollaborationConfig{
Collaborators: []AgentCollaborator{
agentCollaborator,
},
Type: bedrock_alpha.AgentCollaboratorType_SUPERVISOR,
}
Experimental.
type AgentCollaborator ¶
type AgentCollaborator interface {
// The agent alias that this collaborator represents.
//
// This is the agent that will be called upon for collaboration.
// Experimental.
AgentAlias() IAgentAlias
// Instructions on how this agent should collaborate with the main agent.
// Experimental.
CollaborationInstruction() *string
// A friendly name for the collaborator.
// Experimental.
CollaboratorName() *string
// Whether to relay conversation history to this collaborator.
// Default: - undefined (uses service default).
//
// Experimental.
RelayConversationHistory() *bool
// Grants the given identity permissions to collaborate with the agent [disable-awslint:no-grants].
//
// Returns: The Grant object.
// Experimental.
Grant(grantee awsiam.IGrantable) awsiam.Grant
}
**************************************************************************** Agent Collaborator Class ***************************************************************************.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
func NewAgentCollaborator ¶
func NewAgentCollaborator(props *AgentCollaboratorProps) AgentCollaborator
Experimental.
type AgentCollaboratorProps ¶
type AgentCollaboratorProps struct {
// Descriptor for the collaborating agent.
//
// This cannot be the TSTALIASID (`agent.testAlias`).
// Experimental.
AgentAlias IAgentAlias `field:"required" json:"agentAlias" yaml:"agentAlias"`
// Instructions on how this agent should collaborate with the main agent.
// Experimental.
CollaborationInstruction *string `field:"required" json:"collaborationInstruction" yaml:"collaborationInstruction"`
// A friendly name for the collaborator.
// Experimental.
CollaboratorName *string `field:"required" json:"collaboratorName" yaml:"collaboratorName"`
// Whether to relay conversation history to this collaborator.
// Default: - undefined (uses service default).
//
// Experimental.
RelayConversationHistory *bool `field:"optional" json:"relayConversationHistory" yaml:"relayConversationHistory"`
}
**************************************************************************** PROPS - Agent Collaborator Class ***************************************************************************.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
type AgentCollaboratorType ¶
type AgentCollaboratorType string
Enum for collaborator's relay conversation history types.
Example:
// Create a specialized agent
customerSupportAgent := bedrock.NewAgent(this, jsii.String("CustomerSupportAgent"), &AgentProps{
Instruction: jsii.String("You specialize in answering customer support questions."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
})
// Create an agent alias
customerSupportAlias := bedrock.NewAgentAlias(this, jsii.String("CustomerSupportAlias"), &AgentAliasProps{
Agent: customerSupportAgent,
AgentAliasName: jsii.String("production"),
})
// Create a main agent that collaborates with the specialized agent
mainAgent := bedrock.NewAgent(this, jsii.String("MainAgent"), &AgentProps{
Instruction: jsii.String("You route specialized questions to other agents."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
AgentCollaboration: map[string]interface{}{
"type": bedrock.AgentCollaboratorType_SUPERVISOR,
"collaborators": []AgentCollaborator{
bedrock.NewAgentCollaborator(&AgentCollaboratorProps{
"agentAlias": customerSupportAlias,
"collaborationInstruction": jsii.String("Route customer support questions to this agent."),
"collaboratorName": jsii.String("CustomerSupport"),
"relayConversationHistory": jsii.Boolean(true),
}),
},
},
})
Experimental.
const ( // Supervisor agent. // Experimental. AgentCollaboratorType_SUPERVISOR AgentCollaboratorType = "SUPERVISOR" // Disabling collaboration. // Experimental. AgentCollaboratorType_DISABLED AgentCollaboratorType = "DISABLED" // Supervisor router. // Experimental. AgentCollaboratorType_SUPERVISOR_ROUTER AgentCollaboratorType = "SUPERVISOR_ROUTER" )
type AgentGenAiResourceProps ¶
type AgentGenAiResourceProps struct {
// The agent alias to use for the GenAI resource.
// Experimental.
AgentAlias IAgentAlias `field:"required" json:"agentAlias" yaml:"agentAlias"`
}
Properties for creating an agent GenAI resource configuration.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var agentAlias AgentAlias
agentGenAiResourceProps := &AgentGenAiResourceProps{
AgentAlias: agentAlias,
}
Experimental.
type AgentPromptVariantProps ¶
type AgentPromptVariantProps struct {
// The model which is used to run the prompt.
//
// The model could be a foundation
// model, a custom model, or a provisioned model.
// Experimental.
Model IBedrockInvokable `field:"required" json:"model" yaml:"model"`
// The name of the prompt variant.
// Experimental.
VariantName *string `field:"required" json:"variantName" yaml:"variantName"`
// The variables in the prompt template that can be filled in at runtime.
// Default: - No variables defined.
//
// Experimental.
PromptVariables *[]*string `field:"optional" json:"promptVariables" yaml:"promptVariables"`
// An alias pointing to the agent version to be used.
// Experimental.
AgentAlias IAgentAlias `field:"required" json:"agentAlias" yaml:"agentAlias"`
// The text prompt.
//
// Variables are used by enclosing its name with double curly braces
// as in `{{variable_name}}`.
// Experimental.
PromptText *string `field:"required" json:"promptText" yaml:"promptText"`
}
Properties for creating an agent prompt variant.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
// Assuming you have an existing agent and alias
agent := bedrock.Agent_FromAgentAttributes(this, jsii.String("ImportedAgent"), &AgentAttributes{
AgentArn: jsii.String("arn:aws:bedrock:region:account:agent/agent-id"),
RoleArn: jsii.String("arn:aws:iam::account:role/agent-role"),
})
agentAlias := bedrock.AgentAlias_FromAttributes(this, jsii.String("ImportedAlias"), &AgentAliasAttributes{
AliasId: jsii.String("alias-id"),
AliasName: jsii.String("my-alias"),
AgentVersion: jsii.String("1"),
Agent: agent,
})
agentVariant := bedrock.PromptVariant_Agent(&AgentPromptVariantProps{
VariantName: jsii.String("agent-variant"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
AgentAlias: agentAlias,
PromptText: jsii.String("Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations."),
PromptVariables: []*string{
jsii.String("task"),
},
})
bedrock.NewPrompt(this, jsii.String("agentPrompt"), &PromptProps{
PromptName: jsii.String("agent-prompt"),
Description: jsii.String("Prompt for agent interactions"),
DefaultVariant: agentVariant,
Variants: []IPromptVariant{
agentVariant,
},
KmsKey: cmk,
})
Experimental.
type AgentProps ¶
type AgentProps struct {
// The foundation model used for orchestration by the agent.
// Experimental.
FoundationModel IBedrockInvokable `field:"required" json:"foundationModel" yaml:"foundationModel"`
// The instruction used by the agent.
//
// This determines how the agent will perform his task.
// This instruction must have a minimum of 40 characters.
// Experimental.
Instruction *string `field:"required" json:"instruction" yaml:"instruction"`
// The Action Groups associated with the agent.
// Default: - Only default action groups (UserInput and CodeInterpreter) are added.
//
// Experimental.
ActionGroups *[]AgentActionGroup `field:"optional" json:"actionGroups" yaml:"actionGroups"`
// Configuration for agent collaboration settings, including AgentCollaboratorType and AgentCollaborators.
//
// This property allows you to define how the agent collaborates with other agents
// and what collaborators it can work with.
// Default: - No agent collaboration configuration.
//
// Experimental.
AgentCollaboration AgentCollaboration `field:"optional" json:"agentCollaboration" yaml:"agentCollaboration"`
// The name of the agent.
//
// This will be used as the physical name of the agent.
// Default: - A name is generated by CDK.
// Supported pattern : ^([0-9a-zA-Z][_-]?){1,100}$
//
// Experimental.
AgentName *string `field:"optional" json:"agentName" yaml:"agentName"`
// Select whether the agent can generate, run, and troubleshoot code when trying to complete a task.
// Default: false.
//
// Experimental.
CodeInterpreterEnabled *bool `field:"optional" json:"codeInterpreterEnabled" yaml:"codeInterpreterEnabled"`
// The Lambda function to use for custom orchestration.
//
// If provided, custom orchestration will be used.
// If not provided, default orchestration will be used.
// Default: - Default orchestration.
//
// Experimental.
CustomOrchestrationExecutor CustomOrchestrationExecutor `field:"optional" json:"customOrchestrationExecutor" yaml:"customOrchestrationExecutor"`
// A description of the agent.
// Default: - No description is provided.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// An existing IAM Role to associate with this agent.
//
// Use this property when you want to reuse an existing IAM role rather than create a new one.
// The role must have a trust policy that allows the Bedrock service to assume it.
// Default: - A new role is created for you.
//
// Experimental.
ExistingRole awsiam.IRole `field:"optional" json:"existingRole" yaml:"existingRole"`
// Whether to delete the resource even if it's in use.
// Default: false.
//
// Experimental.
ForceDelete *bool `field:"optional" json:"forceDelete" yaml:"forceDelete"`
// The guardrail that will be associated with the agent.
// Default: - No guardrail is provided.
//
// Experimental.
Guardrail IGuardrail `field:"optional" json:"guardrail" yaml:"guardrail"`
// How long sessions should be kept open for the agent.
//
// If no conversation occurs
// during this time, the session expires and Amazon Bedrock deletes any data
// provided before the timeout.
// Default: - 10 minutes.
//
// Experimental.
IdleSessionTTL awscdk.Duration `field:"optional" json:"idleSessionTTL" yaml:"idleSessionTTL"`
// The KMS key of the agent if custom encryption is configured.
// Default: - An AWS managed key is used.
//
// Experimental.
KmsKey awskms.IKey `field:"optional" json:"kmsKey" yaml:"kmsKey"`
// The type and configuration of the memory to maintain context across multiple sessions and recall past interactions.
//
// This can be useful for maintaining continuity in multi-turn conversations and recalling user preferences
// or past interactions.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-memory.html
//
// Default: - No memory will be used. Agents will retain context from the current session only.
//
// Experimental.
Memory Memory `field:"optional" json:"memory" yaml:"memory"`
// Overrides some prompt templates in different parts of an agent sequence configuration.
// Default: - No overrides are provided.
//
// Experimental.
PromptOverrideConfiguration PromptOverrideConfiguration `field:"optional" json:"promptOverrideConfiguration" yaml:"promptOverrideConfiguration"`
// Specifies whether to automatically update the `DRAFT` version of the agent after making changes to the agent.
//
// The `DRAFT` version can be continually iterated
// upon during internal development.
// Default: false.
//
// Experimental.
ShouldPrepareAgent *bool `field:"optional" json:"shouldPrepareAgent" yaml:"shouldPrepareAgent"`
// Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance.
// Default: false.
//
// Experimental.
UserInputEnabled *bool `field:"optional" json:"userInputEnabled" yaml:"userInputEnabled"`
}
Properties for creating a CDK managed Bedrock Agent.
TODO: Knowledge bases configuration will be added in a future update TODO: Inference profile configuration will be added in a future update.
Example:
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda")),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
Parser: parserFunction,
PreProcessingStep: &PromptPreProcessingConfigCustomParser{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
UseCustomParser: jsii.Boolean(true),
},
}),
})
Experimental.
type AgentStepType ¶
type AgentStepType string
The step in the agent sequence that this prompt configuration applies to.
Example:
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_FromSteps([]PromptStepConfigBase{
&PromptRoutingClassifierConfigCustomParser{
StepType: bedrock.AgentStepType_ROUTING_CLASSIFIER,
StepEnabled: jsii.Boolean(true),
CustomPromptTemplate: jsii.String("Your routing template here"),
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_V2(),
}.(PromptRoutingClassifierConfigCustomParser),
}),
})
Experimental.
const ( // Pre-processing step that prepares the user input for orchestration. // Experimental. AgentStepType_PRE_PROCESSING AgentStepType = "PRE_PROCESSING" // Main orchestration step that determines the agent's actions. // Experimental. AgentStepType_ORCHESTRATION AgentStepType = "ORCHESTRATION" // Post-processing step that refines the agent's response. // Experimental. AgentStepType_POST_PROCESSING AgentStepType = "POST_PROCESSING" // Step that classifies and routes requests to appropriate collaborators. // Experimental. AgentStepType_ROUTING_CLASSIFIER AgentStepType = "ROUTING_CLASSIFIER" // Step that summarizes conversation history for memory retention. // Experimental. AgentStepType_MEMORY_SUMMARIZATION AgentStepType = "MEMORY_SUMMARIZATION" // Step that generates responses using knowledge base content. // Experimental. AgentStepType_KNOWLEDGE_BASE_RESPONSE_GENERATION AgentStepType = "KNOWLEDGE_BASE_RESPONSE_GENERATION" )
type ApiSchema ¶
type ApiSchema interface {
// The inline OpenAPI schema definition as a string, if using an inline schema.
//
// Can be in JSON or YAML format.
// Experimental.
InlineSchema() *string
// The S3 location of the API schema file, if using an S3-based schema.
//
// Contains the bucket name and object key information.
// Experimental.
S3File() *awss3.Location
}
Represents the concept of an API Schema for a Bedrock Agent Action Group.
Example:
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
type ApplicationInferenceProfile ¶
type ApplicationInferenceProfile interface {
InferenceProfileBase
IBedrockInvokable
// Time Stamp for Application Inference Profile creation.
// Experimental.
CreatedAt() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The ARN of the application inference profile.
// Experimental.
InferenceProfileArn() *string
// The unique identifier of the application inference profile.
// Experimental.
InferenceProfileId() *string
// The underlying model/cross-region model used by the application inference profile.
// Experimental.
InferenceProfileModel() IBedrockInvokable
// The name of the application inference profile.
// Experimental.
InferenceProfileName() *string
// The ARN used for invoking this inference profile.
//
// This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
// Experimental.
InvokableArn() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// The status of the application inference profile.
//
// ACTIVE means that the inference profile is ready to be used.
// Experimental.
Status() *string
// The type of the inference profile.
//
// Always APPLICATION for application inference profiles.
// Experimental.
Type() InferenceProfileType
// Time Stamp for Application Inference Profile update.
// Experimental.
UpdatedAt() *string
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Gives the appropriate policies to invoke and use the application inference profile.
//
// This method ensures the appropriate permissions are given to use either the inference profile
// or the underlying foundation model/cross-region profile.
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Grants appropriate permissions to use the application inference profile (AIP).
//
// This method adds the necessary IAM permissions to allow the grantee to:
// - Get inference profile details (bedrock:GetInferenceProfile)
// - Invoke the model through the inference profile (bedrock:InvokeModel)
//
// Note: This does not grant permissions to use the underlying model/cross-region profile in the AIP.
// For comprehensive permissions, use grantInvoke() instead.
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantProfileUsage(grantee awsiam.IGrantable) awsiam.Grant
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create an Application Inference Profile with CDK.
These are inference profiles created by users (user defined). This helps to track costs and model usage.
Application inference profiles are user-defined profiles that help you track costs and model usage. They can be created for a single region or for multiple regions using a cross-region inference profile.
Example:
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0(),
})
// Create an application inference profile across regions
appProfile := bedrock.NewApplicationInferenceProfile(this, jsii.String("MyMultiRegionProfile"), &ApplicationInferenceProfileProps{
ApplicationInferenceProfileName: jsii.String("claude-35-sonnet-v2-multi-region"),
ModelSource: crossRegionProfile,
Description: jsii.String("Multi-region application profile for cost tracking"),
})
See: https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-create.html
Experimental.
func NewApplicationInferenceProfile ¶
func NewApplicationInferenceProfile(scope constructs.Construct, id *string, props *ApplicationInferenceProfileProps) ApplicationInferenceProfile
Experimental.
type ApplicationInferenceProfileAttributes ¶
type ApplicationInferenceProfileAttributes struct {
// The ARN of the application inference profile.
// Experimental.
InferenceProfileArn *string `field:"required" json:"inferenceProfileArn" yaml:"inferenceProfileArn"`
// The ID or Amazon Resource Name (ARN) of the inference profile.
//
// This can be either the profile ID or the full ARN.
// Experimental.
InferenceProfileIdentifier *string `field:"required" json:"inferenceProfileIdentifier" yaml:"inferenceProfileIdentifier"`
}
Attributes for specifying an imported Application Inference Profile.
Example:
// Import an inference profile through attributes
importedProfile := bedrock.ApplicationInferenceProfile_FromApplicationInferenceProfileAttributes(this, jsii.String("ImportedProfile"), &ApplicationInferenceProfileAttributes{
InferenceProfileArn: jsii.String("arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/my-profile-id"),
InferenceProfileIdentifier: jsii.String("my-profile-id"),
})
Experimental.
type ApplicationInferenceProfileProps ¶
type ApplicationInferenceProfileProps struct {
// The name of the application inference profile.
//
// This name will be used to identify the inference profile in the AWS console and APIs.
// - Required: Yes
// - Maximum length: 64 characters
// - Pattern: `^([0-9a-zA-Z:.][ _-]?)+$`
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-applicationinferenceprofile.html#cfn-bedrock-applicationinferenceprofile-inferenceprofilename
//
// Experimental.
ApplicationInferenceProfileName *string `field:"required" json:"applicationInferenceProfileName" yaml:"applicationInferenceProfileName"`
// The model source for this inference profile.
//
// To create an application inference profile for one Region, specify a foundation model.
// Usage and costs for requests made to that Region with that model will be tracked.
//
// To create an application inference profile for multiple Regions,
// specify a cross region (system-defined) inference profile.
// The inference profile will route requests to the Regions defined in
// the cross region (system-defined) inference profile that you choose.
// Usage and costs for requests made to the Regions in the inference profile will be tracked.
// Experimental.
ModelSource IBedrockInvokable `field:"required" json:"modelSource" yaml:"modelSource"`
// Description of the inference profile. Provides additional context about the purpose and usage of this inference profile.
//
// - Maximum length: 200 characters when provided
// - Pattern: `^([0-9a-zA-Z:.][ _-]?)+$`
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-applicationinferenceprofile.html#cfn-bedrock-applicationinferenceprofile-description
//
// Default: - No description is provided.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// A list of tags associated with the inference profile.
//
// Tags help you organize and categorize your AWS resources.
// Default: - No tags are applied.
//
// Experimental.
Tags *map[string]*string `field:"optional" json:"tags" yaml:"tags"`
}
Properties for creating an Application Inference Profile.
Example:
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0(),
})
// Create an application inference profile across regions
appProfile := bedrock.NewApplicationInferenceProfile(this, jsii.String("MyMultiRegionProfile"), &ApplicationInferenceProfileProps{
ApplicationInferenceProfileName: jsii.String("claude-35-sonnet-v2-multi-region"),
ModelSource: crossRegionProfile,
Description: jsii.String("Multi-region application profile for cost tracking"),
})
Experimental.
type AssetApiSchema ¶
type AssetApiSchema interface {
ApiSchema
// The inline OpenAPI schema definition as a string, if using an inline schema.
//
// Can be in JSON or YAML format.
// Experimental.
InlineSchema() *string
// The S3 location of the API schema file, if using an S3-based schema.
//
// Contains the bucket name and object key information.
// Experimental.
S3File() *awss3.Location
// Binds this API schema to a construct scope.
//
// This method initializes the S3 asset if it hasn't been initialized yet.
// Must be called before rendering the schema as CFN properties.
// Experimental.
Bind(scope constructs.Construct)
}
API Schema from a local asset.
The asset is uploaded to an S3 staging bucket, then moved to its final location by CloudFormation during deployment.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// When using ApiSchema.fromLocalAsset, you must bind the schema to a scope
schema := bedrock.ApiSchema_FromLocalAsset(path.join(__dirname, jsii.String("action-group.yaml")))
schema.Bind(this)
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
func ApiSchema_FromLocalAsset ¶
func ApiSchema_FromLocalAsset(path *string) AssetApiSchema
Creates an API Schema from a local file. Experimental.
func AssetApiSchema_FromLocalAsset ¶
func AssetApiSchema_FromLocalAsset(path *string) AssetApiSchema
Creates an API Schema from a local file. Experimental.
func InlineApiSchema_FromLocalAsset ¶
func InlineApiSchema_FromLocalAsset(path *string) AssetApiSchema
Creates an API Schema from a local file. Experimental.
func NewAssetApiSchema ¶
func NewAssetApiSchema(path *string, options *awss3assets.AssetOptions) AssetApiSchema
Experimental.
func S3ApiSchema_FromLocalAsset ¶
func S3ApiSchema_FromLocalAsset(path *string) AssetApiSchema
Creates an API Schema from a local file. Experimental.
type BedrockFoundationModel ¶
type BedrockFoundationModel interface {
IBedrockInvokable
// The ARN used for invoking the model.
//
// This is the same as modelArn for foundation models.
// Experimental.
InvokableArn() *string
// The ARN of the foundation model.
//
// Format: arn:${Partition}:bedrock:${Region}::foundation-model/${ResourceId}.
// Experimental.
ModelArn() *string
// The unique identifier of the foundation model.
// Experimental.
ModelId() *string
// The vector types supported by this model for embeddings.
//
// Defines whether the model supports floating-point or binary vectors.
// Experimental.
SupportedVectorType() *[]VectorType
// Whether this model supports integration with Bedrock Agents.
//
// When true, the model can be used with Bedrock Agents for automated task execution.
// Experimental.
SupportsAgents() *bool
// Whether this model supports cross-region inference.
//
// When true, the model can be used with Cross-Region Inference Profiles.
// Experimental.
SupportsCrossRegion() *bool
// Whether this model supports integration with Bedrock Knowledge Base.
//
// When true, the model can be used for knowledge base operations.
// Experimental.
SupportsKnowledgeBase() *bool
// The dimensionality of the vector embeddings produced by this model.
//
// Only applicable for embedding models.
// Experimental.
VectorDimensions() *float64
// Returns the ARN of the foundation model in the following format: `arn:${Partition}:bedrock:${Region}::foundation-model/${ResourceId}`.
// Experimental.
AsArn() *string
// Returns the IModel.
// Experimental.
AsIModel() awsbedrock.IModel
// Gives the appropriate policies to invoke and use the Foundation Model in the stack region.
//
// [disable-awslint:no-grants].
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Gives the appropriate policies to invoke and use the Foundation Model in all regions.
//
// [disable-awslint:no-grants].
// Experimental.
GrantInvokeAllRegions(grantee awsiam.IGrantable) awsiam.Grant
// Returns a string representation of an object.
// Experimental.
ToString() *string
}
Bedrock models.
If you need to use a model name that doesn't exist as a static member, you can instantiate a `BedrockFoundationModel` object, e.g: `new BedrockFoundationModel('my-model')`.
Example:
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda")),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
Parser: parserFunction,
PreProcessingStep: &PromptPreProcessingConfigCustomParser{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
UseCustomParser: jsii.Boolean(true),
},
}),
})
Experimental.
func BedrockFoundationModel_AI21_JAMBA_1_5_LARGE_V1 ¶
func BedrockFoundationModel_AI21_JAMBA_1_5_LARGE_V1() BedrockFoundationModel
func BedrockFoundationModel_AI21_JAMBA_1_5_MINI_V1 ¶
func BedrockFoundationModel_AI21_JAMBA_1_5_MINI_V1() BedrockFoundationModel
func BedrockFoundationModel_AI21_JAMBA_INSTRUCT_V1 ¶
func BedrockFoundationModel_AI21_JAMBA_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_NOVA_LITE_V1 ¶
func BedrockFoundationModel_AMAZON_NOVA_LITE_V1() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_NOVA_MICRO_V1 ¶
func BedrockFoundationModel_AMAZON_NOVA_MICRO_V1() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_NOVA_PREMIER_V1 ¶
func BedrockFoundationModel_AMAZON_NOVA_PREMIER_V1() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_NOVA_PRO_V1 ¶
func BedrockFoundationModel_AMAZON_NOVA_PRO_V1() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_TITAN_PREMIER_V1_0 ¶
func BedrockFoundationModel_AMAZON_TITAN_PREMIER_V1_0() BedrockFoundationModel
func BedrockFoundationModel_AMAZON_TITAN_TEXT_EXPRESS_V1 ¶
func BedrockFoundationModel_AMAZON_TITAN_TEXT_EXPRESS_V1() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_HAIKU_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_HAIKU_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_7_SONNET_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_3_7_SONNET_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_4_5_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_4_5_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_INSTANT_V1_2 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_INSTANT_V1_2() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_1_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_1_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_5_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_5_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_6_V1 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_6_V1() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_7 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_7() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_4_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_OPUS_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_5_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_5_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_6 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_6() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_4_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2() BedrockFoundationModel
func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2_1 ¶
func BedrockFoundationModel_ANTHROPIC_CLAUDE_V2_1() BedrockFoundationModel
func BedrockFoundationModel_COHERE_EMBED_ENGLISH_V3 ¶
func BedrockFoundationModel_COHERE_EMBED_ENGLISH_V3() BedrockFoundationModel
func BedrockFoundationModel_COHERE_EMBED_MULTILINGUAL_V3 ¶
func BedrockFoundationModel_COHERE_EMBED_MULTILINGUAL_V3() BedrockFoundationModel
func BedrockFoundationModel_DEEPSEEK_R1_V1 ¶
func BedrockFoundationModel_DEEPSEEK_R1_V1() BedrockFoundationModel
func BedrockFoundationModel_FromCdkFoundationModel ¶
func BedrockFoundationModel_FromCdkFoundationModel(modelId awsbedrock.FoundationModel, props *BedrockFoundationModelProps) BedrockFoundationModel
Creates a BedrockFoundationModel from a FoundationModel.
Use this method when you have a foundation model from the CDK.
Returns: A new BedrockFoundationModel instance. Experimental.
func BedrockFoundationModel_FromCdkFoundationModelId ¶
func BedrockFoundationModel_FromCdkFoundationModelId(modelId awsbedrock.FoundationModelIdentifier, props *BedrockFoundationModelProps) BedrockFoundationModel
Creates a BedrockFoundationModel from a FoundationModelIdentifier.
Use this method when you have a model identifier from the CDK.
Returns: A new BedrockFoundationModel instance. Experimental.
func BedrockFoundationModel_META_LLAMA_3_1_8B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_1_8B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_3_1_70B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_1_70B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_3_2_1B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_2_1B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_3_2_3B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_2_3B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_3_2_11B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_2_11B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_3_3_70B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_3_3_70B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_4_MAVERICK_17B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_4_MAVERICK_17B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_META_LLAMA_4_SCOUT_17B_INSTRUCT_V1 ¶
func BedrockFoundationModel_META_LLAMA_4_SCOUT_17B_INSTRUCT_V1() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_7B_INSTRUCT_V0 ¶
func BedrockFoundationModel_MISTRAL_7B_INSTRUCT_V0() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_LARGE_2402_V1 ¶
func BedrockFoundationModel_MISTRAL_LARGE_2402_V1() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_LARGE_2407_V1 ¶
func BedrockFoundationModel_MISTRAL_LARGE_2407_V1() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_MIXTRAL_8X7B_INSTRUCT_V0 ¶
func BedrockFoundationModel_MISTRAL_MIXTRAL_8X7B_INSTRUCT_V0() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_PIXTRAL_LARGE_2502_V1 ¶
func BedrockFoundationModel_MISTRAL_PIXTRAL_LARGE_2502_V1() BedrockFoundationModel
func BedrockFoundationModel_MISTRAL_SMALL_2402_V1 ¶
func BedrockFoundationModel_MISTRAL_SMALL_2402_V1() BedrockFoundationModel
func BedrockFoundationModel_TITAN_EMBED_TEXT_V1 ¶
func BedrockFoundationModel_TITAN_EMBED_TEXT_V1() BedrockFoundationModel
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_256 ¶
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_256() BedrockFoundationModel
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_512 ¶
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_512() BedrockFoundationModel
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_1024 ¶
func BedrockFoundationModel_TITAN_EMBED_TEXT_V2_1024() BedrockFoundationModel
func NewBedrockFoundationModel ¶
func NewBedrockFoundationModel(value *string, props *BedrockFoundationModelProps) BedrockFoundationModel
Experimental.
type BedrockFoundationModelProps ¶
type BedrockFoundationModelProps struct {
// https://docs.aws.amazon.com/bedrock/latest/userguide/model-lifecycle.html A version is marked Legacy when there is a more recent version which provides superior performance. Amazon Bedrock sets an EOL date for Legacy versions.
// Default: - false.
//
// Experimental.
Legacy *bool `field:"optional" json:"legacy" yaml:"legacy"`
// Currently, some of the offered models are optimized with prompts/parsers fine-tuned for integrating with the agents architecture.
//
// When true, the model has been specifically optimized for agent interactions.
// Default: - false.
//
// Experimental.
OptimizedForAgents *bool `field:"optional" json:"optimizedForAgents" yaml:"optimizedForAgents"`
// Embeddings models have different supported vector types.
//
// Defines whether the model supports floating-point or binary vectors.
// Default: - undefined.
//
// Experimental.
SupportedVectorType *[]VectorType `field:"optional" json:"supportedVectorType" yaml:"supportedVectorType"`
// Bedrock Agents can use this model.
//
// When true, the model can be used with Bedrock Agents for automated task execution.
// Default: - false.
//
// Experimental.
SupportsAgents *bool `field:"optional" json:"supportsAgents" yaml:"supportsAgents"`
// Can be used with a Cross-Region Inference Profile.
//
// When true, the model supports inference across different AWS regions.
// Default: - false.
//
// Experimental.
SupportsCrossRegion *bool `field:"optional" json:"supportsCrossRegion" yaml:"supportsCrossRegion"`
// Bedrock Knowledge Base can use this model.
//
// When true, the model can be used for knowledge base operations.
// Default: - false.
//
// Experimental.
SupportsKnowledgeBase *bool `field:"optional" json:"supportsKnowledgeBase" yaml:"supportsKnowledgeBase"`
// Embedding models have different vector dimensions.
//
// Only applicable for embedding models. Defines the dimensionality of the vector embeddings.
// Default: - undefined.
//
// Experimental.
VectorDimensions *float64 `field:"optional" json:"vectorDimensions" yaml:"vectorDimensions"`
}
Properties for configuring a Bedrock Foundation Model.
These properties define the model's capabilities and supported features.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
bedrockFoundationModelProps := &BedrockFoundationModelProps{
Legacy: jsii.Boolean(false),
OptimizedForAgents: jsii.Boolean(false),
SupportedVectorType: []VectorType{
bedrock_alpha.VectorType_FLOATING_POINT,
},
SupportsAgents: jsii.Boolean(false),
SupportsCrossRegion: jsii.Boolean(false),
SupportsKnowledgeBase: jsii.Boolean(false),
VectorDimensions: jsii.Number(123),
}
Experimental.
type CanadaSpecificPIIType ¶
type CanadaSpecificPIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII specific to Canada.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha" canadaSpecificPIIType := bedrock_alpha.CanadaSpecificPIIType_CA_HEALTH_NUMBER()
Experimental.
func CanadaSpecificPIIType_CA_HEALTH_NUMBER ¶
func CanadaSpecificPIIType_CA_HEALTH_NUMBER() CanadaSpecificPIIType
func CanadaSpecificPIIType_CA_SOCIAL_INSURANCE_NUMBER ¶
func CanadaSpecificPIIType_CA_SOCIAL_INSURANCE_NUMBER() CanadaSpecificPIIType
type ChatMessage ¶
type ChatMessage interface {
// The role of the message sender.
// Experimental.
Role() ChatMessageRole
// The text content of the message.
// Experimental.
Text() *string
}
Represents a message in a chat conversation.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
func ChatMessage_Assistant ¶
func ChatMessage_Assistant(text *string) ChatMessage
Creates an assistant message.
Returns: A ChatMessage instance representing an assistant message. Experimental.
func ChatMessage_User ¶
func ChatMessage_User(text *string) ChatMessage
Creates a user message.
Returns: A ChatMessage instance representing a user message. Experimental.
func NewChatMessage ¶
func NewChatMessage(role ChatMessageRole, text *string) ChatMessage
Experimental.
type ChatMessageRole ¶
type ChatMessageRole string
The role of a message in a chat conversation. Experimental.
const ( // This role represents the human user in the conversation. // // Inputs from the // user guide the conversation and prompt responses from the assistant. // Experimental. ChatMessageRole_USER ChatMessageRole = "USER" // This is the role of the model itself, responding to user inputs based on the context set by the system. // Experimental. ChatMessageRole_ASSISTANT ChatMessageRole = "ASSISTANT" )
type ChatPromptVariantProps ¶
type ChatPromptVariantProps struct {
// The model which is used to run the prompt.
//
// The model could be a foundation
// model, a custom model, or a provisioned model.
// Experimental.
Model IBedrockInvokable `field:"required" json:"model" yaml:"model"`
// The name of the prompt variant.
// Experimental.
VariantName *string `field:"required" json:"variantName" yaml:"variantName"`
// The variables in the prompt template that can be filled in at runtime.
// Default: - No variables defined.
//
// Experimental.
PromptVariables *[]*string `field:"optional" json:"promptVariables" yaml:"promptVariables"`
// The messages in the chat prompt.
//
// Must include at least one User Message.
// The messages should alternate between User and Assistant.
// Experimental.
Messages *[]ChatMessage `field:"required" json:"messages" yaml:"messages"`
// Inference configuration for the Chat Prompt.
// Default: - No inference configuration provided.
//
// Experimental.
InferenceConfiguration PromptInferenceConfiguration `field:"optional" json:"inferenceConfiguration" yaml:"inferenceConfiguration"`
// Context or instructions for the model to consider before generating a response.
// Default: - No system message provided.
//
// Experimental.
System *string `field:"optional" json:"system" yaml:"system"`
// The configuration with available tools to the model and how it must use them.
// Default: - No tool configuration provided.
//
// Experimental.
ToolConfiguration *ToolConfiguration `field:"optional" json:"toolConfiguration" yaml:"toolConfiguration"`
}
Properties for creating a chat prompt variant.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
type ChatTemplateConfigurationProps ¶
type ChatTemplateConfigurationProps struct {
// The messages in the chat template.
// Experimental.
Messages *[]ChatMessage `field:"required" json:"messages" yaml:"messages"`
// The input variables for the template.
// Default: - No input variables.
//
// Experimental.
InputVariables *[]*string `field:"optional" json:"inputVariables" yaml:"inputVariables"`
// The system message for the chat template.
// Default: - No system message.
//
// Experimental.
System *string `field:"optional" json:"system" yaml:"system"`
// The tool configuration for the chat template.
// Default: - No tool configuration.
//
// Experimental.
ToolConfiguration *ToolConfiguration `field:"optional" json:"toolConfiguration" yaml:"toolConfiguration"`
}
Properties for creating a chat template configuration.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var chatMessage ChatMessage
var tool Tool
var toolChoice ToolChoice
chatTemplateConfigurationProps := &ChatTemplateConfigurationProps{
Messages: []ChatMessage{
chatMessage,
},
// the properties below are optional
InputVariables: []*string{
jsii.String("inputVariables"),
},
System: jsii.String("system"),
ToolConfiguration: &ToolConfiguration{
ToolChoice: toolChoice,
Tools: []Tool{
tool,
},
},
}
Experimental.
type CommonPromptVariantProps ¶
type CommonPromptVariantProps struct {
// The model which is used to run the prompt.
//
// The model could be a foundation
// model, a custom model, or a provisioned model.
// Experimental.
Model IBedrockInvokable `field:"required" json:"model" yaml:"model"`
// The name of the prompt variant.
// Experimental.
VariantName *string `field:"required" json:"variantName" yaml:"variantName"`
// The variables in the prompt template that can be filled in at runtime.
// Default: - No variables defined.
//
// Experimental.
PromptVariables *[]*string `field:"optional" json:"promptVariables" yaml:"promptVariables"`
}
Common properties for all prompt variants.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var bedrockInvokable IBedrockInvokable
commonPromptVariantProps := &CommonPromptVariantProps{
Model: bedrockInvokable,
VariantName: jsii.String("variantName"),
// the properties below are optional
PromptVariables: []*string{
jsii.String("promptVariables"),
},
}
Experimental.
type ContentFilter ¶
type ContentFilter struct {
// The strength of the content filter to apply to prompts / user input.
// Experimental.
InputStrength ContentFilterStrength `field:"required" json:"inputStrength" yaml:"inputStrength"`
// The strength of the content filter to apply to model responses.
// Experimental.
OutputStrength ContentFilterStrength `field:"required" json:"outputStrength" yaml:"outputStrength"`
// The type of harmful category that the content filter is applied to.
// Experimental.
Type ContentFilterType `field:"required" json:"type" yaml:"type"`
// The action to take when content is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the content filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The input modalities to apply the content filter to.
// Default: undefined - Applies to text modality.
//
// Experimental.
InputModalities *[]ModalityType `field:"optional" json:"inputModalities" yaml:"inputModalities"`
// The action to take when content is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the content filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
// The output modalities to apply the content filter to.
// Default: undefined - Applies to text modality.
//
// Experimental.
OutputModalities *[]ModalityType `field:"optional" json:"outputModalities" yaml:"outputModalities"`
}
Interface to declare a content filter.
Example:
// Create a guardrail to filter inappropriate content
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
Description: jsii.String("Legal ethical guardrails."),
})
guardrail.AddContentFilter(&ContentFilter{
Type: bedrock.ContentFilterType_SEXUAL,
InputStrength: bedrock.ContentFilterStrength_HIGH,
OutputStrength: bedrock.ContentFilterStrength_MEDIUM,
})
// Create an agent with the guardrail
agentWithGuardrail := bedrock.NewAgent(this, jsii.String("AgentWithGuardrail"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
Guardrail: guardrail,
})
Experimental.
type ContentFilterStrength ¶
type ContentFilterStrength string
The strength of the content filter.
As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.
Example:
// Create a guardrail to filter inappropriate content
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
Description: jsii.String("Legal ethical guardrails."),
})
guardrail.AddContentFilter(&ContentFilter{
Type: bedrock.ContentFilterType_SEXUAL,
InputStrength: bedrock.ContentFilterStrength_HIGH,
OutputStrength: bedrock.ContentFilterStrength_MEDIUM,
})
// Create an agent with the guardrail
agentWithGuardrail := bedrock.NewAgent(this, jsii.String("AgentWithGuardrail"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
Guardrail: guardrail,
})
Experimental.
const ( // No content filtering applied. // Experimental. ContentFilterStrength_NONE ContentFilterStrength = "NONE" // Low strength content filtering - minimal filtering of harmful content. // Experimental. ContentFilterStrength_LOW ContentFilterStrength = "LOW" // Medium strength content filtering - balanced filtering of harmful content. // Experimental. ContentFilterStrength_MEDIUM ContentFilterStrength = "MEDIUM" // High strength content filtering - aggressive filtering of harmful content. // Experimental. ContentFilterStrength_HIGH ContentFilterStrength = "HIGH" )
type ContentFilterType ¶
type ContentFilterType string
The type of harmful category usable in a content filter.
Example:
// Create a guardrail to filter inappropriate content
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
Description: jsii.String("Legal ethical guardrails."),
})
guardrail.AddContentFilter(&ContentFilter{
Type: bedrock.ContentFilterType_SEXUAL,
InputStrength: bedrock.ContentFilterStrength_HIGH,
OutputStrength: bedrock.ContentFilterStrength_MEDIUM,
})
// Create an agent with the guardrail
agentWithGuardrail := bedrock.NewAgent(this, jsii.String("AgentWithGuardrail"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
Guardrail: guardrail,
})
Experimental.
const ( // Describes input prompts and model responses that indicates sexual interest, activity, or arousal using direct or indirect references to body parts, physical traits, or sex. // Experimental. ContentFilterType_SEXUAL ContentFilterType = "SEXUAL" // Describes input prompts and model responses that includes glorification of or threats to inflict physical pain, hurt, or injury toward a person, group or thing. // Experimental. ContentFilterType_VIOLENCE ContentFilterType = "VIOLENCE" // Describes input prompts and model responses that discriminate, criticize, insult, denounce, or dehumanize a person or group on the basis of an identity (such as race, ethnicity, gender, religion, sexual orientation, ability, and national origin). // Experimental. ContentFilterType_HATE ContentFilterType = "HATE" // Describes input prompts and model responses that includes demeaning, humiliating, mocking, insulting, or belittling language. // // This type of language is also labeled // as bullying. // Experimental. ContentFilterType_INSULTS ContentFilterType = "INSULTS" // Describes input prompts and model responses that seeks or provides information about engaging in misconduct activity, or harming, defrauding, or taking advantage of a person, group or institution. // Experimental. ContentFilterType_MISCONDUCT ContentFilterType = "MISCONDUCT" // Enable to detect and block user inputs attempting to override system instructions. // // To avoid misclassifying system prompts as a prompt attack and ensure that the filters // are selectively applied to user inputs, use input tagging. // Experimental. ContentFilterType_PROMPT_ATTACK ContentFilterType = "PROMPT_ATTACK" )
type ContextualGroundingFilter ¶
type ContextualGroundingFilter struct {
// The threshold for the contextual grounding filter.
//
// - `0` (blocks nothing)
// - `0.99` (blocks almost everything)
// Experimental.
Threshold *float64 `field:"required" json:"threshold" yaml:"threshold"`
// The type of contextual grounding filter.
// Experimental.
Type ContextualGroundingFilterType `field:"required" json:"type" yaml:"type"`
// The action to take when contextual grounding is detected.
// Default: GuardrailAction.BLOCK
//
// Experimental.
Action GuardrailAction `field:"optional" json:"action" yaml:"action"`
// Whether the contextual grounding filter is enabled.
// Default: true.
//
// Experimental.
Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
}
Interface to define a Contextual Grounding Filter.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add contextual grounding filter with action and enabled flag
guardrail.AddContextualGroundingFilter(&ContextualGroundingFilter{
Type: bedrock.ContextualGroundingFilterType_GROUNDING,
Threshold: jsii.Number(0.8),
// the properties below are optional
Action: bedrock.GuardrailAction_BLOCK,
Enabled: jsii.Boolean(true),
})
Experimental.
type ContextualGroundingFilterType ¶
type ContextualGroundingFilterType string
The type of contextual grounding filter.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add contextual grounding filter with action and enabled flag
guardrail.AddContextualGroundingFilter(&ContextualGroundingFilter{
Type: bedrock.ContextualGroundingFilterType_GROUNDING,
Threshold: jsii.Number(0.8),
// the properties below are optional
Action: bedrock.GuardrailAction_BLOCK,
Enabled: jsii.Boolean(true),
})
Experimental.
const ( // Grounding score represents the confidence that the model response is factually correct and grounded in the source. // // If the model response has a lower score than // the defined threshold, the response will be blocked and the configured blocked // message will be returned to the user. A higher threshold level blocks more responses. // Experimental. ContextualGroundingFilterType_GROUNDING ContextualGroundingFilterType = "GROUNDING" // Relevance score represents the confidence that the model response is relevant to the user's query. // // If the model response has a lower score than the defined // threshold, the response will be blocked and the configured blocked message will // be returned to the user. A higher threshold level blocks more responses. // Experimental. ContextualGroundingFilterType_RELEVANCE ContextualGroundingFilterType = "RELEVANCE" )
type CrossRegionInferenceProfile ¶
type CrossRegionInferenceProfile interface {
IBedrockInvokable
IInferenceProfile
// The ARN of the inference profile.
// Experimental.
InferenceProfileArn() *string
// The unique identifier of the inference profile.
//
// Format: {geoRegion}.{modelId}
// Experimental.
InferenceProfileId() *string
// The underlying foundation model supporting cross-region inference.
// Experimental.
InferenceProfileModel() BedrockFoundationModel
// The ARN used for invoking this inference profile.
//
// This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
// Experimental.
InvokableArn() *string
// The type of inference profile.
//
// Always SYSTEM_DEFINED for cross-region profiles.
// Experimental.
Type() InferenceProfileType
// Gives the appropriate policies to invoke and use the Foundation Model.
//
// For cross-region inference profiles, this method grants permissions to:
// - Invoke the model in all regions where the inference profile can route requests
// - Use the inference profile itself
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Grants appropriate permissions to use the cross-region inference profile.
//
// This method adds the necessary IAM permissions to allow the grantee to:
// - Get inference profile details (bedrock:GetInferenceProfile)
// - Invoke the model through the inference profile (bedrock:InvokeModel*)
//
// Note: This does not grant permissions to use the underlying model directly.
// For comprehensive permissions, use grantInvoke() instead.
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantProfileUsage(grantee awsiam.IGrantable) awsiam.Grant
}
Cross-region inference enables you to seamlessly manage unplanned traffic bursts by utilizing compute across different AWS Regions.
With cross-region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput and enhanced resilience during periods of peak demands.
This construct represents a system-defined inference profile that routes requests across multiple regions based on availability and demand.
Example:
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
})
// Use the cross-region profile with an agent
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: crossRegionProfile,
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about agriculture."),
})
See: https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html
Experimental.
func CrossRegionInferenceProfile_FromConfig ¶
func CrossRegionInferenceProfile_FromConfig(config *CrossRegionInferenceProfileProps) CrossRegionInferenceProfile
Creates a Cross-Region Inference Profile from the provided configuration.
Returns: A new CrossRegionInferenceProfile instance. Experimental.
type CrossRegionInferenceProfileProps ¶
type CrossRegionInferenceProfileProps struct {
// The geographic region where the traffic is going to be distributed.
//
// Routing
// factors in user traffic, demand and utilization of resources.
// Experimental.
GeoRegion CrossRegionInferenceProfileRegion `field:"required" json:"geoRegion" yaml:"geoRegion"`
// A foundation model supporting cross-region inference.
//
// The model must have cross-region support enabled.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html
//
// Experimental.
Model BedrockFoundationModel `field:"required" json:"model" yaml:"model"`
}
Properties for creating a Cross-Region Inference Profile.
Example:
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
})
// Use the cross-region profile with an agent
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: crossRegionProfile,
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about agriculture."),
})
Experimental.
type CrossRegionInferenceProfileRegion ¶
type CrossRegionInferenceProfileRegion string
Geographic regions supported for cross-region inference profiles.
These regions help distribute traffic across multiple AWS regions for better throughput and resilience during peak demands.
Example:
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
})
// Use the cross-region profile with an agent
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: crossRegionProfile,
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about agriculture."),
})
Experimental.
const ( // Global cross-region Inference Identifier. // // Routes requests to any supported commercial AWS Region. // Experimental. CrossRegionInferenceProfileRegion_GLOBAL CrossRegionInferenceProfileRegion = "GLOBAL" // Cross-region Inference Identifier for the European area. // // According to the model chosen, this might include: // - Frankfurt (`eu-central-1`) // - Ireland (`eu-west-1`) // - Paris (`eu-west-3`) // - London (`eu-west-2`) // - Stockholm (`eu-north-1`) // - Milan (`eu-south-1`) // - Spain (`eu-south-2`) // - Zurich (`eu-central-2`). // Experimental. CrossRegionInferenceProfileRegion_EU CrossRegionInferenceProfileRegion = "EU" // Cross-region Inference Identifier for the United States area. // // According to the model chosen, this might include: // - N. Virginia (`us-east-1`) // - Ohio (`us-east-2`) // - Oregon (`us-west-2`). // Experimental. CrossRegionInferenceProfileRegion_US CrossRegionInferenceProfileRegion = "US" // Cross-region Inference Identifier for the US GovCloud area. // // According to the model chosen, this might include: // - GovCloud US-East (`us-gov-east-1`) // - GovCloud US-West (`us-gov-west-1`). // Experimental. CrossRegionInferenceProfileRegion_US_GOV CrossRegionInferenceProfileRegion = "US_GOV" // Cross-region Inference Identifier for the Asia-Pacific area. // // According to the model chosen, this might include: // - Tokyo (`ap-northeast-1`) // - Seoul (`ap-northeast-2`) // - Osaka (`ap-northeast-3`) // - Mumbai (`ap-south-1`) // - Hyderabad (`ap-south-2`) // - Singapore (`ap-southeast-1`) // - Sydney (`ap-southeast-2`) // - Jakarta (`ap-southeast-3`) // - Melbourne (`ap-southeast-4`) // - Malaysia (`ap-southeast-5`) // - Thailand (`ap-southeast-7`) // - Taipei (`ap-east-2`) // - Middle East (UAE) (`me-central-1`). // Experimental. CrossRegionInferenceProfileRegion_APAC CrossRegionInferenceProfileRegion = "APAC" // Cross-region Inference Identifier for the Japan area. // // According to the model chosen, this might include: // - Tokyo (`ap-northeast-1`) // - Osaka (`ap-northeast-3`). // Experimental. CrossRegionInferenceProfileRegion_JP CrossRegionInferenceProfileRegion = "JP" // Cross-region Inference Identifier for the Australia area. // // According to the model chosen, this might include: // - Sydney (`ap-southeast-2`) // - Melbourne (`ap-southeast-4`). // Experimental. CrossRegionInferenceProfileRegion_AU CrossRegionInferenceProfileRegion = "AU" )
type CustomControl ¶
type CustomControl string
The type of custom control for the action group executor. Experimental.
const ( // Returns the action group invocation results directly in the InvokeAgent response. // Experimental. CustomControl_RETURN_CONTROL CustomControl = "RETURN_CONTROL" )
type CustomOrchestrationExecutor ¶
type CustomOrchestrationExecutor interface {
// The Lambda function that contains the custom orchestration logic.
//
// This function is called when the agent needs to make decisions about action execution.
// Experimental.
LambdaFunction() awslambda.IFunction
// The type of orchestration this executor performs.
// Experimental.
Type() OrchestrationType
}
Contains details about the Lambda function containing the orchestration logic carried out upon invoking the custom orchestration.
Example:
orchestrationFunction := lambda.NewFunction(this, jsii.String("OrchestrationFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda/orchestration")),
})
agent := bedrock.NewAgent(this, jsii.String("CustomOrchestrationAgent"), &AgentProps{
Instruction: jsii.String("You are a helpful assistant with custom orchestration logic."),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
CustomOrchestrationExecutor: bedrock.CustomOrchestrationExecutor_FromLambda(orchestrationFunction),
})
Experimental.
func CustomOrchestrationExecutor_FromLambda ¶
func CustomOrchestrationExecutor_FromLambda(lambdaFunction awslambda.IFunction) CustomOrchestrationExecutor
Defines an orchestration executor with a Lambda function containing the business logic. Experimental.
type CustomParserProps ¶
type CustomParserProps struct {
// Configuration for the knowledge base response generation step.
// Default: undefined - No knowledge base response generation configuration.
//
// Experimental.
KnowledgeBaseResponseGenerationStep *PromptKnowledgeBaseResponseGenerationConfigCustomParser `field:"optional" json:"knowledgeBaseResponseGenerationStep" yaml:"knowledgeBaseResponseGenerationStep"`
// Configuration for the memory summarization step.
// Default: undefined - No memory summarization configuration.
//
// Experimental.
MemorySummarizationStep *PromptMemorySummarizationConfigCustomParser `field:"optional" json:"memorySummarizationStep" yaml:"memorySummarizationStep"`
// Configuration for the orchestration step.
// Default: undefined - No orchestration configuration.
//
// Experimental.
OrchestrationStep *PromptOrchestrationConfigCustomParser `field:"optional" json:"orchestrationStep" yaml:"orchestrationStep"`
// Lambda function to use as custom parser.
// Default: undefined - No custom parser is used.
//
// Experimental.
Parser awslambda.IFunction `field:"optional" json:"parser" yaml:"parser"`
// Configuration for the post-processing step.
// Default: undefined - No post-processing configuration.
//
// Experimental.
PostProcessingStep *PromptPostProcessingConfigCustomParser `field:"optional" json:"postProcessingStep" yaml:"postProcessingStep"`
// Configuration for the pre-processing step.
// Default: undefined - No pre-processing configuration.
//
// Experimental.
PreProcessingStep *PromptPreProcessingConfigCustomParser `field:"optional" json:"preProcessingStep" yaml:"preProcessingStep"`
// Configuration for the routing classifier step.
// Default: undefined - No routing classifier configuration.
//
// Experimental.
RoutingClassifierStep *PromptRoutingClassifierConfigCustomParser `field:"optional" json:"routingClassifierStep" yaml:"routingClassifierStep"`
}
Properties for configuring a custom Lambda parser for prompt overrides.
Example:
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda")),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
Parser: parserFunction,
PreProcessingStep: &PromptPreProcessingConfigCustomParser{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
UseCustomParser: jsii.Boolean(true),
},
}),
})
Experimental.
type CustomTopicProps ¶
type CustomTopicProps struct {
// Provide a clear definition to detect and block user inputs and FM responses that fall into this topic.
//
// Avoid starting with "don't".
//
// Example:
// `Investment advice refers to inquiries, guidance, or recommendations
// regarding the management or allocation of funds or assets with the goal of
// generating returns or achieving specific financial objectives.`
//
// Experimental.
Definition *string `field:"required" json:"definition" yaml:"definition"`
// Representative phrases that refer to the topic.
//
// These phrases can represent
// a user input or a model response. Add between 1 and 100 phrases, up to 100 characters
// each.
//
// Example:
// "Where should I invest my money?"
//
// Experimental.
Examples *[]*string `field:"required" json:"examples" yaml:"examples"`
// The name of the topic to deny.
// Experimental.
Name *string `field:"required" json:"name" yaml:"name"`
// The action to take when a topic is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the topic filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The action to take when a topic is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the topic filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
}
Interface for creating a custom Topic.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
// Configure tier for topic filters (optional)
TopicsTierConfig: bedrock.TierConfig_STANDARD,
})
// Use a predefined topic
guardrail.AddDeniedTopicFilter(bedrock.Topic_FINANCIAL_ADVICE())
// Create a custom topic with input/output actions
guardrail.AddDeniedTopicFilter(bedrock.Topic_Custom(&CustomTopicProps{
Name: jsii.String("Legal_Advice"),
Definition: jsii.String("Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities."),
Examples: []*string{
jsii.String("Can I sue someone for this?"),
jsii.String("What are my legal rights in this situation?"),
jsii.String("Is this action against the law?"),
jsii.String("What should I do to file a legal complaint?"),
jsii.String("Can you explain this law to me?"),
},
// props below are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
}))
Experimental.
type DefaultPromptRouterIdentifier ¶
type DefaultPromptRouterIdentifier interface {
// The unique identifier for this prompt router.
// Experimental.
PromptRouterId() *string
// The foundation models that this router can route between.
// Experimental.
RoutingModels() *[]BedrockFoundationModel
}
Represents identifiers for default prompt routers in Bedrock.
These are pre-configured routers provided by AWS that route between different models in the same family for optimal performance and cost.
Example:
// Create a prompt router for intelligent model selection
promptRouter := bedrock.PromptRouter_FromDefaultId(bedrock.DefaultPromptRouterIdentifier_ANTHROPIC_CLAUDE_V1(), jsii.String("us-east-1"))
// Use the prompt router with a prompt variant
variant := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
PromptText: jsii.String("What is the capital of France?"),
Model: promptRouter,
})
bedrock.NewPrompt(this, jsii.String("Prompt"), &PromptProps{
PromptName: jsii.String("prompt-router-test"),
Variants: []IPromptVariant{
variant,
},
})
Experimental.
func DefaultPromptRouterIdentifier_ANTHROPIC_CLAUDE_V1 ¶
func DefaultPromptRouterIdentifier_ANTHROPIC_CLAUDE_V1() DefaultPromptRouterIdentifier
func DefaultPromptRouterIdentifier_META_LLAMA_3_1 ¶
func DefaultPromptRouterIdentifier_META_LLAMA_3_1() DefaultPromptRouterIdentifier
type FinancePIIType ¶
type FinancePIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII in the domain of Finance.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
func FinancePIIType_CREDIT_DEBIT_CARD_CVV ¶
func FinancePIIType_CREDIT_DEBIT_CARD_CVV() FinancePIIType
func FinancePIIType_CREDIT_DEBIT_CARD_EXPIRY ¶
func FinancePIIType_CREDIT_DEBIT_CARD_EXPIRY() FinancePIIType
func FinancePIIType_CREDIT_DEBIT_CARD_NUMBER ¶
func FinancePIIType_CREDIT_DEBIT_CARD_NUMBER() FinancePIIType
func FinancePIIType_INTERNATIONAL_BANK_ACCOUNT_NUMBER ¶
func FinancePIIType_INTERNATIONAL_BANK_ACCOUNT_NUMBER() FinancePIIType
func FinancePIIType_PIN ¶
func FinancePIIType_PIN() FinancePIIType
func FinancePIIType_SWIFT_CODE ¶
func FinancePIIType_SWIFT_CODE() FinancePIIType
type Function ¶
type Function interface {
// Description of the function.
// Experimental.
Description() *string
// The name of the function.
// Experimental.
Name() *string
// Parameters for the function.
// Experimental.
Parameters() *map[string]FunctionParameter
// Whether to require confirmation before executing the function.
// Experimental.
RequireConfirmation() RequireConfirmation
}
Represents a function in a function schema.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awsbedrockalpha"
function_ := bedrock_alpha.NewFunction(&FunctionProps{
Description: jsii.String("description"),
Name: jsii.String("name"),
// the properties below are optional
Parameters: map[string]FunctionParameterProps{
"parametersKey": &FunctionParameterProps{
"type": bedrock_alpha.ParameterType_STRING,
// the properties below are optional
"description": jsii.String("description"),
"required": jsii.Boolean(false),
},
},
RequireConfirmation: bedrock_alpha.RequireConfirmation_ENABLED,
})
Experimental.
type FunctionParameter ¶
type FunctionParameter interface {
// Description of the parameter.
// Default: undefined no description will be present.
//
// Experimental.
Description() *string
// Whether the parameter is required.
// Experimental.
Required() *bool
// The type of the parameter.
// Experimental.
Type() ParameterType
}
Represents a function parameter in a function schema.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awsbedrockalpha"
functionParameter := bedrock_alpha.NewFunctionParameter(&FunctionParameterProps{
Type: bedrock_alpha.ParameterType_STRING,
// the properties below are optional
Description: jsii.String("description"),
Required: jsii.Boolean(false),
})
Experimental.
func NewFunctionParameter ¶
func NewFunctionParameter(props *FunctionParameterProps) FunctionParameter
Experimental.
type FunctionParameterProps ¶
type FunctionParameterProps struct {
// The type of the parameter.
// Experimental.
Type ParameterType `field:"required" json:"type" yaml:"type"`
// Description of the parameter.
// Default: undefined no description will be present.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// Whether the parameter is required.
// Default: true.
//
// Experimental.
Required *bool `field:"optional" json:"required" yaml:"required"`
}
Properties for a function parameter.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// Define a function schema with parameters
functionSchema := bedrock.NewFunctionSchema(&FunctionSchemaProps{
Functions: []FunctionProps{
&FunctionProps{
Name: jsii.String("searchBooks"),
Description: jsii.String("Search for books in the library catalog"),
Parameters: map[string]FunctionParameterProps{
"query": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The search query string"),
},
"maxResults": &FunctionParameterProps{
"type": bedrock.ParameterType_INTEGER,
"required": jsii.Boolean(false),
"description": jsii.String("Maximum number of results to return"),
},
"includeOutOfPrint": &FunctionParameterProps{
"type": bedrock.ParameterType_BOOLEAN,
"required": jsii.Boolean(false),
"description": jsii.String("Whether to include out-of-print books"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_DISABLED,
},
&FunctionProps{
Name: jsii.String("getBookDetails"),
Description: jsii.String("Get detailed information about a specific book"),
Parameters: map[string]FunctionParameterProps{
"bookId": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The unique identifier of the book"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_ENABLED,
},
},
})
// Create an action group using the function schema
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("library-functions"),
Description: jsii.String("Functions for interacting with the library catalog"),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
FunctionSchema: functionSchema,
Enabled: jsii.Boolean(true),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
ActionGroups: []AgentActionGroup{
actionGroup,
},
})
Experimental.
type FunctionProps ¶
type FunctionProps struct {
// Description of the function.
// Experimental.
Description *string `field:"required" json:"description" yaml:"description"`
// The name of the function.
// Experimental.
Name *string `field:"required" json:"name" yaml:"name"`
// Parameters for the function as a record of parameter name to parameter properties.
// Default: {}.
//
// Experimental.
Parameters *map[string]*FunctionParameterProps `field:"optional" json:"parameters" yaml:"parameters"`
// Whether to require confirmation before executing the function.
// Default: RequireConfirmation.DISABLED
//
// Experimental.
RequireConfirmation RequireConfirmation `field:"optional" json:"requireConfirmation" yaml:"requireConfirmation"`
}
Properties for a function in a function schema.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awsbedrockalpha"
functionProps := &FunctionProps{
Description: jsii.String("description"),
Name: jsii.String("name"),
// the properties below are optional
Parameters: map[string]FunctionParameterProps{
"parametersKey": &FunctionParameterProps{
"type": bedrock_alpha.ParameterType_STRING,
// the properties below are optional
"description": jsii.String("description"),
"required": jsii.Boolean(false),
},
},
RequireConfirmation: bedrock_alpha.RequireConfirmation_ENABLED,
}
Experimental.
type FunctionSchema ¶
type FunctionSchema interface {
// The functions defined in the schema.
// Experimental.
Functions() *[]Function
}
Represents a function schema for a Bedrock Agent Action Group.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// Define a function schema with parameters
functionSchema := bedrock.NewFunctionSchema(&FunctionSchemaProps{
Functions: []FunctionProps{
&FunctionProps{
Name: jsii.String("searchBooks"),
Description: jsii.String("Search for books in the library catalog"),
Parameters: map[string]FunctionParameterProps{
"query": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The search query string"),
},
"maxResults": &FunctionParameterProps{
"type": bedrock.ParameterType_INTEGER,
"required": jsii.Boolean(false),
"description": jsii.String("Maximum number of results to return"),
},
"includeOutOfPrint": &FunctionParameterProps{
"type": bedrock.ParameterType_BOOLEAN,
"required": jsii.Boolean(false),
"description": jsii.String("Whether to include out-of-print books"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_DISABLED,
},
&FunctionProps{
Name: jsii.String("getBookDetails"),
Description: jsii.String("Get detailed information about a specific book"),
Parameters: map[string]FunctionParameterProps{
"bookId": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The unique identifier of the book"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_ENABLED,
},
},
})
// Create an action group using the function schema
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("library-functions"),
Description: jsii.String("Functions for interacting with the library catalog"),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
FunctionSchema: functionSchema,
Enabled: jsii.Boolean(true),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
ActionGroups: []AgentActionGroup{
actionGroup,
},
})
Experimental.
func NewFunctionSchema ¶
func NewFunctionSchema(props *FunctionSchemaProps) FunctionSchema
Experimental.
type FunctionSchemaProps ¶
type FunctionSchemaProps struct {
// Functions defined in the schema.
// Experimental.
Functions *[]*FunctionProps `field:"required" json:"functions" yaml:"functions"`
}
Properties for a function schema.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// Define a function schema with parameters
functionSchema := bedrock.NewFunctionSchema(&FunctionSchemaProps{
Functions: []FunctionProps{
&FunctionProps{
Name: jsii.String("searchBooks"),
Description: jsii.String("Search for books in the library catalog"),
Parameters: map[string]FunctionParameterProps{
"query": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The search query string"),
},
"maxResults": &FunctionParameterProps{
"type": bedrock.ParameterType_INTEGER,
"required": jsii.Boolean(false),
"description": jsii.String("Maximum number of results to return"),
},
"includeOutOfPrint": &FunctionParameterProps{
"type": bedrock.ParameterType_BOOLEAN,
"required": jsii.Boolean(false),
"description": jsii.String("Whether to include out-of-print books"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_DISABLED,
},
&FunctionProps{
Name: jsii.String("getBookDetails"),
Description: jsii.String("Get detailed information about a specific book"),
Parameters: map[string]FunctionParameterProps{
"bookId": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The unique identifier of the book"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_ENABLED,
},
},
})
// Create an action group using the function schema
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("library-functions"),
Description: jsii.String("Functions for interacting with the library catalog"),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
FunctionSchema: functionSchema,
Enabled: jsii.Boolean(true),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
ActionGroups: []AgentActionGroup{
actionGroup,
},
})
Experimental.
type FunctionToolProps ¶
type FunctionToolProps struct {
// A description of what the function does.
// Experimental.
Description *string `field:"required" json:"description" yaml:"description"`
// The input schema for the function parameters.
// Experimental.
InputSchema interface{} `field:"required" json:"inputSchema" yaml:"inputSchema"`
// The name of the function.
// Experimental.
Name *string `field:"required" json:"name" yaml:"name"`
}
Properties for creating a function tool.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
type GeneralPIIType ¶
type GeneralPIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII that are general, and not domain-specific.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
func GeneralPIIType_ADDRESS ¶
func GeneralPIIType_ADDRESS() GeneralPIIType
func GeneralPIIType_AGE ¶
func GeneralPIIType_AGE() GeneralPIIType
func GeneralPIIType_DRIVER_ID ¶
func GeneralPIIType_DRIVER_ID() GeneralPIIType
func GeneralPIIType_EMAIL ¶
func GeneralPIIType_EMAIL() GeneralPIIType
func GeneralPIIType_LICENSE_PLATE ¶
func GeneralPIIType_LICENSE_PLATE() GeneralPIIType
func GeneralPIIType_NAME ¶
func GeneralPIIType_NAME() GeneralPIIType
func GeneralPIIType_PASSWORD ¶
func GeneralPIIType_PASSWORD() GeneralPIIType
func GeneralPIIType_PHONE ¶
func GeneralPIIType_PHONE() GeneralPIIType
func GeneralPIIType_USERNAME ¶
func GeneralPIIType_USERNAME() GeneralPIIType
func GeneralPIIType_VEHICLE_IDENTIFICATION_NUMBER ¶
func GeneralPIIType_VEHICLE_IDENTIFICATION_NUMBER() GeneralPIIType
type Guardrail ¶
type Guardrail interface {
GuardrailBase
// The message to return when the guardrail blocks a prompt.
// Default: "Sorry, your query violates our usage policy."
//
// Experimental.
BlockedInputMessaging() *string
// The message to return when the guardrail blocks a model response.
// Default: "Sorry, I am unable to answer your question because of our usage policy."
//
// Experimental.
BlockedOutputsMessaging() *string
// The content filters applied by the guardrail.
// Experimental.
ContentFilters() *[]*ContentFilter
// 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.
// Default: filters.TierConfig.CLASSIC
//
// Experimental.
ContentFiltersTierConfig() TierConfig
// The contextual grounding filters applied by the guardrail.
// Experimental.
ContextualGroundingFilters() *[]*ContextualGroundingFilter
// The cross-region configuration for the guardrail.
// Experimental.
CrossRegionConfig() *GuardrailCrossRegionConfigProperty
// The denied topic filters applied by the guardrail.
// Experimental.
DeniedTopics() *[]Topic
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The ARN of the guardrail.
// Experimental.
GuardrailArn() *string
// The ID of the guardrail.
// Experimental.
GuardrailId() *string
// The version of the guardrail.
// Experimental.
GuardrailVersion() *string
// The computed hash of the guardrail properties.
// Experimental.
Hash() *string
// The KMS key used to encrypt data.
// Default: undefined - "Data is encrypted by default with a key that AWS owns and manages for you".
//
// Experimental.
KmsKey() awskms.IKey
// When this guardrail was last updated.
// Experimental.
LastUpdated() *string
// The managed word list filters applied by the guardrail.
// Experimental.
ManagedWordListFilters() *[]*ManagedWordFilter
// The name of the guardrail.
// Experimental.
Name() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The PII filters applied by the guardrail.
// Experimental.
PiiFilters() *[]*PIIFilter
// The regex filters applied by the guardrail.
// Experimental.
RegexFilters() *[]*RegexFilter
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// The tier that your guardrail uses for denied topic filters.
// Default: filters.TierConfig.CLASSIC
//
// Experimental.
TopicsTierConfig() TierConfig
// The word filters applied by the guardrail.
// Experimental.
WordFilters() *[]*WordFilter
// Adds a content filter to the guardrail.
// Experimental.
AddContentFilter(filter *ContentFilter)
// Adds a contextual grounding filter to the guardrail.
// Experimental.
AddContextualGroundingFilter(filter *ContextualGroundingFilter)
// Adds a denied topic filter to the guardrail.
// Experimental.
AddDeniedTopicFilter(filter Topic)
// Adds a managed word list filter to the guardrail.
// Experimental.
AddManagedWordListFilter(filter *ManagedWordFilter)
// Adds a PII filter to the guardrail.
// Experimental.
AddPIIFilter(filter *PIIFilter)
// Adds a regex filter to the guardrail.
// Experimental.
AddRegexFilter(filter *RegexFilter)
// Adds a word filter to the guardrail.
// Experimental.
AddWordFilter(filter *WordFilter)
// Adds a word filter to the guardrail.
// Experimental.
AddWordFilterFromFile(filePath *string, inputAction GuardrailAction, outputAction GuardrailAction, inputEnabled *bool, outputEnabled *bool)
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Create a version for the guardrail.
//
// Returns: The guardrail version.
// Experimental.
CreateVersion(description *string) *string
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given principal identity permissions to perform actions on this guardrail.
//
// [disable-awslint:no-grants].
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to apply the guardrail.
//
// [disable-awslint:no-grants].
// Experimental.
GrantApply(grantee awsiam.IGrantable) awsiam.Grant
// Return the given named metric for this guardrail.
//
// By default, the metric will be calculated as a sum over a period of 5 minutes.
// You can customize this by using the `statistic` and `period` properties.
// Experimental.
Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation client errors metric for this guardrail.
// Experimental.
MetricInvocationClientErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation latency metric for this guardrail.
// Experimental.
MetricInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations metric for this guardrail.
// Experimental.
MetricInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation server errors metric for this guardrail.
// Experimental.
MetricInvocationServerErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations intervened metric for this guardrail.
// Experimental.
MetricInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation throttles metric for this guardrail.
// Experimental.
MetricInvocationThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the text unit count metric for this guardrail.
// Experimental.
MetricTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Experimental.
UpdateVersion(version *string)
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create a Guardrail with CDK.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add regex filter with input/output actions
guardrail.AddRegexFilter(&RegexFilter{
Name: jsii.String("TestRegexFilter"),
Pattern: jsii.String("test-pattern"),
Action: bedrock.GuardrailAction_ANONYMIZE,
// below props are optional
Description: jsii.String("This is a test regex filter"),
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
Experimental.
func NewGuardrail ¶
func NewGuardrail(scope constructs.Construct, id *string, props *GuardrailProps) Guardrail
Experimental.
type GuardrailAction ¶
type GuardrailAction string
Guardrail action when a sensitive entity is detected.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
// Configure tier for topic filters (optional)
TopicsTierConfig: bedrock.TierConfig_STANDARD,
})
// Use a predefined topic
guardrail.AddDeniedTopicFilter(bedrock.Topic_FINANCIAL_ADVICE())
// Create a custom topic with input/output actions
guardrail.AddDeniedTopicFilter(bedrock.Topic_Custom(&CustomTopicProps{
Name: jsii.String("Legal_Advice"),
Definition: jsii.String("Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities."),
Examples: []*string{
jsii.String("Can I sue someone for this?"),
jsii.String("What are my legal rights in this situation?"),
jsii.String("Is this action against the law?"),
jsii.String("What should I do to file a legal complaint?"),
jsii.String("Can you explain this law to me?"),
},
// props below are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
}))
Experimental.
const ( // If sensitive information is detected in the prompt or response, the guardrail blocks all the content and returns a message that you configure. // Experimental. GuardrailAction_BLOCK GuardrailAction = "BLOCK" // If sensitive information is detected in the model response, the guardrail masks it with an identifier, the sensitive information is masked and replaced with identifier tags (for example: [NAME-1], [NAME-2], [EMAIL-1], etc.). // Experimental. GuardrailAction_ANONYMIZE GuardrailAction = "ANONYMIZE" // Do not take any action. // Experimental. GuardrailAction_NONE GuardrailAction = "NONE" )
type GuardrailAttributes ¶
type GuardrailAttributes struct {
// The ARN of the guardrail.
//
// At least one of guardrailArn or guardrailId must be
// defined in order to initialize a guardrail ref.
// Experimental.
GuardrailArn *string `field:"required" json:"guardrailArn" yaml:"guardrailArn"`
// The version of the guardrail.
// Default: "DRAFT".
//
// Experimental.
GuardrailVersion *string `field:"optional" json:"guardrailVersion" yaml:"guardrailVersion"`
// The KMS key of the guardrail if custom encryption is configured.
// Default: undefined - Means data is encrypted by default with a AWS-managed key.
//
// Experimental.
KmsKey awskms.IKey `field:"optional" json:"kmsKey" yaml:"kmsKey"`
}
**************************************************************************** ATTRS FOR IMPORTED CONSTRUCT ***************************************************************************.
Example:
var stack Stack
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
// Import an existing guardrail by ARN
importedGuardrail := bedrock.Guardrail_FromGuardrailAttributes(stack, jsii.String("TestGuardrail"), &GuardrailAttributes{
GuardrailArn: jsii.String("arn:aws:bedrock:us-east-1:123456789012:guardrail/oygh3o8g7rtl"),
GuardrailVersion: jsii.String("1"),
//optional
KmsKey: cmk,
})
Experimental.
type GuardrailBase ¶
type GuardrailBase interface {
awscdk.Resource
IGuardrail
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The ARN of the guardrail.
// Experimental.
GuardrailArn() *string
// The ID of the guardrail.
// Experimental.
GuardrailId() *string
// The version of the guardrail.
// Experimental.
GuardrailVersion() *string
// Optional KMS encryption key associated with this guardrail.
// Experimental.
KmsKey() awskms.IKey
// When this guardrail was last updated.
// Experimental.
LastUpdated() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given principal identity permissions to perform actions on this guardrail.
//
// [disable-awslint:no-grants].
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to apply the guardrail.
//
// [disable-awslint:no-grants].
// Experimental.
GrantApply(grantee awsiam.IGrantable) awsiam.Grant
// Return the given named metric for this guardrail.
//
// By default, the metric will be calculated as a sum over a period of 5 minutes.
// You can customize this by using the `statistic` and `period` properties.
// Experimental.
Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation client errors metric for this guardrail.
// Experimental.
MetricInvocationClientErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation latency metric for this guardrail.
// Experimental.
MetricInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations metric for this guardrail.
// Experimental.
MetricInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation server errors metric for this guardrail.
// Experimental.
MetricInvocationServerErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations intervened metric for this guardrail.
// Experimental.
MetricInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation throttles metric for this guardrail.
// Experimental.
MetricInvocationThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the text unit count metric for this guardrail.
// Experimental.
MetricTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Experimental.
UpdateVersion(version *string)
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Abstract base class for a Guardrail.
Contains methods and attributes valid for Guardrails either created with CDK or imported. Experimental.
type GuardrailCrossRegionConfigProperty ¶
type GuardrailCrossRegionConfigProperty struct {
// The arn of thesystem-defined guardrail profile that you're using with your guardrail.
//
// Guardrail profiles define the destination AWS Regions where guardrail inference requests can be automatically routed.
// Using guardrail profiles helps maintain guardrail performance and reliability when demand increases.
// Default: - No cross-region configuration.
//
// Experimental.
GuardrailProfileArn *string `field:"required" json:"guardrailProfileArn" yaml:"guardrailProfileArn"`
}
GuardrailCrossRegionConfigProperty.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
Description: jsii.String("Guardrail with cross-region configuration for enhanced language support"),
CrossRegionConfig: &GuardrailCrossRegionConfigProperty{
GuardrailProfileArn: jsii.String("arn:aws:bedrock:us-east-1:123456789012:guardrail-profile/my-profile"),
},
// Use STANDARD tier for enhanced capabilities
ContentFiltersTierConfig: bedrock.TierConfig_STANDARD,
TopicsTierConfig: bedrock.TierConfig_STANDARD,
})
Experimental.
type GuardrailProps ¶
type GuardrailProps struct {
// The name of the guardrail.
//
// This will be used as the physical name of the guardrail.
// Experimental.
GuardrailName *string `field:"required" json:"guardrailName" yaml:"guardrailName"`
// The message to return when the guardrail blocks a prompt.
//
// Must be between 1 and 500 characters.
// Default: "Sorry, your query violates our usage policy."
//
// Experimental.
BlockedInputMessaging *string `field:"optional" json:"blockedInputMessaging" yaml:"blockedInputMessaging"`
// The message to return when the guardrail blocks a model response.
//
// Must be between 1 and 500 characters.
// Default: "Sorry, I am unable to answer your question because of our usage policy."
//
// Experimental.
BlockedOutputsMessaging *string `field:"optional" json:"blockedOutputsMessaging" yaml:"blockedOutputsMessaging"`
// The content filters to apply to the guardrail.
// Default: [].
//
// Experimental.
ContentFilters *[]*ContentFilter `field:"optional" json:"contentFilters" yaml:"contentFilters"`
// The tier configuration to apply to the guardrail.
// Default: filters.TierConfig.CLASSIC
//
// Experimental.
ContentFiltersTierConfig TierConfig `field:"optional" json:"contentFiltersTierConfig" yaml:"contentFiltersTierConfig"`
// The contextual grounding filters to apply to the guardrail.
// Default: [].
//
// Experimental.
ContextualGroundingFilters *[]*ContextualGroundingFilter `field:"optional" json:"contextualGroundingFilters" yaml:"contextualGroundingFilters"`
// The cross-region configuration for the guardrail.
//
// This is optional and when provided, it should be of type GuardrailCrossRegionConfigProperty.
// Default: - No cross-region configuration.
//
// Experimental.
CrossRegionConfig *GuardrailCrossRegionConfigProperty `field:"optional" json:"crossRegionConfig" yaml:"crossRegionConfig"`
// A list of policies related to topics that the guardrail should deny.
// Default: [].
//
// Experimental.
DeniedTopics *[]Topic `field:"optional" json:"deniedTopics" yaml:"deniedTopics"`
// The description of the guardrail.
// Default: - No description.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// A custom KMS key to use for encrypting data.
// Default: - Data is encrypted by default with a key that AWS owns and manages for you.
//
// Experimental.
KmsKey awskms.IKey `field:"optional" json:"kmsKey" yaml:"kmsKey"`
// The managed word filters to apply to the guardrail.
// Default: [].
//
// Experimental.
ManagedWordListFilters *[]*ManagedWordFilter `field:"optional" json:"managedWordListFilters" yaml:"managedWordListFilters"`
// The PII filters to apply to the guardrail.
// Default: [].
//
// Experimental.
PiiFilters *[]*PIIFilter `field:"optional" json:"piiFilters" yaml:"piiFilters"`
// The regular expression (regex) filters to apply to the guardrail.
// Default: [].
//
// Experimental.
RegexFilters *[]*RegexFilter `field:"optional" json:"regexFilters" yaml:"regexFilters"`
// The tier configuration to apply to the guardrail.
// Default: filters.TierConfig.CLASSIC
//
// Experimental.
TopicsTierConfig TierConfig `field:"optional" json:"topicsTierConfig" yaml:"topicsTierConfig"`
// The word filters to apply to the guardrail.
// Default: [].
//
// Experimental.
WordFilters *[]*WordFilter `field:"optional" json:"wordFilters" yaml:"wordFilters"`
}
Properties for creating a Guardrail.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add regex filter with input/output actions
guardrail.AddRegexFilter(&RegexFilter{
Name: jsii.String("TestRegexFilter"),
Pattern: jsii.String("test-pattern"),
Action: bedrock.GuardrailAction_ANONYMIZE,
// below props are optional
Description: jsii.String("This is a test regex filter"),
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
Experimental.
type IAgent ¶
type IAgent interface {
awsiam.IGrantable
awscdk.IResource
// Grant invoke permissions on this agent to an IAM principal.
//
// Note: This grant will only work when the grantee is in the same AWS account
// where the agent is defined. Cross-account invocation is not supported.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Return the CloudWatch metric for agent count.
// Experimental.
MetricCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Defines a CloudWatch event rule triggered by agent events.
// Experimental.
OnEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// The ARN of the agent.
// Experimental.
AgentArn() *string
// The ID of the Agent.
// Experimental.
AgentId() *string
// Optional KMS encryption key associated with this agent.
// Experimental.
KmsKey() awskms.IKey
// When this agent was last updated.
// Experimental.
LastUpdated() *string
// The IAM role associated to the agent.
// Experimental.
Role() awsiam.IRole
}
Represents an Agent, either created with CDK or imported. Experimental.
func Agent_FromAgentAttributes ¶
func Agent_FromAgentAttributes(scope constructs.Construct, id *string, attrs *AgentAttributes) IAgent
Creates an Agent reference from an existing agent's attributes.
Returns: An IAgent reference to the existing agent. Default: - For attrs.agentVersion: 'DRAFT' if no explicit version is provided
Experimental.
type IAgentAlias ¶
type IAgentAlias interface {
awscdk.IResource
// Grant the given principal identity permissions to perform actions on this agent alias.
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to get the agent alias.
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Grant the given identity permissions to invoke the agent alias.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Define an EventBridge rule that triggers when something happens to this agent alias.
//
// Requires that there exists at least one CloudTrail Trail in your account
// that captures the event. This method will not create the Trail.
// Experimental.
OnCloudTrailEvent(id *string, options *awsevents.OnEventOptions) awsevents.Rule
// The underlying agent for this alias.
// Experimental.
Agent() IAgent
// The ARN of the agent alias.
// Experimental.
AliasArn() *string
// The unique identifier of the agent alias.
// Experimental.
AliasId() *string
}
Represents an Agent Alias, either created with CDK or imported. Experimental.
func AgentAlias_FromAttributes ¶
func AgentAlias_FromAttributes(scope constructs.Construct, id *string, attrs *AgentAliasAttributes) IAgentAlias
Brings an Agent Alias from an existing one created outside of CDK. Experimental.
type IBedrockInvokable ¶
type IBedrockInvokable interface {
// Gives the appropriate policies to invoke and use the invokable abstraction.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// The ARN of the Bedrock invokable abstraction.
// Experimental.
InvokableArn() *string
}
Represents an Amazon Bedrock abstraction on which you can run the `Invoke` API.
This can be a Foundational Model, a Custom Model, or an Inference Profile. Experimental.
type IGuardrail ¶
type IGuardrail interface {
awscdk.IResource
// Grant the given principal identity permissions to perform actions on this guardrail.
// Experimental.
Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
// Grant the given identity permissions to apply the guardrail.
// Experimental.
GrantApply(grantee awsiam.IGrantable) awsiam.Grant
// Return the given named metric for this guardrail.
// Experimental.
Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation client errors metric for this guardrail.
// Experimental.
MetricInvocationClientErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation latency metric for this guardrail.
// Experimental.
MetricInvocationLatency(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations metric for this guardrail.
// Experimental.
MetricInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation server errors metric for this guardrail.
// Experimental.
MetricInvocationServerErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocations intervened metric for this guardrail.
// Experimental.
MetricInvocationsIntervened(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the invocation throttles metric for this guardrail.
// Experimental.
MetricInvocationThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Return the text unit count metric for this guardrail.
// Experimental.
MetricTextUnitCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// The ARN of the guardrail.
// Experimental.
GuardrailArn() *string
// The ID of the guardrail.
// Experimental.
GuardrailId() *string
// The version of the guardrail.
//
// If no explicit version is created,
// this will default to "DRAFT".
// Experimental.
GuardrailVersion() *string
// Optional KMS encryption key associated with this guardrail.
// Experimental.
KmsKey() awskms.IKey
// When this guardrail was last updated.
// Experimental.
LastUpdated() *string
}
Represents a Guardrail, either created with CDK or imported. Experimental.
func Guardrail_FromCfnGuardrail ¶
func Guardrail_FromCfnGuardrail(cfnGuardrail awsbedrock.CfnGuardrail) IGuardrail
Import a low-level L1 Cfn Guardrail. Experimental.
func Guardrail_FromGuardrailAttributes ¶
func Guardrail_FromGuardrailAttributes(scope constructs.Construct, id *string, attrs *GuardrailAttributes) IGuardrail
Import a guardrail given its attributes. Experimental.
type IInferenceProfile ¶
type IInferenceProfile interface {
// Grants appropriate permissions to use the inference profile.
//
// Each profile type requires different permissions based on its usage pattern.
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantProfileUsage(grantee awsiam.IGrantable) awsiam.Grant
// The ARN of the inference profile.
// Experimental.
InferenceProfileArn() *string
// The unique identifier of the inference profile.
// Experimental.
InferenceProfileId() *string
// The type of inference profile.
// Experimental.
Type() InferenceProfileType
}
Represents an Inference Profile, either created with CDK or imported. Experimental.
func ApplicationInferenceProfile_FromApplicationInferenceProfileAttributes ¶
func ApplicationInferenceProfile_FromApplicationInferenceProfileAttributes(scope constructs.Construct, id *string, attrs *ApplicationInferenceProfileAttributes) IInferenceProfile
Import an Application Inference Profile given its attributes.
[disable-awslint:no-grants].
Returns: An IInferenceProfile reference to the existing application inference profile. Experimental.
func ApplicationInferenceProfile_FromCfnApplicationInferenceProfile ¶
func ApplicationInferenceProfile_FromCfnApplicationInferenceProfile(cfnApplicationInferenceProfile awsbedrock.CfnApplicationInferenceProfile) IInferenceProfile
Import a low-level L1 Cfn Application Inference Profile.
[disable-awslint:no-grants].
Returns: An IInferenceProfile reference to the imported application inference profile. Experimental.
type IPrompt ¶
type IPrompt interface {
awscdk.IResource
// Grant the given identity permissions to get the prompt.
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Optional KMS encryption key associated with this prompt.
// Experimental.
KmsKey() awskms.IKey
// The ARN of the prompt.
//
// Example:
// "arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345"
//
// Experimental.
PromptArn() *string
// The ID of the prompt.
//
// Example:
// "PROMPT12345"
//
// Experimental.
PromptId() *string
// The version of the prompt.
// Default: "DRAFT".
//
// Experimental.
PromptVersion() *string
}
Represents a Prompt, either created with CDK or imported. Experimental.
func Prompt_FromPromptAttributes ¶
func Prompt_FromPromptAttributes(scope constructs.Construct, id *string, attrs *PromptAttributes) IPrompt
Creates a Prompt reference from an existing prompt's attributes.
Returns: An IPrompt reference to the existing prompt. Default: - For attrs.promptVersion: 'DRAFT' if no explicit version is provided
Experimental.
type IPromptRouter ¶
type IPromptRouter interface {
// The ARN of the prompt router.
// Experimental.
PromptRouterArn() *string
// The ID of the prompt router.
// Experimental.
PromptRouterId() *string
// The foundation models / profiles this router will route to.
// Experimental.
RoutingEndpoints() *[]IBedrockInvokable
}
Represents a Prompt Router, which provides intelligent routing between different models. Experimental.
type IPromptVariant ¶
type IPromptVariant interface {
// The generative AI resource configuration.
// Experimental.
GenAiResource() PromptGenAiResource
// The inference configuration.
// Experimental.
InferenceConfiguration() PromptInferenceConfiguration
// The unique identifier of the model with which to run inference on the prompt.
// Experimental.
ModelId() *string
// The name of the prompt variant.
// Experimental.
Name() *string
// The template configuration.
// Experimental.
TemplateConfiguration() PromptTemplateConfiguration
// The type of prompt template.
// Default: - Text.
//
// Experimental.
TemplateType() PromptTemplateType
}
Interface representing a prompt variant configuration.
Variants are specific sets of inputs that guide FMs on Amazon Bedrock to generate an appropriate response or output for a given task or instruction. Experimental.
func PromptVariant_Agent ¶
func PromptVariant_Agent(props *AgentPromptVariantProps) IPromptVariant
Creates an agent prompt template variant.
Returns: A PromptVariant configured for agent interactions. Experimental.
func PromptVariant_Chat ¶
func PromptVariant_Chat(props *ChatPromptVariantProps) IPromptVariant
Creates a chat template variant.
Use this template type when the model supports the Converse API or the Anthropic Claude Messages API. This allows you to include a System prompt and previous User messages and Assistant messages for context.
Returns: A PromptVariant configured for chat interactions. Experimental.
func PromptVariant_Text ¶
func PromptVariant_Text(props *TextPromptVariantProps) IPromptVariant
Creates a text template variant.
Returns: A PromptVariant configured for text processing. Experimental.
type InferenceConfiguration ¶
type InferenceConfiguration struct {
// The maximum number of tokens to generate in the response.
//
// Integer
//
// min 0
// max 4096.
// Experimental.
MaximumLength *float64 `field:"required" json:"maximumLength" yaml:"maximumLength"`
// A list of stop sequences.
//
// A stop sequence is a sequence of characters that
// causes the model to stop generating the response.
//
// length 0-4.
// Experimental.
StopSequences *[]*string `field:"required" json:"stopSequences" yaml:"stopSequences"`
// The likelihood of the model selecting higher-probability options while generating a response.
//
// A lower value makes the model more likely to choose
// higher-probability options, while a higher value makes the model more
// likely to choose lower-probability options.
//
// Floating point
//
// min 0
// max 1.
// Experimental.
Temperature *float64 `field:"required" json:"temperature" yaml:"temperature"`
// While generating a response, the model determines the probability of the following token at each point of generation.
//
// The value that you set for
// topK is the number of most-likely candidates from which the model chooses
// the next token in the sequence. For example, if you set topK to 50, the
// model selects the next token from among the top 50 most likely choices.
//
// Integer
//
// min 0
// max 500.
// Experimental.
TopK *float64 `field:"required" json:"topK" yaml:"topK"`
// While generating a response, the model determines the probability of the following token at each point of generation.
//
// The value that you set for
// Top P determines the number of most-likely candidates from which the model
// chooses the next token in the sequence. For example, if you set topP to
// 80, the model only selects the next token from the top 80% of the
// probability distribution of next tokens.
//
// Floating point
//
// min 0
// max 1.
// Experimental.
TopP *float64 `field:"required" json:"topP" yaml:"topP"`
}
LLM inference configuration.
Example:
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_FromSteps([]PromptStepConfigBase{
&PromptStepConfigBase{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
StepEnabled: jsii.Boolean(true),
CustomPromptTemplate: jsii.String("Your custom prompt template here"),
InferenceConfig: &InferenceConfiguration{
Temperature: jsii.Number(0),
TopP: jsii.Number(1),
TopK: jsii.Number(250),
MaximumLength: jsii.Number(1),
StopSequences: []*string{
jsii.String("\n\nHuman:"),
},
},
},
}),
})
Experimental.
type InferenceProfileBase ¶
type InferenceProfileBase interface {
awscdk.Resource
IInferenceProfile
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The ARN of the inference profile.
// Experimental.
InferenceProfileArn() *string
// The unique identifier of the inference profile.
// Experimental.
InferenceProfileId() *string
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// The type of inference profile (SYSTEM_DEFINED or APPLICATION).
// Experimental.
Type() InferenceProfileType
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grants appropriate permissions to use the inference profile.
//
// Each profile type requires different permissions based on its usage pattern:
// - Application profiles need bedrock:InvokeModel for direct invocation
// - Cross-region profiles need bedrock:InvokeModel* for routing capabilities
//
// Note: This does not grant permissions to use the underlying model in the profile.
// For comprehensive model invocation permissions, use the grantInvoke method instead.
//
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantProfileUsage(grantee awsiam.IGrantable) awsiam.Grant
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Abstract base class for an Inference Profile.
Contains methods and attributes valid for Inference Profiles either created with CDK or imported. Experimental.
type InferenceProfileType ¶
type InferenceProfileType string
These are the values used by the API when using aws bedrock get-inference-profile --inference-profile-identifier XXXXXXX. Experimental.
const ( // An inference profile that is created by AWS. // // These are profiles such as cross-region // which help you distribute traffic across a geographic region. // Experimental. InferenceProfileType_SYSTEM_DEFINED InferenceProfileType = "SYSTEM_DEFINED" // An inference profile that is user-created. // // These are profiles that help // you track costs or metrics. // Experimental. InferenceProfileType_APPLICATION InferenceProfileType = "APPLICATION" )
type InformationTechnologyPIIType ¶
type InformationTechnologyPIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII in the domain of IT (Information Technology).
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
func InformationTechnologyPIIType_AWS_ACCESS_KEY ¶
func InformationTechnologyPIIType_AWS_ACCESS_KEY() InformationTechnologyPIIType
func InformationTechnologyPIIType_AWS_SECRET_KEY ¶
func InformationTechnologyPIIType_AWS_SECRET_KEY() InformationTechnologyPIIType
func InformationTechnologyPIIType_IP_ADDRESS ¶
func InformationTechnologyPIIType_IP_ADDRESS() InformationTechnologyPIIType
func InformationTechnologyPIIType_MAC_ADDRESS ¶
func InformationTechnologyPIIType_MAC_ADDRESS() InformationTechnologyPIIType
func InformationTechnologyPIIType_URL ¶
func InformationTechnologyPIIType_URL() InformationTechnologyPIIType
type InlineApiSchema ¶
type InlineApiSchema interface {
ApiSchema
// The inline OpenAPI schema definition as a string, if using an inline schema.
//
// Can be in JSON or YAML format.
// Experimental.
InlineSchema() *string
// The S3 location of the API schema file, if using an S3-based schema.
//
// Contains the bucket name and object key information.
// Experimental.
S3File() *awss3.Location
}
Class to define an API Schema from an inline string.
The schema can be provided directly as a string in either JSON or YAML format.
Example:
inlineSchema := bedrock.ApiSchema_FromInline(jsii.String(`
openapi: 3.0.3
info:
title: Library API
version: 1.0.0
paths:
/search:
get:
summary: Search for books
operationId: searchBooks
parameters:
- name: query
in: query
required: true
schema:
type: string
`))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: inlineSchema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
func ApiSchema_FromInline ¶
func ApiSchema_FromInline(schema *string) InlineApiSchema
Creates an API Schema from an inline string. Experimental.
func AssetApiSchema_FromInline ¶
func AssetApiSchema_FromInline(schema *string) InlineApiSchema
Creates an API Schema from an inline string. Experimental.
func InlineApiSchema_FromInline ¶
func InlineApiSchema_FromInline(schema *string) InlineApiSchema
Creates an API Schema from an inline string. Experimental.
func S3ApiSchema_FromInline ¶
func S3ApiSchema_FromInline(schema *string) InlineApiSchema
Creates an API Schema from an inline string. Experimental.
type ManagedWordFilter ¶
type ManagedWordFilter struct {
// The action to take when a managed word is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the managed word filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The action to take when a managed word is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the managed word filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
// The type of managed word filter.
// Default: ManagedWordFilterType.PROFANITY
//
// Experimental.
Type ManagedWordFilterType `field:"optional" json:"type" yaml:"type"`
}
Interface for managed word list filters.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add managed word list with input/output actions
guardrail.AddManagedWordListFilter(&ManagedWordFilter{
Type: bedrock.ManagedWordFilterType_PROFANITY,
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
})
// Add individual words
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("drugs"),
})
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("competitor"),
})
// Add words from a file
guardrail.AddWordFilterFromFile(jsii.String("./scripts/wordsPolicy.csv"))
Experimental.
type ManagedWordFilterType ¶
type ManagedWordFilterType string
Managed word list filter types supported by Amazon Bedrock.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add managed word list with input/output actions
guardrail.AddManagedWordListFilter(&ManagedWordFilter{
Type: bedrock.ManagedWordFilterType_PROFANITY,
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
})
// Add individual words
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("drugs"),
})
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("competitor"),
})
// Add words from a file
guardrail.AddWordFilterFromFile(jsii.String("./scripts/wordsPolicy.csv"))
Experimental.
const ( // Filter for profanity and explicit language. // Experimental. ManagedWordFilterType_PROFANITY ManagedWordFilterType = "PROFANITY" )
type Memory ¶
type Memory interface {
}
Memory class for managing Bedrock Agent memory configurations.
Enables conversational context retention across multiple sessions through session identifiers. Memory context is stored with unique memory IDs per user, allowing access to conversation history and summaries. Supports viewing stored sessions and clearing memory.
Example:
agent := bedrock.NewAgent(this, jsii.String("MyAgent"), &AgentProps{
AgentName: jsii.String("MyAgent"),
Instruction: jsii.String("Your instruction here"),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Memory: awsbedrockalpha.Memory_SessionSummary(&SessionSummaryMemoryProps{
MaxRecentSessions: jsii.Number(10),
// Keep the last 10 session summaries
MemoryDuration: awscdk.Duration_Days(jsii.Number(20)),
}),
})
See: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-memory.html
Experimental.
func Memory_SESSION_SUMMARY ¶
func Memory_SESSION_SUMMARY() Memory
func Memory_SessionSummary ¶
func Memory_SessionSummary(props *SessionSummaryMemoryProps) Memory
Creates a session summary memory with custom configuration.
Returns: Memory instance. Experimental.
type ModalityType ¶
type ModalityType string
The type of modality that can be used in content filters.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
// Configure tier for content filters (optional)
ContentFiltersTierConfig: bedrock.TierConfig_STANDARD,
})
guardrail.AddContentFilter(&ContentFilter{
Type: bedrock.ContentFilterType_SEXUAL,
InputStrength: bedrock.ContentFilterStrength_HIGH,
OutputStrength: bedrock.ContentFilterStrength_MEDIUM,
// props below are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
InputModalities: []ModalityType{
bedrock.ModalityType_TEXT,
bedrock.ModalityType_IMAGE,
},
OutputModalities: []ModalityType{
bedrock.ModalityType_TEXT,
},
})
Experimental.
const ( // Text modality for content filters. // Experimental. ModalityType_TEXT ModalityType = "TEXT" // Image modality for content filters. // Experimental. ModalityType_IMAGE ModalityType = "IMAGE" )
type OrchestrationType ¶
type OrchestrationType string
Enum for orchestration types available for agents. Experimental.
const ( // Default orchestration by the agent. // Experimental. OrchestrationType_DEFAULT OrchestrationType = "DEFAULT" // Custom orchestration using Lambda. // Experimental. OrchestrationType_CUSTOM_ORCHESTRATION OrchestrationType = "CUSTOM_ORCHESTRATION" )
type PIIFilter ¶
type PIIFilter struct {
// The action to take when PII is detected.
// Experimental.
Action GuardrailAction `field:"required" json:"action" yaml:"action"`
// The type of PII to filter.
// Experimental.
Type PIIType `field:"required" json:"type" yaml:"type"`
// The action to take when PII is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the PII filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The action to take when PII is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the PII filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
}
Interface to define a PII Filter.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
type PIIType ¶
type PIIType interface {
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Abstract base class for all PII types.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
type ParameterType ¶
type ParameterType string
Enum for parameter types in function schemas.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// Define a function schema with parameters
functionSchema := bedrock.NewFunctionSchema(&FunctionSchemaProps{
Functions: []FunctionProps{
&FunctionProps{
Name: jsii.String("searchBooks"),
Description: jsii.String("Search for books in the library catalog"),
Parameters: map[string]FunctionParameterProps{
"query": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The search query string"),
},
"maxResults": &FunctionParameterProps{
"type": bedrock.ParameterType_INTEGER,
"required": jsii.Boolean(false),
"description": jsii.String("Maximum number of results to return"),
},
"includeOutOfPrint": &FunctionParameterProps{
"type": bedrock.ParameterType_BOOLEAN,
"required": jsii.Boolean(false),
"description": jsii.String("Whether to include out-of-print books"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_DISABLED,
},
&FunctionProps{
Name: jsii.String("getBookDetails"),
Description: jsii.String("Get detailed information about a specific book"),
Parameters: map[string]FunctionParameterProps{
"bookId": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The unique identifier of the book"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_ENABLED,
},
},
})
// Create an action group using the function schema
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("library-functions"),
Description: jsii.String("Functions for interacting with the library catalog"),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
FunctionSchema: functionSchema,
Enabled: jsii.Boolean(true),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
ActionGroups: []AgentActionGroup{
actionGroup,
},
})
Experimental.
const ( // String parameter type. // Experimental. ParameterType_STRING ParameterType = "STRING" // Number parameter type. // Experimental. ParameterType_NUMBER ParameterType = "NUMBER" // Integer parameter type. // Experimental. ParameterType_INTEGER ParameterType = "INTEGER" // Boolean parameter type. // Experimental. ParameterType_BOOLEAN ParameterType = "BOOLEAN" // Array parameter type. // Experimental. ParameterType_ARRAY ParameterType = "ARRAY" // Object parameter type. // Experimental. ParameterType_OBJECT ParameterType = "OBJECT" )
type ParentActionGroupSignature ¶
type ParentActionGroupSignature interface {
// The AWS-defined signature value for this action group capability.
// Experimental.
Value() *string
// Returns the string representation of the signature value.
//
// Used when configuring the action group in CloudFormation.
// Experimental.
ToString() *string
}
AWS Defined signatures for enabling certain capabilities in your agent.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
parentActionGroupSignature := bedrock_alpha.NewParentActionGroupSignature(jsii.String("value"))
Experimental.
func NewParentActionGroupSignature ¶
func NewParentActionGroupSignature(value *string) ParentActionGroupSignature
Constructor should be used as a temporary solution when a new signature is supported but its implementation in CDK hasn't been added yet. Experimental.
func ParentActionGroupSignature_CODE_INTERPRETER ¶
func ParentActionGroupSignature_CODE_INTERPRETER() ParentActionGroupSignature
func ParentActionGroupSignature_USER_INPUT ¶
func ParentActionGroupSignature_USER_INPUT() ParentActionGroupSignature
type Prompt ¶
type Prompt interface {
PromptBase
IPrompt
// The description of the prompt.
// Experimental.
Description() *string
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// The KMS key that the prompt is encrypted with.
// Experimental.
KmsKey() awskms.IKey
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The ARN of the prompt.
//
// Example:
// "arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345"
//
// Experimental.
PromptArn() *string
// The ID of the prompt.
//
// Example:
// "PROMPT12345"
//
// Experimental.
PromptId() *string
// The name of the prompt.
// Experimental.
PromptName() *string
// The version of the prompt.
// Experimental.
PromptVersion() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// The variants of the prompt.
// Experimental.
Variants() *[]IPromptVariant
// Adds a prompt variant to the prompt.
// Experimental.
AddVariant(variant IPromptVariant)
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Creates a prompt version, a static snapshot of your prompt that can be deployed to production.
//
// Returns: A PromptVersion object containing the version details including ARN and version string.
// Default: - No description provided.
//
// Experimental.
CreateVersion(description *string) PromptVersion
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given identity permissions to get the prompt.
//
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Default: - Default grant configuration:
// - actions: ['bedrock:GetPrompt']
// - resourceArns: [this.promptArn]
//
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create (or import) a Prompt with CDK.
Prompts are a specific set of inputs that guide Foundation Models (FMs) on Amazon Bedrock to generate an appropriate response or output for a given task or instruction. You can optimize the prompt for specific use cases and models.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html
Experimental.
func NewPrompt ¶
func NewPrompt(scope constructs.Construct, id *string, props *PromptProps) Prompt
**************************************************************************** CONSTRUCTOR ***************************************************************************. Experimental.
type PromptAttributes ¶
type PromptAttributes struct {
// The ARN of the prompt.
//
// Example:
// "arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345"
//
// Experimental.
PromptArn *string `field:"required" json:"promptArn" yaml:"promptArn"`
// Optional KMS encryption key associated with this prompt.
// Default: undefined - An AWS managed key is used.
//
// Experimental.
KmsKey awskms.IKey `field:"optional" json:"kmsKey" yaml:"kmsKey"`
// The version of the prompt.
// Default: "DRAFT".
//
// Experimental.
PromptVersion *string `field:"optional" json:"promptVersion" yaml:"promptVersion"`
}
Attributes for specifying an imported Bedrock Prompt.
Example:
// Import an existing prompt by ARN
importedPrompt := bedrock.Prompt_FromPromptAttributes(this, jsii.String("ImportedPrompt"), &PromptAttributes{
PromptArn: jsii.String("arn:aws:bedrock:region:account:prompt/prompt-id"),
KmsKey: kms.Key_FromKeyArn(this, jsii.String("ImportedKey"), jsii.String("arn:aws:kms:region:account:key/key-id")),
// optional
PromptVersion: jsii.String("1"),
})
Experimental.
type PromptBase ¶
type PromptBase interface {
awscdk.Resource
IPrompt
// The environment this resource belongs to.
//
// For resources that are created and managed in a Stack (those created by
// creating new class instances like `new Role()`, `new Bucket()`, etc.), this
// is always the same as the environment of the stack they belong to.
//
// For referenced resources (those obtained from referencing methods like
// `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
// different than the stack they were imported into.
// Experimental.
Env() *interfaces.ResourceEnvironment
// Optional KMS encryption key associated with this prompt.
// Experimental.
KmsKey() awskms.IKey
// The tree node.
// Experimental.
Node() constructs.Node
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The ARN of the prompt.
// Experimental.
PromptArn() *string
// The ID of the prompt.
// Experimental.
PromptId() *string
// The version of the prompt.
// Experimental.
PromptVersion() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given identity permissions to get the prompt.
//
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Default: - Default grant configuration:
// - actions: ['bedrock:GetPrompt']
// - resourceArns: [this.promptArn]
//
// Experimental.
GrantGet(grantee awsiam.IGrantable) awsiam.Grant
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Abstract base class for a Prompt.
Contains methods and attributes valid for Prompts either created with CDK or imported. Experimental.
type PromptGenAiResource ¶
type PromptGenAiResource interface {
}
Abstract base class for prompt GenAI resource configurations.
This provides a high-level abstraction over the underlying CloudFormation GenAI resource properties, offering a more developer-friendly interface while maintaining full compatibility with the underlying AWS Bedrock service.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var agentAlias AgentAlias
promptGenAiResource := bedrock_alpha.PromptGenAiResource_Agent(&AgentGenAiResourceProps{
AgentAlias: agentAlias,
})
Experimental.
func PromptGenAiResource_Agent ¶
func PromptGenAiResource_Agent(props *AgentGenAiResourceProps) PromptGenAiResource
Creates an agent GenAI resource configuration. Experimental.
type PromptInferenceConfiguration ¶
type PromptInferenceConfiguration interface {
}
Abstract base class for prompt inference configurations.
This provides a high-level abstraction over the underlying CloudFormation inference configuration properties, offering a more developer-friendly interface while maintaining full compatibility with the underlying AWS Bedrock service.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
Experimental.
func PromptInferenceConfiguration_Text ¶
func PromptInferenceConfiguration_Text(props *PromptInferenceConfigurationProps) PromptInferenceConfiguration
Creates a text inference configuration. Experimental.
type PromptInferenceConfigurationProps ¶
type PromptInferenceConfigurationProps struct {
// The maximum number of tokens to return in the response.
// Default: - No limit specified.
//
// Experimental.
MaxTokens *float64 `field:"optional" json:"maxTokens" yaml:"maxTokens"`
// A list of strings that define sequences after which the model will stop generating.
// Default: - No stop sequences.
//
// Experimental.
StopSequences *[]*string `field:"optional" json:"stopSequences" yaml:"stopSequences"`
// Controls the randomness of the response.
//
// Higher values make output more random, lower values more deterministic.
// Valid range is 0.0 to 1.0.
// Default: - Model default temperature.
//
// Experimental.
Temperature *float64 `field:"optional" json:"temperature" yaml:"temperature"`
// The percentage of most-likely candidates that the model considers for the next token.
//
// Valid range is 0.0 to 1.0.
// Default: - Model default topP.
//
// Experimental.
TopP *float64 `field:"optional" json:"topP" yaml:"topP"`
}
Properties for creating a prompt inference configuration.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
Experimental.
type PromptKnowledgeBaseResponseGenerationConfigCustomParser ¶
type PromptKnowledgeBaseResponseGenerationConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Configuration for the knowledge base response generation step.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
promptKnowledgeBaseResponseGenerationConfigCustomParser := &PromptKnowledgeBaseResponseGenerationConfigCustomParser{
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptMemorySummarizationConfigCustomParser ¶
type PromptMemorySummarizationConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Configuration for the memory summarization step.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
promptMemorySummarizationConfigCustomParser := &PromptMemorySummarizationConfigCustomParser{
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptOrchestrationConfigCustomParser ¶
type PromptOrchestrationConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Configuration for the orchestration step.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
promptOrchestrationConfigCustomParser := &PromptOrchestrationConfigCustomParser{
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptOverrideConfiguration ¶
type PromptOverrideConfiguration interface {
// Configuration for the knowledge base response generation step.
// Experimental.
KnowledgeBaseResponseGenerationStep() *PromptKnowledgeBaseResponseGenerationConfigCustomParser
// Configuration for the memory summarization step.
// Experimental.
MemorySummarizationStep() *PromptMemorySummarizationConfigCustomParser
// Configuration for the orchestration step.
// Experimental.
OrchestrationStep() *PromptOrchestrationConfigCustomParser
// The custom Lambda parser function to use.
//
// The Lambda parser processes and interprets the raw foundation model output.
// It receives an input event with:
// - messageVersion: Version of message format (1.0)
// - agent: Info about the agent (name, id, alias, version)
// - invokeModelRawResponse: Raw model output to parse
// - promptType: Type of prompt being parsed
// - overrideType: Type of override (OUTPUT_PARSER)
//
// The Lambda must return a response that the agent uses for next actions.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/lambda-parser.html
//
// Experimental.
Parser() awslambda.IFunction
// Configuration for the post-processing step.
// Experimental.
PostProcessingStep() *PromptPostProcessingConfigCustomParser
// Configuration for the pre-processing step.
// Experimental.
PreProcessingStep() *PromptPreProcessingConfigCustomParser
// Configuration for the routing classifier step.
// Experimental.
RoutingClassifierStep() *PromptRoutingClassifierConfigCustomParser
}
Configuration for overriding prompt templates and behaviors in different parts of an agent's sequence.
This allows customizing how the agent processes inputs, makes decisions, and generates responses.
Example:
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_FromSteps([]PromptStepConfigBase{
&PromptRoutingClassifierConfigCustomParser{
StepType: bedrock.AgentStepType_ROUTING_CLASSIFIER,
StepEnabled: jsii.Boolean(true),
CustomPromptTemplate: jsii.String("Your routing template here"),
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_V2(),
}.(PromptRoutingClassifierConfigCustomParser),
}),
})
Experimental.
func PromptOverrideConfiguration_FromSteps ¶
func PromptOverrideConfiguration_FromSteps(steps *[]*PromptStepConfigBase) PromptOverrideConfiguration
Creates a PromptOverrideConfiguration from individual step configurations.
Use this method when you want to override prompts without using a custom parser.
Returns: A new PromptOverrideConfiguration instance. Experimental.
func PromptOverrideConfiguration_WithCustomParser ¶
func PromptOverrideConfiguration_WithCustomParser(props *CustomParserProps) PromptOverrideConfiguration
Creates a PromptOverrideConfiguration with a custom Lambda parser function. Experimental.
type PromptPostProcessingConfigCustomParser ¶
type PromptPostProcessingConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Configuration for the post-processing step.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
promptPostProcessingConfigCustomParser := &PromptPostProcessingConfigCustomParser{
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptPreProcessingConfigCustomParser ¶
type PromptPreProcessingConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Configuration for the pre-processing step.
Example:
parserFunction := lambda.NewFunction(this, jsii.String("ParserFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_10(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(jsii.String("lambda")),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Instruction: jsii.String("You are a helpful assistant."),
PromptOverrideConfiguration: bedrock.PromptOverrideConfiguration_WithCustomParser(&CustomParserProps{
Parser: parserFunction,
PreProcessingStep: &PromptPreProcessingConfigCustomParser{
StepType: bedrock.AgentStepType_PRE_PROCESSING,
UseCustomParser: jsii.Boolean(true),
},
}),
})
Experimental.
type PromptProps ¶
type PromptProps struct {
// The name of the prompt.
//
// This will be used as the physical name of the prompt.
// Allowed Pattern: ^([0-9a-zA-Z][_-]?){1,100}$
// Experimental.
PromptName *string `field:"required" json:"promptName" yaml:"promptName"`
// The Prompt Variant that will be used by default.
// Default: - No default variant provided.
//
// Experimental.
DefaultVariant IPromptVariant `field:"optional" json:"defaultVariant" yaml:"defaultVariant"`
// A description of what the prompt does.
// Default: - No description provided.
// Maximum Length: 200.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// The KMS key that the prompt is encrypted with.
// Default: - AWS owned and managed key.
//
// Experimental.
KmsKey awskms.IKey `field:"optional" json:"kmsKey" yaml:"kmsKey"`
// Tags to apply to the prompt.
// Default: - No tags applied.
//
// Experimental.
Tags *map[string]*string `field:"optional" json:"tags" yaml:"tags"`
// The variants of your prompt.
//
// Variants can use different messages, models,
// or configurations so that you can compare their outputs to decide the best
// variant for your use case. Maximum of 1 variants.
// Default: - No additional variants provided.
//
// Experimental.
Variants *[]IPromptVariant `field:"optional" json:"variants" yaml:"variants"`
}
Properties for creating a CDK managed Bedrock Prompt.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
Experimental.
type PromptRouter ¶
type PromptRouter interface {
IBedrockInvokable
IPromptRouter
// The ARN used for invoking this prompt router.
//
// This equals to the promptRouterArn property, useful for implementing IBedrockInvokable interface.
// Experimental.
InvokableArn() *string
// The ARN of the prompt router.
// Experimental.
PromptRouterArn() *string
// The ID of the prompt router.
// Experimental.
PromptRouterId() *string
// The inference endpoints (cross-region profiles) that this router will route to.
//
// These are created automatically based on the routing models and region.
// Experimental.
RoutingEndpoints() *[]IBedrockInvokable
// Grants the necessary permissions to invoke this prompt router and all its routing endpoints.
//
// This method grants permissions to:
// - Get prompt router details (bedrock:GetPromptRouter)
// - Invoke models through the router (bedrock:InvokeModel)
// - Use all underlying models and cross-region profiles
// [disable-awslint:no-grants].
//
// Returns: An IAM Grant object representing the granted permissions.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
}
Amazon Bedrock intelligent prompt routing provides a single serverless endpoint for efficiently routing requests between different foundational models within the same model family.
It can help you optimize for response quality and cost.
Intelligent prompt routing predicts the performance of each model for each request, and dynamically routes each request to the model that it predicts is most likely to give the desired response at the lowest cost.
Example:
// Create a prompt router for intelligent model selection
promptRouter := bedrock.PromptRouter_FromDefaultId(bedrock.DefaultPromptRouterIdentifier_ANTHROPIC_CLAUDE_V1(), jsii.String("us-east-1"))
// Use the prompt router with a prompt variant
variant := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
PromptText: jsii.String("What is the capital of France?"),
Model: promptRouter,
})
bedrock.NewPrompt(this, jsii.String("Prompt"), &PromptProps{
PromptName: jsii.String("prompt-router-test"),
Variants: []IPromptVariant{
variant,
},
})
See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-routing.html
Experimental.
func NewPromptRouter ¶
func NewPromptRouter(props *PromptRouterProps, region *string) PromptRouter
Experimental.
func PromptRouter_FromDefaultId ¶
func PromptRouter_FromDefaultId(defaultRouter DefaultPromptRouterIdentifier, region *string) PromptRouter
Creates a PromptRouter from a default router identifier.
Returns: A new PromptRouter instance configured with the default settings. Experimental.
type PromptRouterProps ¶
type PromptRouterProps struct {
// Prompt Router ID that identifies the routing configuration.
// Experimental.
PromptRouterId *string `field:"required" json:"promptRouterId" yaml:"promptRouterId"`
// The foundation models this router will route to.
//
// The router will intelligently select between these models based on the request.
// Experimental.
RoutingModels *[]BedrockFoundationModel `field:"required" json:"routingModels" yaml:"routingModels"`
}
Properties for configuring a Prompt Router.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var bedrockFoundationModel BedrockFoundationModel
promptRouterProps := &PromptRouterProps{
PromptRouterId: jsii.String("promptRouterId"),
RoutingModels: []BedrockFoundationModel{
bedrockFoundationModel,
},
}
Experimental.
type PromptRoutingClassifierConfigCustomParser ¶
type PromptRoutingClassifierConfigCustomParser struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
// The foundation model to use for the routing classifier step.
//
// This is required for the routing classifier step.
// Experimental.
FoundationModel IBedrockInvokable `field:"required" json:"foundationModel" yaml:"foundationModel"`
}
Configuration for the routing classifier step.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var bedrockInvokable IBedrockInvokable
promptRoutingClassifierConfigCustomParser := &PromptRoutingClassifierConfigCustomParser{
FoundationModel: bedrockInvokable,
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptStepConfigBase ¶
type PromptStepConfigBase struct {
// The type of step this configuration applies to.
// Experimental.
StepType AgentStepType `field:"required" json:"stepType" yaml:"stepType"`
// The custom prompt template to be used.
// See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html
//
// Default: - The default prompt template will be used.
//
// Experimental.
CustomPromptTemplate *string `field:"optional" json:"customPromptTemplate" yaml:"customPromptTemplate"`
// The inference configuration parameters to use.
// Default: undefined - Default inference configuration will be used.
//
// Experimental.
InferenceConfig *InferenceConfiguration `field:"optional" json:"inferenceConfig" yaml:"inferenceConfig"`
// Whether to enable or skip this step in the agent sequence.
// Default: - The default state for each step type is as follows.
//
// PRE_PROCESSING – ENABLED
// ORCHESTRATION – ENABLED
// KNOWLEDGE_BASE_RESPONSE_GENERATION – ENABLED
// POST_PROCESSING – DISABLED.
//
// Experimental.
StepEnabled *bool `field:"optional" json:"stepEnabled" yaml:"stepEnabled"`
// Whether to use the custom Lambda parser defined for the sequence.
// Default: - false.
//
// Experimental.
UseCustomParser *bool `field:"optional" json:"useCustomParser" yaml:"useCustomParser"`
}
Base configuration interface for all prompt step types.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
promptStepConfigBase := &PromptStepConfigBase{
StepType: bedrock_alpha.AgentStepType_PRE_PROCESSING,
// the properties below are optional
CustomPromptTemplate: jsii.String("customPromptTemplate"),
InferenceConfig: &InferenceConfiguration{
MaximumLength: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopK: jsii.Number(123),
TopP: jsii.Number(123),
},
StepEnabled: jsii.Boolean(false),
UseCustomParser: jsii.Boolean(false),
}
Experimental.
type PromptTemplateConfiguration ¶
type PromptTemplateConfiguration interface {
}
Abstract base class for prompt template configurations.
This provides a high-level abstraction over the underlying CloudFormation template configuration properties, offering a more developer-friendly interface while maintaining full compatibility with the underlying AWS Bedrock service.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
var chatMessage ChatMessage
var tool Tool
var toolChoice ToolChoice
promptTemplateConfiguration := bedrock_alpha.PromptTemplateConfiguration_Chat(&ChatTemplateConfigurationProps{
Messages: []ChatMessage{
chatMessage,
},
// the properties below are optional
InputVariables: []*string{
jsii.String("inputVariables"),
},
System: jsii.String("system"),
ToolConfiguration: &ToolConfiguration{
ToolChoice: toolChoice,
Tools: []Tool{
tool,
},
},
})
Experimental.
func PromptTemplateConfiguration_Chat ¶
func PromptTemplateConfiguration_Chat(props *ChatTemplateConfigurationProps) PromptTemplateConfiguration
Creates a chat template configuration. Experimental.
func PromptTemplateConfiguration_Text ¶
func PromptTemplateConfiguration_Text(props *TextTemplateConfigurationProps) PromptTemplateConfiguration
Creates a text template configuration. Experimental.
type PromptTemplateType ¶
type PromptTemplateType string
The type of prompt template. Experimental.
const ( // Text template for simple text-based prompts. // Experimental. PromptTemplateType_TEXT PromptTemplateType = "TEXT" // Chat template for conversational prompts with message history. // Experimental. PromptTemplateType_CHAT PromptTemplateType = "CHAT" )
type PromptVariant ¶
type PromptVariant interface {
}
Factory class for creating prompt variants.
Provides static methods to create different types of prompt variants with proper configuration and type safety.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
Experimental.
type PromptVersion ¶
type PromptVersion interface {
constructs.Construct
// The description of the prompt version.
// Experimental.
Description() *string
// The tree node.
// Experimental.
Node() constructs.Node
// The prompt used by this version.
// Experimental.
Prompt() IPrompt
// The version of the prompt that was created.
// Experimental.
Version() *string
// The Amazon Resource Name (ARN) of the prompt version.
//
// Example:
// "arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345:1"
//
// Experimental.
VersionArn() *string
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
//
// Returns: This construct for chaining.
// Experimental.
With(mixins ...constructs.IMixin) constructs.IConstruct
}
Class to create a Prompt Version with CDK.
Creates a version of the prompt. Use this to create a static snapshot of your prompt that can be deployed to production. Versions allow you to easily switch between different configurations for your prompt and update your application with the most appropriate version for your use-case.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
promptVersion := bedrock.NewPromptVersion(this, jsii.String("MyPromptVersion"), &PromptVersionProps{
Prompt: prompt1,
Description: jsii.String("my first version"),
})
//or alternatively:
// const promptVersion = prompt1.createVersion('my first version');
versionString := promptVersion.Version
See: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-deploy.html
Experimental.
func NewPromptVersion ¶
func NewPromptVersion(scope constructs.Construct, id *string, props *PromptVersionProps) PromptVersion
**************************************************************************** CONSTRUCTOR ***************************************************************************. Experimental.
type PromptVersionProps ¶
type PromptVersionProps struct {
// The prompt to use for this version.
// Experimental.
Prompt IPrompt `field:"required" json:"prompt" yaml:"prompt"`
// The description of the prompt version.
// Default: - No description provided.
// Maximum length: 200.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
}
Properties for creating a CDK managed Bedrock Prompt Version.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
promptVersion := bedrock.NewPromptVersion(this, jsii.String("MyPromptVersion"), &PromptVersionProps{
Prompt: prompt1,
Description: jsii.String("my first version"),
})
//or alternatively:
// const promptVersion = prompt1.createVersion('my first version');
versionString := promptVersion.Version
Experimental.
type RegexFilter ¶
type RegexFilter struct {
// The action to take when a regex match is detected.
// Experimental.
Action GuardrailAction `field:"required" json:"action" yaml:"action"`
// The name of the regex filter.
// Experimental.
Name *string `field:"required" json:"name" yaml:"name"`
// The regular expression pattern to match.
// Experimental.
Pattern *string `field:"required" json:"pattern" yaml:"pattern"`
// The description of the regex filter.
// Default: - No description.
//
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// The action to take when a regex match is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the regex filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The action to take when a regex match is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the regex filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
}
A Regular expression (regex) filter for sensitive information.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add regex filter with input/output actions
guardrail.AddRegexFilter(&RegexFilter{
Name: jsii.String("TestRegexFilter"),
Pattern: jsii.String("test-pattern"),
Action: bedrock.GuardrailAction_ANONYMIZE,
// below props are optional
Description: jsii.String("This is a test regex filter"),
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
Experimental.
type RequireConfirmation ¶
type RequireConfirmation string
Enum for require confirmation state in function schemas.
Example:
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
// Define a function schema with parameters
functionSchema := bedrock.NewFunctionSchema(&FunctionSchemaProps{
Functions: []FunctionProps{
&FunctionProps{
Name: jsii.String("searchBooks"),
Description: jsii.String("Search for books in the library catalog"),
Parameters: map[string]FunctionParameterProps{
"query": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The search query string"),
},
"maxResults": &FunctionParameterProps{
"type": bedrock.ParameterType_INTEGER,
"required": jsii.Boolean(false),
"description": jsii.String("Maximum number of results to return"),
},
"includeOutOfPrint": &FunctionParameterProps{
"type": bedrock.ParameterType_BOOLEAN,
"required": jsii.Boolean(false),
"description": jsii.String("Whether to include out-of-print books"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_DISABLED,
},
&FunctionProps{
Name: jsii.String("getBookDetails"),
Description: jsii.String("Get detailed information about a specific book"),
Parameters: map[string]FunctionParameterProps{
"bookId": &FunctionParameterProps{
"type": bedrock.ParameterType_STRING,
"required": jsii.Boolean(true),
"description": jsii.String("The unique identifier of the book"),
},
},
RequireConfirmation: bedrock.RequireConfirmation_ENABLED,
},
},
})
// Create an action group using the function schema
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("library-functions"),
Description: jsii.String("Functions for interacting with the library catalog"),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
FunctionSchema: functionSchema,
Enabled: jsii.Boolean(true),
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
ActionGroups: []AgentActionGroup{
actionGroup,
},
})
Experimental.
const ( // Confirmation is enabled. // Experimental. RequireConfirmation_ENABLED RequireConfirmation = "ENABLED" // Confirmation is disabled. // Experimental. RequireConfirmation_DISABLED RequireConfirmation = "DISABLED" )
type S3ApiSchema ¶
type S3ApiSchema interface {
ApiSchema
// The inline OpenAPI schema definition as a string, if using an inline schema.
//
// Can be in JSON or YAML format.
// Experimental.
InlineSchema() *string
// The S3 location of the API schema file, if using an S3-based schema.
//
// Contains the bucket name and object key information.
// Experimental.
S3File() *awss3.Location
}
Class to define an API Schema from an S3 object.
Example:
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Experimental.
func ApiSchema_FromS3File ¶
func ApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
Creates an API Schema from an S3 File. Experimental.
func AssetApiSchema_FromS3File ¶
func AssetApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
Creates an API Schema from an S3 File. Experimental.
func InlineApiSchema_FromS3File ¶
func InlineApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
Creates an API Schema from an S3 File. Experimental.
func S3ApiSchema_FromS3File ¶
func S3ApiSchema_FromS3File(bucket interfacesawss3.IBucketRef, objectKey *string) S3ApiSchema
Creates an API Schema from an S3 File. Experimental.
type SessionSummaryMemoryProps ¶
type SessionSummaryMemoryProps struct {
// Maximum number of recent session summaries to include (min 1).
// Default: 20.
//
// Experimental.
MaxRecentSessions *float64 `field:"optional" json:"maxRecentSessions" yaml:"maxRecentSessions"`
// Duration for which session summaries are retained (between 1 and 365 days).
// Default: Duration.days(30)
//
// Experimental.
MemoryDuration awscdk.Duration `field:"optional" json:"memoryDuration" yaml:"memoryDuration"`
}
Properties for SessionSummaryConfiguration.
Example:
agent := bedrock.NewAgent(this, jsii.String("MyAgent"), &AgentProps{
AgentName: jsii.String("MyAgent"),
Instruction: jsii.String("Your instruction here"),
FoundationModel: bedrock.BedrockFoundationModel_AMAZON_NOVA_LITE_V1(),
Memory: awsbedrockalpha.Memory_SessionSummary(&SessionSummaryMemoryProps{
MaxRecentSessions: jsii.Number(10),
// Keep the last 10 session summaries
MemoryDuration: awscdk.Duration_Days(jsii.Number(20)),
}),
})
Experimental.
type TextPromptVariantProps ¶
type TextPromptVariantProps struct {
// The model which is used to run the prompt.
//
// The model could be a foundation
// model, a custom model, or a provisioned model.
// Experimental.
Model IBedrockInvokable `field:"required" json:"model" yaml:"model"`
// The name of the prompt variant.
// Experimental.
VariantName *string `field:"required" json:"variantName" yaml:"variantName"`
// The variables in the prompt template that can be filled in at runtime.
// Default: - No variables defined.
//
// Experimental.
PromptVariables *[]*string `field:"optional" json:"promptVariables" yaml:"promptVariables"`
// The text prompt.
//
// Variables are used by enclosing its name with double curly braces
// as in `{{variable_name}}`.
// Experimental.
PromptText *string `field:"required" json:"promptText" yaml:"promptText"`
// Inference configuration for the Text Prompt.
// Default: - No inference configuration provided.
//
// Experimental.
InferenceConfiguration PromptInferenceConfiguration `field:"optional" json:"inferenceConfiguration" yaml:"inferenceConfiguration"`
}
Properties for creating a text prompt variant.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
claudeModel := bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_SONNET_V1_0()
variant1 := bedrock.PromptVariant_Text(&TextPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: claudeModel,
PromptVariables: []*string{
jsii.String("topic"),
},
PromptText: jsii.String("This is my first text prompt. Please summarize our conversation on: {{topic}}."),
InferenceConfiguration: bedrock.PromptInferenceConfiguration_Text(&PromptInferenceConfigurationProps{
Temperature: jsii.Number(1),
TopP: jsii.Number(0.999),
MaxTokens: jsii.Number(2000),
}),
})
prompt1 := bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt1"),
Description: jsii.String("my first prompt"),
DefaultVariant: variant1,
Variants: []IPromptVariant{
variant1,
},
KmsKey: cmk,
})
Experimental.
type TextTemplateConfigurationProps ¶
type TextTemplateConfigurationProps struct {
// The text content of the template.
// Experimental.
Text *string `field:"required" json:"text" yaml:"text"`
// The input variables for the template.
// Default: - No input variables.
//
// Experimental.
InputVariables *[]*string `field:"optional" json:"inputVariables" yaml:"inputVariables"`
}
Properties for creating a text template configuration.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha"
textTemplateConfigurationProps := &TextTemplateConfigurationProps{
Text: jsii.String("text"),
// the properties below are optional
InputVariables: []*string{
jsii.String("inputVariables"),
},
}
Experimental.
type TierConfig ¶
type TierConfig string
**************************************************************************** TIER CONFIG ***************************************************************************.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
// Configure tier for topic filters (optional)
TopicsTierConfig: bedrock.TierConfig_STANDARD,
})
// Use a predefined topic
guardrail.AddDeniedTopicFilter(bedrock.Topic_FINANCIAL_ADVICE())
// Create a custom topic with input/output actions
guardrail.AddDeniedTopicFilter(bedrock.Topic_Custom(&CustomTopicProps{
Name: jsii.String("Legal_Advice"),
Definition: jsii.String("Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities."),
Examples: []*string{
jsii.String("Can I sue someone for this?"),
jsii.String("What are my legal rights in this situation?"),
jsii.String("Is this action against the law?"),
jsii.String("What should I do to file a legal complaint?"),
jsii.String("Can you explain this law to me?"),
},
// props below are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
}))
Experimental.
const ( // Provides established guardrails functionality supporting English, French, and Spanish languages. // Experimental. TierConfig_CLASSIC TierConfig = "CLASSIC" // Provides a more robust solution than the CLASSIC tier and has more comprehensive language support. // // This tier requires that your guardrail use cross-Region inference. // Experimental. TierConfig_STANDARD TierConfig = "STANDARD" )
type Tool ¶
type Tool interface {
}
Abstract base class for tools that can be used by the model.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
func Tool_Function ¶
func Tool_Function(props *FunctionToolProps) Tool
Creates a function tool. Experimental.
type ToolChoice ¶
type ToolChoice interface {
// Configuration for ANY tool choice.
// Experimental.
Any() interface{}
// Configuration for AUTO tool choice.
// Experimental.
Auto() interface{}
// The specific tool name if using specific tool choice.
// Experimental.
Tool() *string
}
Defines how the model should choose which tool to use.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
func NewToolChoice ¶
func NewToolChoice(any interface{}, auto interface{}, tool *string) ToolChoice
Experimental.
func ToolChoice_ANY ¶
func ToolChoice_ANY() ToolChoice
func ToolChoice_AUTO ¶
func ToolChoice_AUTO() ToolChoice
func ToolChoice_SpecificTool ¶
func ToolChoice_SpecificTool(toolName *string) ToolChoice
The Model must request the specified tool.
Only supported by some models like Anthropic Claude 3 models.
Returns: A ToolChoice instance configured for the specific tool. Experimental.
type ToolConfiguration ¶
type ToolConfiguration struct {
// How the model should choose which tool to use.
// Experimental.
ToolChoice ToolChoice `field:"required" json:"toolChoice" yaml:"toolChoice"`
// The tools available to the model.
// Experimental.
Tools *[]Tool `field:"required" json:"tools" yaml:"tools"`
}
Configuration for tools available to the model.
Example:
cmk := kms.NewKey(this, jsii.String("cmk"), &KeyProps{
})
variantChat := bedrock.PromptVariant_Chat(&ChatPromptVariantProps{
VariantName: jsii.String("variant1"),
Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0(),
Messages: []ChatMessage{
bedrock.ChatMessage_User(jsii.String("From now on, you speak Japanese!")),
bedrock.ChatMessage_Assistant(jsii.String("Konnichiwa!")),
bedrock.ChatMessage_*User(jsii.String("From now on, you speak {{language}}!")),
},
System: jsii.String("You are a helpful assistant that only speaks the language you`re told."),
PromptVariables: []*string{
jsii.String("language"),
},
ToolConfiguration: &ToolConfiguration{
ToolChoice: bedrock.ToolChoice_AUTO(),
Tools: []Tool{
bedrock.Tool_Function(&FunctionToolProps{
Name: jsii.String("top_song"),
Description: jsii.String("Get the most popular song played on a radio station."),
InputSchema: map[string]interface{}{
"type": jsii.String("object"),
"properties": map[string]map[string]*string{
"sign": map[string]*string{
"type": jsii.String("string"),
"description": jsii.String("The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR."),
},
},
"required": []*string{
jsii.String("sign"),
},
},
}),
},
},
})
bedrock.NewPrompt(this, jsii.String("prompt1"), &PromptProps{
PromptName: jsii.String("prompt-chat"),
Description: jsii.String("my first chat prompt"),
DefaultVariant: variantChat,
Variants: []IPromptVariant{
variantChat,
},
KmsKey: cmk,
})
Experimental.
type Topic ¶
type Topic interface {
// Definition of the topic.
// Experimental.
Definition() *string
// Representative phrases that refer to the topic.
// Experimental.
Examples() *[]*string
// The action to take when a topic is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction() GuardrailAction
// Whether the topic filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled() *bool
// The name of the topic to deny.
// Experimental.
Name() *string
// The action to take when a topic is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction() GuardrailAction
// Whether the topic filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled() *bool
}
Represents predefined topics that can be used to filter content.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
// Configure tier for topic filters (optional)
TopicsTierConfig: bedrock.TierConfig_STANDARD,
})
// Use a predefined topic
guardrail.AddDeniedTopicFilter(bedrock.Topic_FINANCIAL_ADVICE())
// Create a custom topic with input/output actions
guardrail.AddDeniedTopicFilter(bedrock.Topic_Custom(&CustomTopicProps{
Name: jsii.String("Legal_Advice"),
Definition: jsii.String("Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities."),
Examples: []*string{
jsii.String("Can I sue someone for this?"),
jsii.String("What are my legal rights in this situation?"),
jsii.String("Is this action against the law?"),
jsii.String("What should I do to file a legal complaint?"),
jsii.String("Can you explain this law to me?"),
},
// props below are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
}))
Experimental.
func Topic_Custom ¶
func Topic_Custom(props *CustomTopicProps) Topic
Create a custom topic filter. Experimental.
func Topic_FINANCIAL_ADVICE ¶
func Topic_FINANCIAL_ADVICE() Topic
func Topic_INAPPROPRIATE_CONTENT ¶
func Topic_INAPPROPRIATE_CONTENT() Topic
func Topic_LEGAL_ADVICE ¶
func Topic_LEGAL_ADVICE() Topic
func Topic_MEDICAL_ADVICE ¶
func Topic_MEDICAL_ADVICE() Topic
func Topic_POLITICAL_ADVICE ¶
func Topic_POLITICAL_ADVICE() Topic
type UKSpecificPIIType ¶
type UKSpecificPIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII specific to the United Kingdom (UK).
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import bedrock_alpha "github.com/aws/aws-cdk-go/awsbedrockalpha" uKSpecificPIIType := bedrock_alpha.UKSpecificPIIType_UK_NATIONAL_HEALTH_SERVICE_NUMBER()
Experimental.
func UKSpecificPIIType_UK_NATIONAL_HEALTH_SERVICE_NUMBER ¶
func UKSpecificPIIType_UK_NATIONAL_HEALTH_SERVICE_NUMBER() UKSpecificPIIType
func UKSpecificPIIType_UK_NATIONAL_INSURANCE_NUMBER ¶
func UKSpecificPIIType_UK_NATIONAL_INSURANCE_NUMBER() UKSpecificPIIType
func UKSpecificPIIType_UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER ¶
func UKSpecificPIIType_UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER() UKSpecificPIIType
type USASpecificPIIType ¶
type USASpecificPIIType interface {
PIIType
// The string value of the PII type.
// Experimental.
Value() *string
// Returns the string representation of the PII type.
//
// Returns: The string value of the PII type.
// Experimental.
ToString() *string
}
Types of PII specific to the USA.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add PII filter for addresses with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_ADDRESS(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for credit card numbers with input/output actions
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.FinancePIIType_CREDIT_DEBIT_CARD_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
// below props are optional
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_ANONYMIZE,
OutputEnabled: jsii.Boolean(true),
})
// Add PII filter for email addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.GeneralPIIType_EMAIL(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
// Add PII filter for US Social Security Numbers
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER(),
Action: bedrock.GuardrailAction_BLOCK,
})
// Add PII filter for IP addresses
guardrail.AddPIIFilter(&PIIFilter{
Type: bedrock.InformationTechnologyPIIType_IP_ADDRESS(),
Action: bedrock.GuardrailAction_ANONYMIZE,
})
Experimental.
func USASpecificPIIType_US_BANK_ACCOUNT_NUMBER ¶
func USASpecificPIIType_US_BANK_ACCOUNT_NUMBER() USASpecificPIIType
func USASpecificPIIType_US_BANK_ROUTING_NUMBER ¶
func USASpecificPIIType_US_BANK_ROUTING_NUMBER() USASpecificPIIType
func USASpecificPIIType_US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER ¶
func USASpecificPIIType_US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER() USASpecificPIIType
func USASpecificPIIType_US_PASSPORT_NUMBER ¶
func USASpecificPIIType_US_PASSPORT_NUMBER() USASpecificPIIType
func USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER ¶
func USASpecificPIIType_US_SOCIAL_SECURITY_NUMBER() USASpecificPIIType
type VectorType ¶
type VectorType string
The data type for the vectors when using a model to convert text into vector embeddings.
The model must support the specified data type for vector embeddings. Floating-point (float32) is the default data type, and is supported by most models for vector embeddings. See Supported embeddings models for information on the available models and their vector data types. Experimental.
const ( // `FLOATING_POINT` convert the data to floating-point (float32) vector embeddings (more precise, but more costly). // Experimental. VectorType_FLOATING_POINT VectorType = "FLOATING_POINT" // `BINARY` convert the data to binary vector embeddings (less precise, but less costly). // Experimental. VectorType_BINARY VectorType = "BINARY" )
type WordFilter ¶
type WordFilter struct {
// The text to filter.
// Experimental.
Text *string `field:"required" json:"text" yaml:"text"`
// The action to take when a word is detected in the input.
// Default: GuardrailAction.BLOCK
//
// Experimental.
InputAction GuardrailAction `field:"optional" json:"inputAction" yaml:"inputAction"`
// Whether the word filter is enabled for input.
// Default: true.
//
// Experimental.
InputEnabled *bool `field:"optional" json:"inputEnabled" yaml:"inputEnabled"`
// The action to take when a word is detected in the output.
// Default: GuardrailAction.BLOCK
//
// Experimental.
OutputAction GuardrailAction `field:"optional" json:"outputAction" yaml:"outputAction"`
// Whether the word filter is enabled for output.
// Default: true.
//
// Experimental.
OutputEnabled *bool `field:"optional" json:"outputEnabled" yaml:"outputEnabled"`
}
Interface to define a Word Filter.
Example:
guardrail := bedrock.NewGuardrail(this, jsii.String("bedrockGuardrails"), &GuardrailProps{
GuardrailName: jsii.String("my-BedrockGuardrails"),
})
// Add managed word list with input/output actions
guardrail.AddManagedWordListFilter(&ManagedWordFilter{
Type: bedrock.ManagedWordFilterType_PROFANITY,
InputAction: bedrock.GuardrailAction_BLOCK,
InputEnabled: jsii.Boolean(true),
OutputAction: bedrock.GuardrailAction_NONE,
OutputEnabled: jsii.Boolean(true),
})
// Add individual words
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("drugs"),
})
guardrail.AddWordFilter(&WordFilter{
Text: jsii.String("competitor"),
})
// Add words from a file
guardrail.AddWordFilterFromFile(jsii.String("./scripts/wordsPolicy.csv"))
Experimental.
Source Files
¶
- ActionGroupExecutor.go
- ActionGroupExecutor__checks.go
- Agent.go
- AgentActionGroup.go
- AgentActionGroupProps.go
- AgentActionGroup__checks.go
- AgentAlias.go
- AgentAliasAttributes.go
- AgentAliasBase.go
- AgentAliasBase__checks.go
- AgentAliasProps.go
- AgentAlias__checks.go
- AgentAttributes.go
- AgentBase.go
- AgentBase__checks.go
- AgentCollaboration.go
- AgentCollaborationConfig.go
- AgentCollaboration__checks.go
- AgentCollaborator.go
- AgentCollaboratorProps.go
- AgentCollaboratorType.go
- AgentCollaborator__checks.go
- AgentGenAiResourceProps.go
- AgentPromptVariantProps.go
- AgentProps.go
- AgentStepType.go
- Agent__checks.go
- ApiSchema.go
- ApiSchema__checks.go
- ApplicationInferenceProfile.go
- ApplicationInferenceProfileAttributes.go
- ApplicationInferenceProfileProps.go
- ApplicationInferenceProfile__checks.go
- AssetApiSchema.go
- AssetApiSchema__checks.go
- BedrockFoundationModel.go
- BedrockFoundationModelProps.go
- BedrockFoundationModel__checks.go
- CanadaSpecificPIIType.go
- ChatMessage.go
- ChatMessageRole.go
- ChatMessage__checks.go
- ChatPromptVariantProps.go
- ChatTemplateConfigurationProps.go
- CommonPromptVariantProps.go
- ContentFilter.go
- ContentFilterStrength.go
- ContentFilterType.go
- ContextualGroundingFilter.go
- ContextualGroundingFilterType.go
- CrossRegionInferenceProfile.go
- CrossRegionInferenceProfileProps.go
- CrossRegionInferenceProfileRegion.go
- CrossRegionInferenceProfile__checks.go
- CustomControl.go
- CustomOrchestrationExecutor.go
- CustomOrchestrationExecutor__checks.go
- CustomParserProps.go
- CustomTopicProps.go
- DefaultPromptRouterIdentifier.go
- FinancePIIType.go
- Function.go
- FunctionParameter.go
- FunctionParameterProps.go
- FunctionParameter__checks.go
- FunctionProps.go
- FunctionSchema.go
- FunctionSchemaProps.go
- FunctionSchema__checks.go
- FunctionToolProps.go
- Function__checks.go
- GeneralPIIType.go
- Guardrail.go
- GuardrailAction.go
- GuardrailAttributes.go
- GuardrailBase.go
- GuardrailBase__checks.go
- GuardrailCrossRegionConfigProperty.go
- GuardrailProps.go
- Guardrail__checks.go
- IAgent.go
- IAgentAlias.go
- IAgentAlias__checks.go
- IAgent__checks.go
- IBedrockInvokable.go
- IBedrockInvokable__checks.go
- IGuardrail.go
- IGuardrail__checks.go
- IInferenceProfile.go
- IInferenceProfile__checks.go
- IPrompt.go
- IPromptRouter.go
- IPromptVariant.go
- IPrompt__checks.go
- InferenceConfiguration.go
- InferenceProfileBase.go
- InferenceProfileBase__checks.go
- InferenceProfileType.go
- InformationTechnologyPIIType.go
- InlineApiSchema.go
- InlineApiSchema__checks.go
- ManagedWordFilter.go
- ManagedWordFilterType.go
- Memory.go
- Memory__checks.go
- ModalityType.go
- OrchestrationType.go
- PIIFilter.go
- PIIType.go
- PIIType__checks.go
- ParameterType.go
- ParentActionGroupSignature.go
- ParentActionGroupSignature__checks.go
- Prompt.go
- PromptAttributes.go
- PromptBase.go
- PromptBase__checks.go
- PromptGenAiResource.go
- PromptGenAiResource__checks.go
- PromptInferenceConfiguration.go
- PromptInferenceConfigurationProps.go
- PromptInferenceConfiguration__checks.go
- PromptKnowledgeBaseResponseGenerationConfigCustomParser.go
- PromptMemorySummarizationConfigCustomParser.go
- PromptOrchestrationConfigCustomParser.go
- PromptOverrideConfiguration.go
- PromptOverrideConfiguration__checks.go
- PromptPostProcessingConfigCustomParser.go
- PromptPreProcessingConfigCustomParser.go
- PromptProps.go
- PromptRouter.go
- PromptRouterProps.go
- PromptRouter__checks.go
- PromptRoutingClassifierConfigCustomParser.go
- PromptStepConfigBase.go
- PromptTemplateConfiguration.go
- PromptTemplateConfiguration__checks.go
- PromptTemplateType.go
- PromptVariant.go
- PromptVariant__checks.go
- PromptVersion.go
- PromptVersionProps.go
- PromptVersion__checks.go
- Prompt__checks.go
- RegexFilter.go
- RequireConfirmation.go
- S3ApiSchema.go
- S3ApiSchema__checks.go
- SessionSummaryMemoryProps.go
- TextPromptVariantProps.go
- TextTemplateConfigurationProps.go
- TierConfig.go
- Tool.go
- ToolChoice.go
- ToolChoice__checks.go
- ToolConfiguration.go
- Tool__checks.go
- Topic.go
- Topic__checks.go
- UKSpecificPIIType.go
- USASpecificPIIType.go
- VectorType.go
- WordFilter.go
- main.go
TypeScript