Package com.bytedesk.ai.springai.rag
Class CustomContextQueryAugmenter
java.lang.Object
com.bytedesk.ai.springai.rag.CustomContextQueryAugmenter
- All Implemented Interfaces:
BiFunction<org.springframework.ai.rag.Query,
,List<org.springframework.ai.document.Document>, org.springframework.ai.rag.Query> org.springframework.ai.rag.generation.augmentation.QueryAugmenter
public class CustomContextQueryAugmenter
extends Object
implements org.springframework.ai.rag.generation.augmentation.QueryAugmenter
Pre-Retrieval: QueryAugmenter
https://java2ai.com/blog/spring-ai-alibaba-module-rag/?spm=0.29160081.0.0.75c73b5blqQmqQ
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.springframework.ai.chat.prompt.PromptTemplate
private static final org.springframework.ai.chat.prompt.PromptTemplate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull org.springframework.ai.rag.Query
augment
(org.springframework.ai.rag.Query query, List<org.springframework.ai.document.Document> documents) org.springframework.ai.rag.Query
augmentQueryWhenEmptyContext
(org.springframework.ai.rag.Query query) org.springframework.ai.rag.preretrieval.query.transformation.QueryTransformer
queryTransformer
(org.springframework.ai.chat.client.ChatClient.Builder chatClientBuilder, org.springframework.ai.chat.prompt.PromptTemplate transformerPromptTemplate) 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
-
Field Details
-
promptTemplate
private static final org.springframework.ai.chat.prompt.PromptTemplate promptTemplate -
emptyPromptTemplate
private static final org.springframework.ai.chat.prompt.PromptTemplate emptyPromptTemplate
-
-
Constructor Details
-
CustomContextQueryAugmenter
public CustomContextQueryAugmenter()
-
-
Method Details
-
augment
@NotNull public @NotNull org.springframework.ai.rag.Query augment(@Nullable org.springframework.ai.rag.Query query, @Nullable List<org.springframework.ai.document.Document> documents) - Specified by:
augment
in interfaceorg.springframework.ai.rag.generation.augmentation.QueryAugmenter
-
augmentQueryWhenEmptyContext
public org.springframework.ai.rag.Query augmentQueryWhenEmptyContext(org.springframework.ai.rag.Query query) -
queryTransformer
@Bean public org.springframework.ai.rag.preretrieval.query.transformation.QueryTransformer queryTransformer(org.springframework.ai.chat.client.ChatClient.Builder chatClientBuilder, @Qualifier("transformerPromptTemplate") org.springframework.ai.chat.prompt.PromptTemplate transformerPromptTemplate)
-