Hello everyone guys. I’m new here and I’m a newbie on this topics, I’m searching feedbacks on some doubts I have while developing a spring boot application using langchain4j 0.29.0.
Don’t know if it would be a silly question, but, my doubts concerning RAG together with function calling (Tools).
Let’s suppose I’ve setupped a ChatAssistant to use a generic DefaultRetrievalAugmentor with an EmbeddingStoreContentRetriever as retriever.
The same ChatAssistant is also enabled to some tools through a class that exposes some methods annotated with @Tool that solve an equation (just an example, not real use case).
Now, when I invoke the chat method saying, as an example, “solve x^2 + 2x + 1 = 0”, by debugging the undergoing calls to DefaultAiServices, I understood that what happen is:
- the Augmentation is done
- the message is sent (messages being memory mandatory)
- the message response contains tool execution
- the tool is executed
- the answer of the tools is add as message
- stop or go back to 2
In my use case the tool response is a prompt built after calling some external services to gain information.
Said that, the RAG is done for the very first message promp, the one that triggers the function calling, but my question is:
“Wouldn’t it be more useful if the RAG was done on the second prompt? the one created via function calling?”
I can’t understand if, as it is, the RAG on the first message can have significant utility, or would it be better to do RAG “by hand” directly on the second prompt?
What do you think?
Thanks to everyone who will have a little patience to tell me their opinion, and maybe explain to me where I’m going wrong.
Carmelo