KnowledgeBaseFlowNodeConfigurationProperty Struct
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.
| Source | |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_bedrock as bedrock } from 'aws-cdk-lib';
declare const additionalModelRequestFields: any;
const knowledgeBaseFlowNodeConfigurationProperty: bedrock.CfnFlow.KnowledgeBaseFlowNodeConfigurationProperty = {
knowledgeBaseId: 'knowledgeBaseId',
// the properties below are optional
guardrailConfiguration: {
guardrailIdentifier: 'guardrailIdentifier',
guardrailVersion: 'guardrailVersion',
},
inferenceConfiguration: {
text: {
maxTokens: 123,
stopSequences: ['stopSequences'],
temperature: 123,
topP: 123,
},
},
modelId: 'modelId',
numberOfResults: 123,
orchestrationConfiguration: {
additionalModelRequestFields: additionalModelRequestFields,
inferenceConfig: {
text: {
maxTokens: 123,
stopSequences: ['stopSequences'],
temperature: 123,
topP: 123,
},
},
performanceConfig: {
latency: 'latency',
},
promptTemplate: {
textPromptTemplate: 'textPromptTemplate',
},
},
promptTemplate: {
textPromptTemplate: 'textPromptTemplate',
},
rerankingConfiguration: {
type: 'type',
// the properties below are optional
bedrockRerankingConfiguration: {
modelConfiguration: {
modelArn: 'modelArn',
// the properties below are optional
additionalModelRequestFields: additionalModelRequestFields,
},
// the properties below are optional
metadataConfiguration: {
selectionMode: 'selectionMode',
// the properties below are optional
selectiveModeConfiguration: {
fieldsToExclude: [{
fieldName: 'fieldName',
}],
fieldsToInclude: [{
fieldName: 'fieldName',
}],
},
},
numberOfRerankedResults: 123,
},
},
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_bedrock as bedrock
# additional_model_request_fields: Any
knowledge_base_flow_node_configuration_property = bedrock.CfnFlow.KnowledgeBaseFlowNodeConfigurationProperty(
knowledge_base_id="knowledgeBaseId",
# the properties below are optional
guardrail_configuration=bedrock.CfnFlow.GuardrailConfigurationProperty(
guardrail_identifier="guardrailIdentifier",
guardrail_version="guardrailVersion"
),
inference_configuration=bedrock.CfnFlow.PromptInferenceConfigurationProperty(
text=bedrock.CfnFlow.PromptModelInferenceConfigurationProperty(
max_tokens=123,
stop_sequences=["stopSequences"],
temperature=123,
top_p=123
)
),
model_id="modelId",
number_of_results=123,
orchestration_configuration=bedrock.CfnFlow.KnowledgeBaseOrchestrationConfigurationProperty(
additional_model_request_fields=additional_model_request_fields,
inference_config=bedrock.CfnFlow.PromptInferenceConfigurationProperty(
text=bedrock.CfnFlow.PromptModelInferenceConfigurationProperty(
max_tokens=123,
stop_sequences=["stopSequences"],
temperature=123,
top_p=123
)
),
performance_config=bedrock.CfnFlow.PerformanceConfigurationProperty(
latency="latency"
),
prompt_template=bedrock.CfnFlow.KnowledgeBasePromptTemplateProperty(
text_prompt_template="textPromptTemplate"
)
),
prompt_template=bedrock.CfnFlow.KnowledgeBasePromptTemplateProperty(
text_prompt_template="textPromptTemplate"
),
reranking_configuration=bedrock.CfnFlow.VectorSearchRerankingConfigurationProperty(
type="type",
# the properties below are optional
bedrock_reranking_configuration=bedrock.CfnFlow.VectorSearchBedrockRerankingConfigurationProperty(
model_configuration=bedrock.CfnFlow.VectorSearchBedrockRerankingModelConfigurationProperty(
model_arn="modelArn",
# the properties below are optional
additional_model_request_fields=additional_model_request_fields
),
# the properties below are optional
metadata_configuration=bedrock.CfnFlow.MetadataConfigurationForRerankingProperty(
selection_mode="selectionMode",
# the properties below are optional
selective_mode_configuration=bedrock.CfnFlow.RerankingMetadataSelectiveModeConfigurationProperty(
fields_to_exclude=[bedrock.CfnFlow.FieldForRerankingProperty(
field_name="fieldName"
)],
fields_to_include=[bedrock.CfnFlow.FieldForRerankingProperty(
field_name="fieldName"
)]
)
),
number_of_reranked_results=123
)
)
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.*;
Object additionalModelRequestFields;
KnowledgeBaseFlowNodeConfigurationProperty knowledgeBaseFlowNodeConfigurationProperty = KnowledgeBaseFlowNodeConfigurationProperty.builder()
.knowledgeBaseId("knowledgeBaseId")
// the properties below are optional
.guardrailConfiguration(GuardrailConfigurationProperty.builder()
.guardrailIdentifier("guardrailIdentifier")
.guardrailVersion("guardrailVersion")
.build())
.inferenceConfiguration(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.modelId("modelId")
.numberOfResults(123)
.orchestrationConfiguration(KnowledgeBaseOrchestrationConfigurationProperty.builder()
.additionalModelRequestFields(additionalModelRequestFields)
.inferenceConfig(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.performanceConfig(PerformanceConfigurationProperty.builder()
.latency("latency")
.build())
.promptTemplate(KnowledgeBasePromptTemplateProperty.builder()
.textPromptTemplate("textPromptTemplate")
.build())
.build())
.promptTemplate(KnowledgeBasePromptTemplateProperty.builder()
.textPromptTemplate("textPromptTemplate")
.build())
.rerankingConfiguration(VectorSearchRerankingConfigurationProperty.builder()
.type("type")
// the properties below are optional
.bedrockRerankingConfiguration(VectorSearchBedrockRerankingConfigurationProperty.builder()
.modelConfiguration(VectorSearchBedrockRerankingModelConfigurationProperty.builder()
.modelArn("modelArn")
// the properties below are optional
.additionalModelRequestFields(additionalModelRequestFields)
.build())
// the properties below are optional
.metadataConfiguration(MetadataConfigurationForRerankingProperty.builder()
.selectionMode("selectionMode")
// the properties below are optional
.selectiveModeConfiguration(RerankingMetadataSelectiveModeConfigurationProperty.builder()
.fieldsToExclude(List.of(FieldForRerankingProperty.builder()
.fieldName("fieldName")
.build()))
.fieldsToInclude(List.of(FieldForRerankingProperty.builder()
.fieldName("fieldName")
.build()))
.build())
.build())
.numberOfRerankedResults(123)
.build())
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock;
var additionalModelRequestFields;
var knowledgeBaseFlowNodeConfigurationProperty = new KnowledgeBaseFlowNodeConfigurationProperty {
KnowledgeBaseId = "knowledgeBaseId",
// the properties below are optional
GuardrailConfiguration = new GuardrailConfigurationProperty {
GuardrailIdentifier = "guardrailIdentifier",
GuardrailVersion = "guardrailVersion"
},
InferenceConfiguration = new PromptInferenceConfigurationProperty {
Text = new PromptModelInferenceConfigurationProperty {
MaxTokens = 123,
StopSequences = new [] { "stopSequences" },
Temperature = 123,
TopP = 123
}
},
ModelId = "modelId",
NumberOfResults = 123,
OrchestrationConfiguration = new KnowledgeBaseOrchestrationConfigurationProperty {
AdditionalModelRequestFields = additionalModelRequestFields,
InferenceConfig = new PromptInferenceConfigurationProperty {
Text = new PromptModelInferenceConfigurationProperty {
MaxTokens = 123,
StopSequences = new [] { "stopSequences" },
Temperature = 123,
TopP = 123
}
},
PerformanceConfig = new PerformanceConfigurationProperty {
Latency = "latency"
},
PromptTemplate = new KnowledgeBasePromptTemplateProperty {
TextPromptTemplate = "textPromptTemplate"
}
},
PromptTemplate = new KnowledgeBasePromptTemplateProperty {
TextPromptTemplate = "textPromptTemplate"
},
RerankingConfiguration = new VectorSearchRerankingConfigurationProperty {
Type = "type",
// the properties below are optional
BedrockRerankingConfiguration = new VectorSearchBedrockRerankingConfigurationProperty {
ModelConfiguration = new VectorSearchBedrockRerankingModelConfigurationProperty {
ModelArn = "modelArn",
// the properties below are optional
AdditionalModelRequestFields = additionalModelRequestFields
},
// the properties below are optional
MetadataConfiguration = new MetadataConfigurationForRerankingProperty {
SelectionMode = "selectionMode",
// the properties below are optional
SelectiveModeConfiguration = new RerankingMetadataSelectiveModeConfigurationProperty {
FieldsToExclude = new [] { new FieldForRerankingProperty {
FieldName = "fieldName"
} },
FieldsToInclude = new [] { new FieldForRerankingProperty {
FieldName = "fieldName"
} }
}
},
NumberOfRerankedResults = 123
}
}
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// 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/awscdk"
var additionalModelRequestFields interface{}
knowledgeBaseFlowNodeConfigurationProperty := &KnowledgeBaseFlowNodeConfigurationProperty{
KnowledgeBaseId: jsii.String("knowledgeBaseId"),
// the properties below are optional
GuardrailConfiguration: &GuardrailConfigurationProperty{
GuardrailIdentifier: jsii.String("guardrailIdentifier"),
GuardrailVersion: jsii.String("guardrailVersion"),
},
InferenceConfiguration: &PromptInferenceConfigurationProperty{
Text: &PromptModelInferenceConfigurationProperty{
MaxTokens: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopP: jsii.Number(123),
},
},
ModelId: jsii.String("modelId"),
NumberOfResults: jsii.Number(123),
OrchestrationConfiguration: &KnowledgeBaseOrchestrationConfigurationProperty{
AdditionalModelRequestFields: additionalModelRequestFields,
InferenceConfig: &PromptInferenceConfigurationProperty{
Text: &PromptModelInferenceConfigurationProperty{
MaxTokens: jsii.Number(123),
StopSequences: []*string{
jsii.String("stopSequences"),
},
Temperature: jsii.Number(123),
TopP: jsii.Number(123),
},
},
PerformanceConfig: &PerformanceConfigurationProperty{
Latency: jsii.String("latency"),
},
PromptTemplate: &KnowledgeBasePromptTemplateProperty{
TextPromptTemplate: jsii.String("textPromptTemplate"),
},
},
PromptTemplate: &KnowledgeBasePromptTemplateProperty{
TextPromptTemplate: jsii.String("textPromptTemplate"),
},
RerankingConfiguration: &VectorSearchRerankingConfigurationProperty{
Type: jsii.String("type"),
// the properties below are optional
BedrockRerankingConfiguration: &VectorSearchBedrockRerankingConfigurationProperty{
ModelConfiguration: &VectorSearchBedrockRerankingModelConfigurationProperty{
ModelArn: jsii.String("modelArn"),
// the properties below are optional
AdditionalModelRequestFields: additionalModelRequestFields,
},
// the properties below are optional
MetadataConfiguration: &MetadataConfigurationForRerankingProperty{
SelectionMode: jsii.String("selectionMode"),
// the properties below are optional
SelectiveModeConfiguration: &RerankingMetadataSelectiveModeConfigurationProperty{
FieldsToExclude: []interface{}{
&FieldForRerankingProperty{
FieldName: jsii.String("fieldName"),
},
},
FieldsToInclude: []interface{}{
&FieldForRerankingProperty{
FieldName: jsii.String("fieldName"),
},
},
},
},
NumberOfRerankedResults: jsii.Number(123),
},
},
}
Properties
guardrailConfigurationoptionalIResolvable | CfnFlow.guardrail_configurationoptionaltyping.Union[IResolvable, GuardrailConfigurationProperty]guardrailConfigurationoptionalIResolvableGuardrailConfigurationoptionalIResolvableGuardrailConfigurationoptionalinterface{} #Contains configurations for a guardrail to apply during query and response generation for the knowledge base in this configuration.
inferenceConfigurationoptionalIResolvable | CfnFlow.inference_configurationoptionaltyping.Union[IResolvable, PromptInferenceConfigurationProperty]inferenceConfigurationoptionalIResolvableInferenceConfigurationoptionalIResolvableInferenceConfigurationoptionalinterface{} #Contains inference configurations for the prompt.
knowledgeBaseIdstringknowledge_base_idstrknowledgeBaseIdStringKnowledgeBaseIdstringKnowledgeBaseId*string required #The unique identifier of the knowledge base to query.
modelIdoptionalstringmodel_idoptionalstrmodelIdoptionalStringModelIdoptionalstringModelIdoptional*string #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.
numberOfResultsoptionalnumbernumber_of_resultsoptionalint | floatnumberOfResultsoptionalNumberNumberOfResultsoptionaldoubleNumberOfResultsoptional*float64 #The number of results to retrieve from the knowledge base.
orchestrationConfigurationoptionalIResolvable | CfnFlow.orchestration_configurationoptionaltyping.Union[IResolvable, KnowledgeBaseOrchestrationConfigurationProperty]orchestrationConfigurationoptionalIResolvableOrchestrationConfigurationoptionalIResolvableOrchestrationConfigurationoptionalinterface{} #The configuration for orchestrating the retrieval and generation process in the knowledge base node.
promptTemplateoptionalIResolvable | CfnFlow.prompt_templateoptionaltyping.Union[IResolvable, KnowledgeBasePromptTemplateProperty]promptTemplateoptionalIResolvablePromptTemplateoptionalIResolvablePromptTemplateoptionalinterface{} #A custom prompt template to use with the knowledge base for generating responses.
rerankingConfigurationoptionalIResolvable | CfnFlow.reranking_configurationoptionaltyping.Union[IResolvable, VectorSearchRerankingConfigurationProperty]rerankingConfigurationoptionalIResolvableRerankingConfigurationoptionalIResolvableRerankingConfigurationoptionalinterface{} #The configuration for reranking the retrieved results from the knowledge base to improve relevance.