Class ContextualQueryAugmenter
java.lang.Object
org.springframework.ai.rag.generation.augmentation.ContextualQueryAugmenter
- All Implemented Interfaces:
BiFunction<Query,
,List<Document>, Query> QueryAugmenter
Augments the user query with contextual data from the content of the provided
documents.
Example usage:
QueryAugmenter augmenter = ContextualQueryAugmenter.builder()
.allowEmptyContext(false)
.build();
Query augmentedQuery = augmenter.augment(query, documents);
- Since:
- 1.0.0
- Author:
- Thomas Vitale
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionContextualQueryAugmenter
(PromptTemplate promptTemplate, PromptTemplate emptyContextPromptTemplate, Boolean allowEmptyContext) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface org.springframework.ai.rag.generation.augmentation.QueryAugmenter
apply
-
Constructor Details
-
ContextualQueryAugmenter
public ContextualQueryAugmenter(@Nullable PromptTemplate promptTemplate, @Nullable PromptTemplate emptyContextPromptTemplate, @Nullable Boolean allowEmptyContext)
-
-
Method Details
-
augment
Description copied from interface:QueryAugmenter
Augments the user query with contextual data.- Specified by:
augment
in interfaceQueryAugmenter
- Parameters:
query
- The user query to augmentdocuments
- The contextual data to use for augmentation- Returns:
- The augmented query
-
builder
-