liveBook · Manning

Ollama

As explained in Spring AI in Action

Ollama is a tool for running and serving open-source language models locally on user hardware.

Ollama runs open-source language models locally and for free on your own hardware, making it a practical development alternative to cloud AI services. section 1.2.2

Use Ollama with Spring AI by following this setup path:

  • Install Ollama, then pull models such as Gemma 2B or Mistral 7B with the ollama command-line tool. section 1.2.2
  • Add the Spring AI Ollama starter dependency; no API key is required because the service runs locally. section 1.2.2
  • Select the model with spring.ai.ollama.chat.model, since Spring AI otherwise defaults to Mistral 7B. section 1.2.2
$ ollama pull gemma:2b

Pull a local Gemma model before connecting it to the application. section 1.2.2

Choosing a local model

Gemma 2B ran comfortably on an older MacBook Pro, while Gemma 7B used more memory and generated responses significantly more slowly. section 1.2.2

How Spring AI in Action covers it

How deep it goes
Explains installation, model selection, dependency setup, configuration, and hardware trade-offs without detailing model internals.
Examples
Uses Gemma 2B, Gemma 7B, Mistral 7B, Ollama commands, and the /api/tags endpoint.
What it assumes
Assumes a machine capable of running Ollama and requires installing Ollama before pulling models or adding the Spring AI starter.
What you can do after
Operate/configure Ollama locally and connect a selected model to Spring AI without cloud credentials.
How it connects
Connects local model serving with Spring AI, language models, and OpenAI-compatible APIs.

Also explained in

Compare how 8 books explain Ollama →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.