Class: AWSCDK::Bedrock::CfnFlow::KnowledgeBaseFlowNodeConfigurationProperty

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

Overview

Contains configurations for a knowledge base node in a flow.

This node takes a query as the input and returns, as the output, the retrieved responses directly (as an array) or a response generated based on the retrieved responses. For more information, see Node types in a flow in the Amazon Bedrock User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(knowledge_base_id:, guardrail_configuration: nil, inference_configuration: nil, model_id: nil, number_of_results: nil, orchestration_configuration: nil, prompt_template: nil, reranking_configuration: nil) ⇒ KnowledgeBaseFlowNodeConfigurationProperty

Returns a new instance of KnowledgeBaseFlowNodeConfigurationProperty.

Parameters:



1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
# File 'bedrock/cfn_flow.rb', line 1634

def initialize(knowledge_base_id:, guardrail_configuration: nil, inference_configuration: nil, model_id: nil, number_of_results: nil, orchestration_configuration: nil, prompt_template: nil, reranking_configuration: nil)
  @knowledge_base_id = knowledge_base_id
  Jsii::Type.check_type(@knowledge_base_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "knowledgeBaseId")
  @guardrail_configuration = guardrail_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlow::GuardrailConfigurationProperty.new(**guardrail_configuration.transform_keys(&:to_sym)) : guardrail_configuration
  Jsii::Type.check_type(@guardrail_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3cuR3VhcmRyYWlsQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "guardrailConfiguration") unless @guardrail_configuration.nil?
  @inference_configuration = inference_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlow::PromptInferenceConfigurationProperty.new(**inference_configuration.transform_keys(&:to_sym)) : inference_configuration
  Jsii::Type.check_type(@inference_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3cuUHJvbXB0SW5mZXJlbmNlQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "inferenceConfiguration") unless @inference_configuration.nil?
  @model_id = model_id
  Jsii::Type.check_type(@model_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "modelId") unless @model_id.nil?
  @number_of_results = number_of_results
  Jsii::Type.check_type(@number_of_results, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "numberOfResults") unless @number_of_results.nil?
  @orchestration_configuration = orchestration_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlow::KnowledgeBaseOrchestrationConfigurationProperty.new(**orchestration_configuration.transform_keys(&:to_sym)) : orchestration_configuration
  Jsii::Type.check_type(@orchestration_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3cuS25vd2xlZGdlQmFzZU9yY2hlc3RyYXRpb25Db25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "orchestrationConfiguration") unless @orchestration_configuration.nil?
  @prompt_template = prompt_template.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlow::KnowledgeBasePromptTemplateProperty.new(**prompt_template.transform_keys(&:to_sym)) : prompt_template
  Jsii::Type.check_type(@prompt_template, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3cuS25vd2xlZGdlQmFzZVByb21wdFRlbXBsYXRlUHJvcGVydHkifV19fQ==")), "promptTemplate") unless @prompt_template.nil?
  @reranking_configuration = reranking_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlow::VectorSearchRerankingConfigurationProperty.new(**reranking_configuration.transform_keys(&:to_sym)) : reranking_configuration
  Jsii::Type.check_type(@reranking_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3cuVmVjdG9yU2VhcmNoUmVyYW5raW5nQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "rerankingConfiguration") unless @reranking_configuration.nil?
end

Instance Attribute Details

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

Contains configurations for a guardrail to apply during query and response generation for the knowledge base in this configuration.



1662
1663
1664
# File 'bedrock/cfn_flow.rb', line 1662

def guardrail_configuration
  @guardrail_configuration
end

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

Contains inference configurations for the prompt.



1667
1668
1669
# File 'bedrock/cfn_flow.rb', line 1667

def inference_configuration
  @inference_configuration
end

#knowledge_base_idString (readonly)

The unique identifier of the knowledge base to query.



1657
1658
1659
# File 'bedrock/cfn_flow.rb', line 1657

def knowledge_base_id
  @knowledge_base_id
end

#model_idString? (readonly)

The unique identifier of the model or inference profile to use to generate a response from the query results. Omit this field if you want to return the retrieved results as an array.



1672
1673
1674
# File 'bedrock/cfn_flow.rb', line 1672

def model_id
  @model_id
end

#number_of_resultsNumeric? (readonly)

The number of results to retrieve from the knowledge base.



1677
1678
1679
# File 'bedrock/cfn_flow.rb', line 1677

def number_of_results
  @number_of_results
end

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

The configuration for orchestrating the retrieval and generation process in the knowledge base node.



1682
1683
1684
# File 'bedrock/cfn_flow.rb', line 1682

def orchestration_configuration
  @orchestration_configuration
end

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

A custom prompt template to use with the knowledge base for generating responses.



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

def prompt_template
  @prompt_template
end

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

The configuration for reranking the retrieved results from the knowledge base to improve relevance.



1692
1693
1694
# File 'bedrock/cfn_flow.rb', line 1692

def reranking_configuration
  @reranking_configuration
end

Class Method Details

.jsii_propertiesObject



1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
# File 'bedrock/cfn_flow.rb', line 1694

def self.jsii_properties
  {
    :knowledge_base_id => "knowledgeBaseId",
    :guardrail_configuration => "guardrailConfiguration",
    :inference_configuration => "inferenceConfiguration",
    :model_id => "modelId",
    :number_of_results => "numberOfResults",
    :orchestration_configuration => "orchestrationConfiguration",
    :prompt_template => "promptTemplate",
    :reranking_configuration => "rerankingConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
# File 'bedrock/cfn_flow.rb', line 1707

def to_jsii
  result = {}
  result.merge!({
    "knowledgeBaseId" => @knowledge_base_id,
    "guardrailConfiguration" => @guardrail_configuration,
    "inferenceConfiguration" => @inference_configuration,
    "modelId" => @model_id,
    "numberOfResults" => @number_of_results,
    "orchestrationConfiguration" => @orchestration_configuration,
    "promptTemplate" => @prompt_template,
    "rerankingConfiguration" => @reranking_configuration,
  })
  result.compact
end