I’m working on a project with Spring Boot 3.4.5 and Spring AI 1.0.0 connected to Llama3.2 through Ollama. My setup uses function calling with RAG to dynamically choose which tools to send to the language model.
The issue I’m facing is with confirmation workflows. Here’s what happens:
User: Create account - Username: Alice, Email: [email protected]
Bot: Account preview ready: {...}. Should I create this account?
User: Yes → Need to complete the account creation
My RAG pipeline works great for the initial request by doing semantic matching on tool descriptions. But when users respond with simple confirmations like “yes”, “okay”, or “continue”, the system can’t figure out which tool to use anymore since these responses don’t have enough semantic meaning.
I have ChatMemory configured to track the conversation, but the confirmation phase breaks my tool selection because the user input is too generic. The RAG can’t match “yes” to the right function.
The real challenge comes with function calling specifically. While basic conversational RAG with ChatMemory handles follow-ups fine, tool selection gets tricky when users ask follow-up questions like “update the username” or “what email was that?” after the initial tool call. Each tool needs to handle these varied follow-up scenarios, making state tracking complicated.
How can I handle confirmation responses in Spring AI function calling while preserving the original context and avoiding re-running tool filtering?