Class CompressionQueryTransformer
java.lang.Object
org.springframework.ai.rag.preretrieval.query.transformation.CompressionQueryTransformer
- All Implemented Interfaces:
Function<Query,,Query> QueryTransformer
Uses a large language model to compress a conversation history and a follow-up query
into a standalone query that captures the essence of the conversation.
This transformer is useful when the conversation history is long and the follow-up query is related to the conversation context.
- Since:
- 1.0.0
- Author:
- Thomas Vitale
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCompressionQueryTransformer(org.springframework.ai.chat.client.ChatClient.Builder chatClientBuilder, org.springframework.ai.chat.prompt.PromptTemplate promptTemplate) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Transforms the given query according to the implemented strategy.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.rag.preretrieval.query.transformation.QueryTransformer
apply
-
Constructor Details
-
CompressionQueryTransformer
public CompressionQueryTransformer(org.springframework.ai.chat.client.ChatClient.Builder chatClientBuilder, @Nullable org.springframework.ai.chat.prompt.PromptTemplate promptTemplate)
-
-
Method Details
-
transform
Description copied from interface:QueryTransformerTransforms the given query according to the implemented strategy.- Specified by:
transformin interfaceQueryTransformer- Parameters:
query- The original query to transform- Returns:
- The transformed query
-
builder
-