Offline RAG app that ingests local files, GitHub repos and websites and answers questions with local Ollama models, keeping data on your network.
ThomasVitale/llm-apps-java-spring-ai
A collection of sample Java applications showing how to build LLM and generative AI features with Spring AI and Spring Boot.
- Stars
- 787
- Forks
- 192
- Open issues
- 7
- Last commit
- 12 hours ago
What is it?
This repository is a set of sample projects for building Java applications that use Large Language Models and generative AI through Spring AI. It is organized by topic: basic chat, embeddings, image and audio models, prompt patterns, structured output, multimodality, tool calling, chat memory, guardrails, document ingestion, and several retrieval augmented generation (RAG) flows.
Most samples run locally against Ollama, and others use hosted providers such as OpenAI and Mistral AI. Vector storage examples use PGVector, and some embedding examples use ONNX transformers. Observability samples cover model and vector store monitoring, and one sample integrates the Brave Search API through the Model Context Protocol.
The project requires Java 25 and Podman or Docker for supporting services. Each sample lives in its own folder, so developers can pick the pattern they need and reuse it in their own Spring applications.
Key features
- 01Chat, embedding, image, and audio model examples across several providers
- 02Prompt, structured output, and tool calling patterns
- 03Chat memory implementations backed by JDBC or a vector store
- 04RAG flows (naive, advanced, branching, conditional) with PGVector
- 05Observability samples for LLM calls and vector stores
Use cases
- Adding a local LLM chatbot to a Spring Boot service using Ollama
- Building a document question answering system with RAG and PGVector
- Learning how to extract structured data from LLM output into Java objects
- Exploring tool calling and MCP integrations in a Java backend
Quick start
- 1
Install Java 25 and Podman or Docker
- 2
Choose a sample from the README, such as a use case or model folder, and follow its own instructions
Things to know
- Requires Java 25 and Podman or Docker.
- Many samples depend on hosted model providers such as OpenAI or Mistral AI, which need API keys.
- Several sections, including moderation, vector stores, evaluation, and agents, are marked as coming soon.
In collections
Topics
FAQ
- What is llm-apps-java-spring-ai?
- A collection of sample Java applications showing how to build LLM and generative AI features with Spring AI and Spring Boot. This repository is a set of sample projects for building Java applications that use Large Language Models and generative AI through Spring AI. It is organized by topic: basic chat, embeddings, image and audio models, prompt patterns, structured output, multimodality, tool calling, chat memory, guardrails, document ingestion, and several retrieval augmented generation (RAG) flows.
- Is llm-apps-java-spring-ai free to use? What license does it have?
- llm-apps-java-spring-ai is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is llm-apps-java-spring-ai still maintained?
- Actively maintained. The last commit to llm-apps-java-spring-ai was on Nov 6, 2026.
- What can I use llm-apps-java-spring-ai for?
- Adding a local LLM chatbot to a Spring Boot service using Ollama Building a document question answering system with RAG and PGVector Learning how to extract structured data from LLM output into Java objects Exploring tool calling and MCP integrations in a Java backend
- How do I install llm-apps-java-spring-ai?
- Install Java 25 and Podman or Docker Choose a sample from the README, such as a use case or model folder, and follow its own instructions
- Where can I get llm-apps-java-spring-ai?
- The source code and installation instructions are on GitHub: https://github.com/ThomasVitale/llm-apps-java-spring-ai
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Java library for calling the Ollama server's REST API, covering chat, generation, tools, embeddings and model management.
A PHP framework for building generative AI apps with LLMs, embeddings and vector databases, compatible with Symfony and Laravel.
Guide and chatbot web app for running a small local LLM with an OpenAI-compatible API on consumer-grade hardware via Ollama, vLLM or llama-cpp-python.
A command-line tool and Python library for running prompts and chats against remote and locally installed large language models.
An Emacs Lisp library that gives elisp code a single interface to many LLM providers, including OpenAI, Claude, Gemini and local Ollama.