JavaOne 2026 Demo Project — Local inference with Ollama + LangChain4j, RAG pipeline with evaluation.
- Java 21+ (
java -version) - Maven 3.9+ (
mvn -version) - Ollama installed and running (ollama.com/download)
ollama pull llama3.1:8b
ollama pull mistral:7b
ollama pull nomic-embed-textollama listmvn clean package -DskipTests
mvn spring-boot:runChat with the model:
curl "http://localhost:8080/chat?message=What+is+the+Java+record+keyword?"Tool calling (inventory lookup — uses /chat/tools endpoint):
curl "http://localhost:8080/chat/tools?message=How+many+units+of+JDK-21+do+we+have+in+stock?"To swap models, change ollama.chat-model in src/main/resources/application.yml to mistral:7b and restart.
curl -X POST "http://localhost:8080/ingest"curl "http://localhost:8080/ask?question=What+are+virtual+threads+in+Java+21?"curl -X POST "http://localhost:8080/evaluate"├── pom.xml
├── docs/ # Sample documents for RAG
│ ├── java21-features.txt
│ ├── spring-boot-config.txt
│ └── kubernetes-java-deploy.txt
└── src/main/java/com/javaone/openmodels/
├── OpenModelsDemoApplication.java # Spring Boot entry point
├── config/
│ ├── OllamaConfig.java # Chat model + chat assistant bean
│ └── RagConfig.java # Embedding model, store, RAG assistant
├── controller/
│ ├── ChatController.java # GET /chat, GET /chat/tools
│ └── RagController.java # POST /ingest, GET /ask, POST /evaluate
└── service/
├── Assistant.java # AI Service interface
├── DocumentIngestor.java # Document loading, splitting, embedding
├── InventoryTools.java # @Tool example for Demo 1
└── RagEvaluator.java # Golden test set evaluation
| Method | Path | Description |
|---|---|---|
| GET | /chat?message=... |
Chat with LLM (Demo 1) |
| GET | /chat/tools?message=... |
Chat with tool calling (Demo 1) |
| POST | /ingest |
Ingest docs into vector store (Demo 2) |
| GET | /ask?question=... |
RAG query (Demo 2) |
| POST | /evaluate |
Run eval test set (Demo 2) |