Package com.sap.ai.sdk.grounding.model
Class MergeStrategyReranker
java.lang.Object
com.sap.ai.sdk.grounding.model.MergeStrategyReranker
- All Implemented Interfaces:
RetrievalSearchInputPostProcessingInnerStrategy,Strategy
public class MergeStrategyReranker
extends Object
implements RetrievalSearchInputPostProcessingInnerStrategy, Strategy
The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult
instances. This strategy adds latency, but yields good results.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe RerankerModel to use. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor for MergeStrategyReranker. -
Method Summary
Modifier and TypeMethodDescriptionaddBoostingItem(MergeStrategyRerankerBoostingInner boostingItem) Add one boosting instance to thisMergeStrategyReranker.boosting(List<MergeStrategyRerankerBoostingInner> boosting) Set the boosting of thisMergeStrategyRerankerinstance and return the same instance.static MergeStrategyRerankercreate()Create a newMergeStrategyRerankerinstance.booleanKey-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.getCustomField(String name) Deprecated.Get the names of the unrecognizable properties of theMergeStrategyReranker.getModel()The RerankerModel to use.getType()Get typeinthashCode()includeAllMetaData(Boolean includeAllMetaData) Set the includeAllMetaData of thisMergeStrategyRerankerinstance and return the same instance.If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.Set the model of thisMergeStrategyRerankerinstance and return the same instance.voidsetBoosting(List<MergeStrategyRerankerBoostingInner> boosting) Set the boosting of thisMergeStrategyRerankerinstance.voidsetCustomField(String customFieldName, Object customFieldValue) Set an unrecognizable property of thisMergeStrategyRerankerinstance.voidsetIncludeAllMetaData(Boolean includeAllMetaData) Set the includeAllMetaData of thisMergeStrategyRerankerinstance.voidSet the model of thisMergeStrategyRerankerinstance.voidsetType(MergeStrategyType type) Set the type of thisMergeStrategyRerankerinstance.toMap()Get the value of all properties of thisMergeStrategyRerankerinstance including unrecognized properties.toString()type(MergeStrategyType type) Set the type of thisMergeStrategyRerankerinstance and return the same instance.
-
Constructor Details
-
MergeStrategyReranker
protected MergeStrategyReranker()Default constructor for MergeStrategyReranker.
-
-
Method Details
-
type
Set the type of thisMergeStrategyRerankerinstance and return the same instance.- Parameters:
type- The type of thisMergeStrategyReranker- Returns:
- The same instance of this
MergeStrategyRerankerclass
-
getType
Get type- Returns:
- type The type of this
MergeStrategyRerankerinstance.
-
setType
Set the type of thisMergeStrategyRerankerinstance.- Parameters:
type- The type of thisMergeStrategyReranker
-
model
Set the model of thisMergeStrategyRerankerinstance and return the same instance.- Parameters:
model- The RerankerModel to use.- Returns:
- The same instance of this
MergeStrategyRerankerclass
-
getModel
The RerankerModel to use.- Returns:
- model The model of this
MergeStrategyRerankerinstance.
-
setModel
Set the model of thisMergeStrategyRerankerinstance.- Parameters:
model- The RerankerModel to use.
-
boosting
@Nonnull public MergeStrategyReranker boosting(@Nullable List<MergeStrategyRerankerBoostingInner> boosting) Set the boosting of thisMergeStrategyRerankerinstance and return the same instance.- Parameters:
boosting- Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.- Returns:
- The same instance of this
MergeStrategyRerankerclass
-
addBoostingItem
@Nonnull public MergeStrategyReranker addBoostingItem(@Nonnull MergeStrategyRerankerBoostingInner boostingItem) Add one boosting instance to thisMergeStrategyReranker.- Parameters:
boostingItem- The boosting that should be added- Returns:
- The same instance of type
MergeStrategyReranker
-
getBoosting
Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.- Returns:
- boosting The boosting of this
MergeStrategyRerankerinstance.
-
setBoosting
Set the boosting of thisMergeStrategyRerankerinstance.- Parameters:
boosting- Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.
-
includeAllMetaData
Set the includeAllMetaData of thisMergeStrategyRerankerinstance and return the same instance.- Parameters:
includeAllMetaData- If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.- Returns:
- The same instance of this
MergeStrategyRerankerclass
-
isIncludeAllMetaData
If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.- Returns:
- includeAllMetaData The includeAllMetaData of this
MergeStrategyRerankerinstance.
-
setIncludeAllMetaData
Set the includeAllMetaData of thisMergeStrategyRerankerinstance.- Parameters:
includeAllMetaData- If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.
-
getCustomFieldNames
Get the names of the unrecognizable properties of theMergeStrategyReranker.- Returns:
- The set of properties names
-
getCustomField
@Nullable @Deprecated public Object getCustomField(@Nonnull String name) throws NoSuchElementException Deprecated.UsetoMap()instead.Get the value of an unrecognizable property of thisMergeStrategyRerankerinstance.- Parameters:
name- The name of the property- Returns:
- The value of the property
- Throws:
NoSuchElementException- If no property with the given name could be found.
-
toMap
Get the value of all properties of thisMergeStrategyRerankerinstance including unrecognized properties.- Returns:
- The map of all properties
-
setCustomField
Set an unrecognizable property of thisMergeStrategyRerankerinstance. If the map previously contained a mapping for the key, the old value is replaced by the specified value.- Parameters:
customFieldName- The name of the propertycustomFieldValue- The value of the property
-
equals
-
hashCode
public int hashCode() -
toString
-
create
Create a newMergeStrategyRerankerinstance. No arguments are required.
-
toMap()instead.