Class DefaultQueryTransformer
java.lang.Object
dev.langchain4j.rag.query.transformer.DefaultQueryTransformer
- All Implemented Interfaces:
QueryTransformer
Default implementation of
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation simply returns the provided
QueryTransformer intended to be suitable for the majority of use cases.
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation simply returns the provided
Query without any transformation.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontransformAsync(Query query) Non-blocking counterpart ofQueryTransformer.transform(Query), invoked by the asynchronous (CompletableFuture/CompletionStage) and reactive (Flow.Publisher) AI Service modes when RAG is configured.
-
Constructor Details
-
DefaultQueryTransformer
public DefaultQueryTransformer()
-
-
Method Details
-
transform
Description copied from interface:QueryTransformer- Specified by:
transformin interfaceQueryTransformer- Parameters:
query- TheQueryto be transformed.- Returns:
- A collection of one or more
Querys derived from the originalQuery.
-
transformAsync
Description copied from interface:QueryTransformerNon-blocking counterpart ofQueryTransformer.transform(Query), invoked by the asynchronous (CompletableFuture/CompletionStage) and reactive (Flow.Publisher) AI Service modes when RAG is configured.The default implementation returns a failed future carrying
AsyncNotSupportedException: a transformer backed by a blocking LLM call (e.g. query compression/expansion) must opt in by overriding this method to stay off the calling thread. A transformer that cannot be made non-blocking is still usable from these modes viaDefaultRetrievalAugmentor, which offloads the blockingQueryTransformer.transform(Query)to its executor.- Specified by:
transformAsyncin interfaceQueryTransformer- Parameters:
query- TheQueryto be transformed.- Returns:
- A
CompletableFutureof one or moreQuerys derived from the originalQuery.
-