ThomasVitale/llm-apps-java-spring-ai

Samples showing how to build Java applications powered by Generative AI and LLMs using Spring AI and Spring Boot.

What it solves

This repository provides a comprehensive set of sample applications and implementation patterns for Java developers to build Generative AI applications using the Spring AI framework. It bridges the gap between AI concepts and practical Java implementation, offering concrete examples of how to integrate LLMs, vector databases, and multimodal capabilities into enterprise Java applications.

How it works

The project is organized as a collection of use cases and patterns implemented with Spring AI. It demonstrates integration with various model providers (OpenAI, Mistral AI, Ollama) and tools like PGVector for vector storage. The samples cover the entire AI application lifecycle, from data ingestion (reading PDFs, JSON, and Markdown) and document transformation (splitting and metadata enrichment) to advanced RAG (Retrieval Augmented Generation) flows including sequential, branching, and conditional RAG.

Who it’s for

Java developers and software architects who want to learn how to use Spring AI to build AI-infused applications, specifically those looking for practical, runnable samples of common AI patterns like RAG, tool calling, and structured output.

Highlights

  • Diverse Model Support: Integration with OpenAI, Mistral AI, and local LLMs via Ollama.
  • Advanced RAG Patterns: Implementations of naive, advanced, sequential, branching, and conditional RAG flows.
  • Comprehensive Tooling: Examples of structured data extraction, text classification, and multimodal prompts.
  • Enterprise-Ready Patterns: Implementations of chat memory (JDBC, Vector Store, Spring Security) and input/output guardrails.
  • Data Ingestion Pipeline: Built-in document readers for various formats (PDF, JSON, Markdown, Tika) and document transformers for chunking and metadata enrichment.