`@Service public class OllamaRAGServiceImpl implements OllamaRAGService {
@Autowired
private OllamaChatModel chatModel;
@Autowired
private VectorStore vectorStore;
@Value("${spring.ai.default-system.message}")
private String defaultSystemMessage;
private ChatClient chatClient;
@PostConstruct
private void buildChatClient() {
this.chatClient = ChatClient.builder(chatModel)
.defaultSystem(defaultSystemMessage)
.defaultAdvisors(
new MessageChatMemoryAdvisor(new InMemoryChatMemory()),
new QuestionAnswerAdvisor(vectorStore, SearchRequest.defaults()),
new SimpleLoggerAdvisor())
.defaultFunctions("getPolicyInfo") // FUNCTION CALLING
.build();
}
@Override
public Flux<String> retrieveWithStream(String request, String conversationId) {
return this.chatClient
.prompt()
.user(request)
.advisors(a -> a
.param(CHAT_MEMORY_CONVERSATION_ID_KEY, conversationId)
.param(CHAT_MEMORY_RETRIEVE_SIZE_KEY, 10))
.stream()
.content();
}
@Override
public String retrieve(String request, String conversationId) {
return this.chatClient
.prompt()
.user(request)
.advisors(a -> a
.param(CHAT_MEMORY_CONVERSATION_ID_KEY, conversationId)
.param(CHAT_MEMORY_RETRIEVE_SIZE_KEY, 10))
.call()
.content();
}
}`
When I remove the QuestionAnswerAdvisor, the function can be called normally, but after configuring RAG and the function call, RAG can work normally, but the function call does not work.