As RetrievalAugmentationAdvisor is expected to replace QuestionAnswerAdvisor, it should also support FILTER_EXPRESSION the way that QuestionAnswerAdvisor does.

This makes it possible to configure the advisor as a default advisor when creating a ChatClient and then plug in a filter expression for searching the vector store when submitting a prompt.

I suspect, based on how this works with RetrievalAugmentationAdvisor that the change required would be made to VectorStoreDocumentRetriever, as that's the place and implementation of DocumentRetriever that would be able to make use of the expression.

Comment From: habuma

Just to add some context, here's some code showing what I'm asking for...

@RestController
public class AskController {

    private final ChatClient chatClient;
    private final RetrievalAugmentationAdvisor ragAdvisor;

    // If I define the ChatClient with the advisor here...
    AskController(ChatClient.Builder chatClientBuilder, VectorStore vectorStore) {
        var documentRetriever = VectorStoreDocumentRetriever.builder()
                .vectorStore(vectorStore)
                .build();
        this.ragAdvisor = RetrievalAugmentationAdvisor.builder()
                .documentRetriever(documentRetriever)
                .build();
        this.chatClient = chatClientBuilder
                .defaultAdvisors(ragAdvisor)
                .build();
    }

    @PostMapping("/ask")
    public Answer ask(@RequestBody Question question) {
        String someRequestTimeMetadataValue = ...;
        return chatClient.prompt()
                .user(question.question())
                // ...then how can I customize the query sent to the vector store
                //    to filter on someRequestTimeMetadataValue?
                .call()
                .entity(Answer.class);
    }

}

It doesn't have to be exactly the same as with QuestionAnswerAdvisor, but I need to have some way of refining the vector store query based on request-time values.