Class ExpandingQueryTransformer
java.lang.Object
dev.langchain4j.rag.query.transformer.ExpandingQueryTransformer
- All Implemented Interfaces:
QueryTransformer
A
Refer to
Configurable parameters (optional):
-
-
QueryTransformer
that utilizes a ChatLanguageModel
to expand a given Query
.
Refer to
DEFAULT_PROMPT_TEMPLATE
and implementation for more details.
Configurable parameters (optional):
-
promptTemplate
: The prompt template used to instruct the LLM to expand the provided Query
.
-
n
: The number of Query
s to generate. Default value is 3.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ChatLanguageModel
static final int
static final PromptTemplate
protected final int
protected final PromptTemplate
-
Constructor Summary
ConstructorDescriptionExpandingQueryTransformer
(ChatLanguageModel chatLanguageModel) ExpandingQueryTransformer
(ChatLanguageModel chatLanguageModel, int n) ExpandingQueryTransformer
(ChatLanguageModel chatLanguageModel, PromptTemplate promptTemplate) ExpandingQueryTransformer
(ChatLanguageModel chatLanguageModel, PromptTemplate promptTemplate, Integer n) -
Method Summary
-
Field Details
-
DEFAULT_PROMPT_TEMPLATE
-
DEFAULT_N
public static final int DEFAULT_N- See Also:
-
chatLanguageModel
-
promptTemplate
-
n
protected final int n
-
-
Constructor Details
-
ExpandingQueryTransformer
-
ExpandingQueryTransformer
-
ExpandingQueryTransformer
public ExpandingQueryTransformer(ChatLanguageModel chatLanguageModel, PromptTemplate promptTemplate) -
ExpandingQueryTransformer
public ExpandingQueryTransformer(ChatLanguageModel chatLanguageModel, PromptTemplate promptTemplate, Integer n)
-
-
Method Details
-
builder
-
transform
Description copied from interface:QueryTransformer
- Specified by:
transform
in interfaceQueryTransformer
- Parameters:
query
- TheQuery
to be transformed.- Returns:
- A collection of one or more
Query
s derived from the originalQuery
.
-
createPrompt
-
parse
-