I am trying to do something where I have 2 advisors, one is a typical RAG vector store for my QuestionAnswerAdvisor and one is using redis for an embedding based cache of questions. The original QuestionAnswerAdvisor works great but when I add the redis store I don’t see how to qualify the injected bean to make sure it is using redis instead of pinecone. I tried this
@Bean(name = "openAiBuildClient")
public ChatClient buildClient(
@Qualifier("openAiChatClientBuilder") ChatClient.Builder openAiBuilder,
MessageChatMemoryAdvisor messageChatMemoryAdvisor,
RedisVectorStore redisVectorStore,
PineconeVectorStore pineconeVectorStore
) {
spring:
application:
name: "my-spring-ai"
ai:
vectorstore:
redis:
index: spring-ai-example
uri: redis://localhost:6379
pinecone:
apiKey: ${PINECONE_API_KEY}
index-name: spring-ai-example
But it doesn’t work like that because the Bean is a VectorStore instead of the individual RedisVectorStore and PineconeVectorStore.
So is it possible to have multiple vector stores at the same time with an @Qualifier
? If so how do I do it?