Status: [UNTESTED] Endpoints found: http://localhost:8080/ai/chat?message=Hello%20from%20Spring%20AI http://localhost:8080/ai/chat http://localhost:8080/ai/chat/stream?message=Tell%20me%20a%20short%20story http://localhost:8080/ai/chat/stream http://localhost:8080/ai/chat/memory?sessionId=$SESSION&message=My%20name%20is%20Tiago Source: https://github.com/tiagouzl/spring-ai-ollama-demo # Spring AI + Ollama Demo ยท with Spring AI Alibaba (DashScope) ![Java](https://img.shields.io/badge/Java-21-ED8B00?logo=openjdk&logoColor=white) ![Spring Boot](https://img.shields.io/badge/Spring_Boot-3.4-6DB33F?logo=spring&logoColor=white) ![Spring AI](https://img.shields.io/badge/Spring_AI-1.0.1-green) ![Spring AI Alibaba](https://img.shields.io/badge/Spring_AI_Alibaba-1.0.0.4-FF6A00) ![Ollama](https://img.shields.io/badge/Ollama-granite4.1:3b-000000) ![DashScope](https://img.shields.io/badge/DashScope-qwen--plus-6B54D2) [![Build](https://img.shields.io/github/actions/workflow/status/tiagouzl/spring-ai-ollama-demo/ci.yml?branch=main&label=CI)](https://github.com/tiagouzl/spring-ai-ollama-demo/actions) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) A minimal, production-style **Spring Boot 3** application that integrates **Spring AI** with a **local LLM served by Ollama** โ€” and optionally with **Alibaba DashScope (Qwen)** via **Spring AI Alibaba** โ€” fully offline by default, cloud-ready when you set `DASHSCOPE_API_KEY`. This project is a clean reference for building AI-agent / LLM applications on the **Java + Spring** ecosystem, widely adopted by enterprises in China via the Spring AI Alibaba ecosystem. --- ## โœจ Highlights - ๐Ÿ“ฆ **Spring Boot 3.4** + **Spring AI 1.0.1** + **Spring AI Alibaba 1.0.0.4** - ๐Ÿ  **100% local & free by default** โ€” uses Ollama, no API key needed - โ˜๏ธ **Cloud-ready** โ€” flip to Alibaba DashScope (Qwen) by setting `DASHSCOPE_API_KEY` - โšก Powered by the fluent `ChatClient` API (works with both Ollama and DashScope) - ๐Ÿ”„ **Streaming** responses (Server-Sent Events) with `ChatClient.stream()` - ๐Ÿ’ฌ **Multi-turn chat** with per-conversation memory (`MessageChatMemoryAdvisor`) - ๐Ÿ›  **Function calling / Tool use** with `@Tool` โ€” model calls Java methods (`DateTimeTools`, `MathTools`) - ๐Ÿ›ก **Production-style hardening** โ€” Bean Validation (`@NotBlank` + `@Valid`) on all POST bodies, struc