Class: AWSCDK::Bedrock::CfnFlowVersion::KnowledgeBaseFlowNodeConfigurationProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock/cfn_flow_version.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:



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
# File 'bedrock/cfn_flow_version.rb', line 1455

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::CfnFlowVersion::GuardrailConfigurationProperty.new(**guardrail_configuration.transform_keys(&:to_sym)) : guardrail_configuration
  Jsii::Type.check_type(@guardrail_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3dWZXJzaW9uLkd1YXJkcmFpbENvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "guardrailConfiguration") unless @guardrail_configuration.nil?
  @inference_configuration = inference_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlowVersion::PromptInferenceConfigurationProperty.new(**inference_configuration.transform_keys(&:to_sym)) : inference_configuration
  Jsii::Type.check_type(@inference_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3dWZXJzaW9uLlByb21wdEluZmVyZW5jZUNvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "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::CfnFlowVersion::KnowledgeBaseOrchestrationConfigurationProperty.new(**orchestration_configuration.transform_keys(&:to_sym)) : orchestration_configuration
  Jsii::Type.check_type(@orchestration_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3dWZXJzaW9uLktub3dsZWRnZUJhc2VPcmNoZXN0cmF0aW9uQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "orchestrationConfiguration") unless @orchestration_configuration.nil?
  @prompt_template = prompt_template.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlowVersion::KnowledgeBasePromptTemplateProperty.new(**prompt_template.transform_keys(&:to_sym)) : prompt_template
  Jsii::Type.check_type(@prompt_template, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3dWZXJzaW9uLktub3dsZWRnZUJhc2VQcm9tcHRUZW1wbGF0ZVByb3BlcnR5In1dfX0=")), "promptTemplate") unless @prompt_template.nil?
  @reranking_configuration = reranking_configuration.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnFlowVersion::VectorSearchRerankingConfigurationProperty.new(**reranking_configuration.transform_keys(&:to_sym)) : reranking_configuration
  Jsii::Type.check_type(@reranking_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmbkZsb3dWZXJzaW9uLlZlY3RvclNlYXJjaFJlcmFua2luZ0NvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "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.



1483
1484
1485
# File 'bedrock/cfn_flow_version.rb', line 1483

def guardrail_configuration
  @guardrail_configuration
end

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

Contains inference configurations for the prompt.



1488
1489
1490
# File 'bedrock/cfn_flow_version.rb', line 1488

def inference_configuration
  @inference_configuration
end

#knowledge_base_idString (readonly)

The unique identifier of the knowledge base to query.



1478
1479
1480
# File 'bedrock/cfn_flow_version.rb', line 1478

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.



1493
1494
1495
# File 'bedrock/cfn_flow_version.rb', line 1493

def model_id
  @model_id
end

#number_of_resultsNumeric? (readonly)

The number of results to retrieve from the knowledge base.



1498
1499
1500
# File 'bedrock/cfn_flow_version.rb', line 1498

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.



1503
1504
1505
# File 'bedrock/cfn_flow_version.rb', line 1503

def orchestration_configuration
  @orchestration_configuration
end

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

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



1508
1509
1510
# File 'bedrock/cfn_flow_version.rb', line 1508

def prompt_template
  @prompt_template
end

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

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



1513
1514
1515
# File 'bedrock/cfn_flow_version.rb', line 1513

def reranking_configuration
  @reranking_configuration
end

Class Method Details

.jsii_propertiesObject



1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
# File 'bedrock/cfn_flow_version.rb', line 1515

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



1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
# File 'bedrock/cfn_flow_version.rb', line 1528

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