Temporal + Spring AI RAG Example
The combination of Temporal with Spring AI shows how straightforward the setup of a processing and query pipeline can be.
What comes in the demo:
- A user interface to interact with the LLM both as an end user chatting and as an admin user enhancing content.
- A Spring based API that handles the endpoints needed by the user interface and interacts with Temporal.
- A set of Temporal Workflows and Activities that leverage Spring AI, PGVector for a Vector database and Ollama for LLM models.
- Instructions on how to get everything running locally.
Out of the box the demo assumes everything will be running locally however that can be changed by modifying configuration files.
How does it work?
This demo is meant to be a starting point for someone interested in using Temporal and Spring AI to query and enhance LLMs using Retrieval Augmented Generation (RAG). It is intentionally bare bones to provide just an example of the interaction between Temporal, Spring and Spring AI.
The following is an example chat showing a question asked before adding and after adding content to the demo that contains the latest Disney theme park (as of 2025):
The following diagram shows the interaction between the various parts of the system: