r/SpringBoot • u/aleglr20 • Jan 22 '26
Question Help with logging retrieved documents in Spring AI RAG system
Hi everyone, i'm working on a RAG system using Spring AI and Elasticsearch, and I have a question about how documents are passed to the LLM.
Here's what I'm doing:
- I write a prompt.
- I retrieve documents from the vector store using
QuestionAnswerAdvisor. - I pass them to the LLM and get the response.
Everything works, but I need to understand how the documents are actually passed to the model. Specifically:
- Are the documents passed as separate entities?
- Or are they merged into a single large text before being sent to the LLM?
My concern is that if they are combined into a single context, it might “contaminate” the data because the LLM sees everything as one big block.
I tried using SimpleLoggerAdvisor, but it doesn’t give me the insight I need.
Has anyone figured out how to log or inspect exactly how Spring AI passes the retrieved documents to the LLM?
Thanks in advance for any guidance!
View all comments
Show parent comment
1
u/aleglr20 Jan 22 '26
Yeah, I was just looking at it right now and thinking about how I could write a new prompt to keep the retrieved docs separate, if possible. Thank you :)