Spring AI RAG with PGVector and Ollama Integration #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a complete example of a Retrieval-Augmented Generation (RAG) pipeline using:
Spring AI
PGVector (running via Docker)
Ollama for embedding and chat models
Instead of installing a local PGVector DB manually, this setup runs it using Docker Compose (compose.yaml). Please ensure the database is running before starting the Spring Boot application.
⚙️ Key Features
Uses Ollama locally for LLM (gemma:3b) and embedding (nomic-embed-text:latest) models
PDF file upload endpoint at POST /upload for document ingestion
Validates PDFs for table of contents (TOC) – required by default reader
Embeds paragraphs from the PDF and stores them in a vector store using PGVector
Auto-creates vector_store table if not specified
Uses initialize-schema: true in application.yaml to recreate the schema on every app run (can be customized)