Skip to content
v2.278.0

VectorSearchBedrockRerankingConfigurationProperty Struct ​

Configuration for using Amazon Bedrock foundation models to rerank Knowledge Base vector search results.

This enables more sophisticated relevance ranking using large language models.

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 vectorSearchBedrockRerankingConfigurationProperty: bedrock.CfnFlow.VectorSearchBedrockRerankingConfigurationProperty = {
  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

vector_search_bedrock_reranking_configuration_property = 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;

VectorSearchBedrockRerankingConfigurationProperty vectorSearchBedrockRerankingConfigurationProperty = 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();
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 vectorSearchBedrockRerankingConfigurationProperty = 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{}

vectorSearchBedrockRerankingConfigurationProperty := &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 ​

metadataConfigurationoptionalIResolvable | CfnFlow.MetadataConfigurationForRerankingPropertymetadata_configurationoptionaltyping.Union[IResolvable, MetadataConfigurationForRerankingProperty]metadataConfigurationoptionalIResolvableMetadataConfigurationoptionalIResolvableMetadataConfigurationoptionalinterface{} #
Configuration for how document metadata should be used during the reranking process.

This determines which metadata fields are included when reordering search results.

modelConfigurationIResolvable | CfnFlow.VectorSearchBedrockRerankingModelConfigurationPropertymodel_configurationtyping.Union[IResolvable, VectorSearchBedrockRerankingModelConfigurationProperty]modelConfigurationIResolvableModelConfigurationIResolvableModelConfigurationinterface{} required #
Configuration for the Amazon Bedrock foundation model used for reranking.

This includes the model ARN and any additional request fields required by the model.

numberOfRerankedResultsoptionalnumbernumber_of_reranked_resultsoptionalint | floatnumberOfRerankedResultsoptionalNumberNumberOfRerankedResultsoptionaldoubleNumberOfRerankedResultsoptional*float64 #
The maximum number of results to rerank.

This limits how many of the initial vector search results will be processed by the reranking model. A smaller number improves performance but may exclude potentially relevant results.