An open API service indexing awesome lists of open source software.

https://github.com/xkondix/aisandbox-java-spirng

Spring connection with LLMs
https://github.com/xkondix/aisandbox-java-spirng

chatmemory chroma gemma3 gpt java langchain4j llama3 llm ollama rag redis spring-boot

Last synced: 3 months ago
JSON representation

Spring connection with LLMs

Awesome Lists containing this project

README

          

# aiSandbox-JAVA-SPIRNG

# ๐Ÿค– Local AI Assistant with LangChain4j, Ollama & Spring Boot

This project demonstrates how to build a **local AI-powered assistant** using `LangChain4j`, `Spring Boot`, and `Ollama`, enabling tool-calling, Retrieval-Augmented Generation (RAG), chat memory, Redis.
Postman collection version 2.1 available in assets folder.
---

## ๐Ÿ”ฅ Features

- ๐Ÿง  **Local LLMs** (e.g., Gemma 3B, LLaMA 3.1 8B) with Ollama
- ๐Ÿ“ฅ **RAG with ChromaDB**: Local document embedding and retrieval
- ๐Ÿงฐ **@Tool Integration**: Math calculator, Artist file writer
- ๐Ÿ“š **Custom metadata injection** for enhanced prompt building
- ๐Ÿงพ **Redis-based chat memory**
---

## ๐Ÿง  Local LLM Setup with Ollama

To run this project locally with large language models:

```bash
docker compose up -d
docker exec -it ollama bash
ollama pull gemma3:4b
ollama pull llama3.1:8b
```
![img.png](assets/img.png)

---
## Tech Stack
- **Spring Boot 3.5.3**
- **JAVA 21**
- **LangChain4j**
- **Ollama**: for local models
- **Redis**: chat memory
- **Chroma**: document RAG vector DB
- **Docker Compose**

---
## Useful pages
**Github**
- https://github.com/langchain4j/langchain4j-examples/ `(spring boot)`
- https://github.com/cescoffier/langchain4j-deep-dive/ `(quarkus)`

**Page**
- https://docs.langchain4j.dev/ `(official documentation)`