Class: AWSCDK::Bedrock::CfnAgent::PromptConfigurationProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock/cfn_agent.rb

Overview

Contains configurations to override a prompt template in one part of an agent sequence.

For more information, see Advanced prompts .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(additional_model_request_fields: nil, base_prompt_template: nil, foundation_model: nil, inference_configuration: nil, parser_mode: nil, prompt_creation_mode: nil, prompt_state: nil, prompt_type: nil) ⇒ PromptConfigurationProperty

Returns a new instance of PromptConfigurationProperty.

Parameters:

  • additional_model_request_fields (Object, nil) (defaults to: nil)

    If the Converse or ConverseStream operations support the model, additionalModelRequestFields contains additional inference parameters, beyond the base set of inference parameters in the inferenceConfiguration field.

  • base_prompt_template (String, nil) (defaults to: nil)

    Defines the prompt template with which to replace the default prompt template.

  • foundation_model (String, nil) (defaults to: nil)

    The agent's foundation model.

  • inference_configuration (AWSCDK::IResolvable, AWSCDK::Bedrock::CfnAgent::InferenceConfigurationProperty, nil) (defaults to: nil)

    Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the promptType .

  • parser_mode (String, nil) (defaults to: nil)

    Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the promptType .

  • prompt_creation_mode (String, nil) (defaults to: nil)

    Specifies whether to override the default prompt template for this promptType .

  • prompt_state (String, nil) (defaults to: nil)

    Specifies whether to allow the inline agent to carry out the step specified in the promptType .

  • prompt_type (String, nil) (defaults to: nil)

    The step in the agent sequence that this prompt configuration applies to.



1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
# File 'bedrock/cfn_agent.rb', line 1643

def initialize(additional_model_request_fields: nil, base_prompt_template: nil, foundation_model: nil, inference_configuration: nil, parser_mode: nil, prompt_creation_mode: nil, prompt_state: nil, prompt_type: nil)
  @additional_model_request_fields = additional_model_request_fields
  Jsii::Type.check_type(@additional_model_request_fields, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "additionalModelRequestFields") unless @additional_model_request_fields.nil?
  @base_prompt_template = base_prompt_template
  Jsii::Type.check_type(@base_prompt_template, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "basePromptTemplate") unless @base_prompt_template.nil?
  @foundation_model = foundation_model
  Jsii::Type.check_type(@foundation_model, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "foundationModel") unless @foundation_model.nil?
  @inference_configuration = inference_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnAgent::InferenceConfigurationProperty.new(**inference_configuration.transform_keys(&:to_sym)) : inference_configuration
  Jsii::Type.check_type(@inference_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkFnZW50LkluZmVyZW5jZUNvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "inferenceConfiguration") unless @inference_configuration.nil?
  @parser_mode = parser_mode
  Jsii::Type.check_type(@parser_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "parserMode") unless @parser_mode.nil?
  @prompt_creation_mode = prompt_creation_mode
  Jsii::Type.check_type(@prompt_creation_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "promptCreationMode") unless @prompt_creation_mode.nil?
  @prompt_state = prompt_state
  Jsii::Type.check_type(@prompt_state, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "promptState") unless @prompt_state.nil?
  @prompt_type = prompt_type
  Jsii::Type.check_type(@prompt_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "promptType") unless @prompt_type.nil?
end

Instance Attribute Details

#additional_model_request_fieldsObject? (readonly)

If the Converse or ConverseStream operations support the model, additionalModelRequestFields contains additional inference parameters, beyond the base set of inference parameters in the inferenceConfiguration field.

For more information, see Inference request parameters and response fields for foundation models .



1668
1669
1670
# File 'bedrock/cfn_agent.rb', line 1668

def additional_model_request_fields
  @additional_model_request_fields
end

#base_prompt_templateString? (readonly)

Defines the prompt template with which to replace the default prompt template.

You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables . For more information, see Configure the prompt templates .



1675
1676
1677
# File 'bedrock/cfn_agent.rb', line 1675

def base_prompt_template
  @base_prompt_template
end

#foundation_modelString? (readonly)

The agent's foundation model.



1680
1681
1682
# File 'bedrock/cfn_agent.rb', line 1680

def foundation_model
  @foundation_model
end

#inference_configurationAWSCDK::IResolvable, ... (readonly)

Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the promptType .

For more information, see Inference parameters for foundation models .



1687
1688
1689
# File 'bedrock/cfn_agent.rb', line 1687

def inference_configuration
  @inference_configuration
end

#parser_modeString? (readonly)

Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the promptType .

If you set the field as OVERRIDDEN , the override_lambda field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function.



1694
1695
1696
# File 'bedrock/cfn_agent.rb', line 1694

def parser_mode
  @parser_mode
end

#prompt_creation_modeString? (readonly)

Specifies whether to override the default prompt template for this promptType .

Set this value to OVERRIDDEN to use the prompt that you provide in the base_prompt_template . If you leave it as DEFAULT , the agent uses a default prompt template.



1701
1702
1703
# File 'bedrock/cfn_agent.rb', line 1701

def prompt_creation_mode
  @prompt_creation_mode
end

#prompt_stateString? (readonly)

Specifies whether to allow the inline agent to carry out the step specified in the promptType .

If you set this value to DISABLED , the agent skips that step. The default state for each prompt_type is as follows.

  • PRE_PROCESSINGENABLED
  • ORCHESTRATIONENABLED
  • KNOWLEDGE_BASE_RESPONSE_GENERATIONENABLED
  • POST_PROCESSINGDISABLED


1713
1714
1715
# File 'bedrock/cfn_agent.rb', line 1713

def prompt_state
  @prompt_state
end

#prompt_typeString? (readonly)

The step in the agent sequence that this prompt configuration applies to.



1718
1719
1720
# File 'bedrock/cfn_agent.rb', line 1718

def prompt_type
  @prompt_type
end

Class Method Details

.jsii_propertiesObject



1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
# File 'bedrock/cfn_agent.rb', line 1720

def self.jsii_properties
  {
    :additional_model_request_fields => "additionalModelRequestFields",
    :base_prompt_template => "basePromptTemplate",
    :foundation_model => "foundationModel",
    :inference_configuration => "inferenceConfiguration",
    :parser_mode => "parserMode",
    :prompt_creation_mode => "promptCreationMode",
    :prompt_state => "promptState",
    :prompt_type => "promptType",
  }
end

Instance Method Details

#to_jsiiObject



1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
# File 'bedrock/cfn_agent.rb', line 1733

def to_jsii
  result = {}
  result.merge!({
    "additionalModelRequestFields" => @additional_model_request_fields,
    "basePromptTemplate" => @base_prompt_template,
    "foundationModel" => @foundation_model,
    "inferenceConfiguration" => @inference_configuration,
    "parserMode" => @parser_mode,
    "promptCreationMode" => @prompt_creation_mode,
    "promptState" => @prompt_state,
    "promptType" => @prompt_type,
  })
  result.compact
end