RagWiser
@RobertoDure
RagWiser is a Retrieval Augmented Generation (RAG) system built with Spring Boot that enables users to upload PDF documents, process them, and ask questions about their content using natural language.
Overview
What is RagWiser?
RagWiser is a Retrieval Augmented Generation (RAG) system built with Spring Boot. It enables users to upload PDF documents, process them, and ask questions about their content using natural language. It integrates with OpenAI's GPT models and uses PGVector for vector storage.
How to use RagWiser?
Clone the repository, configure your OpenAI API key in application.yaml, start the PostgreSQL database with pgvector via Docker Compose, and run the application with ./mvnw spring-boot:run. Use the REST API endpoint POST /api/rag/upload to upload a PDF, and GET /api/rag?question=... to ask questions. RagWiser also exposes a Tool-based integration via Spring AI’s Tool Callbacks for use by other AI systems.
Key features of RagWiser
- Upload and process PDF documents via REST API
- Automatic text extraction, chunking, and embedding generation
- Semantic search and RAG-powered question answering
- Spring AI and PGVector integration for vector storage
- Docker support with containerized PostgreSQL and pgvector
- Tool-based integration for MCP and other AI systems
Use cases of RagWiser
- Querying legal documents (e.g., articles of a constitution) by natural language
- Building a corporate knowledge base from internal PDF reports
- Creating a document Q&A assistant for research papers
- Enabling AI agents to retrieve and reason over PDF content via tool calls
FAQ from RagWiser
What technology stack does RagWiser use?
RagWiser uses Java 21, Spring Boot 3.3.2, Spring AI 1.0.0-M1, PostgreSQL with pgvector extension, Docker, and OpenAI GPT-4.
How are documents processed and stored?
Uploaded PDFs are read using PagePdfDocumentReader, split into chunks with TokenTextSplitter, embedded, and stored in a PostgreSQL vector store using the pgvector extension with a 1536-dimensional embedding and HNSW index.
What are the prerequisites to run RagWiser?
You need JDK 21, Docker and Docker Compose, and a valid OpenAI API key.
Does RagWiser support only REST or also MCP tool integration?
RagWiser provides both REST API endpoints and a Tool-based integration using Spring AI’s Tool Callbacks, allowing it to be used as a tool by other AI systems (e.g., MCP clients).
Where is the vector data stored?
Vector embeddings are stored in a PostgreSQL database with the pgvector extension, using a vector_store table with columns for content, metadata, and the embedding vector.