AI Engineering

Building Local AI Using Ollama and Spring AI

Build local AI applications with Ollama and Spring AI, from model setup and prompts to tools, streaming, and multimodal features.

Difficulty
Intermediate
Duration
~22 hours
Modules
10 modules
Lessons
40 lessons
Sign in to Start Course

What You'll Learn

  • Explain how local inference works and run models with Ollama.
  • Build Spring AI applications with prompts, structured output, and conversation memory.
  • Generate embeddings and build vector-search and retrieval-augmented generation workflows.
  • Connect AI models to application capabilities using tool and function calling.
  • Develop advanced, streaming, and multimodal AI application patterns.
  • Evaluate model selection, resource requirements, and application trade-offs.

Prerequisites

  • Basic Java programming and familiarity with Spring Boot, including application structure and dependency injection; the examples use Java 25 and Maven.
  • Basic understanding of REST, HTTP, and JSON.
  • Ability to use a command-line terminal.
  • A computer on which Ollama and the course models can be installed; requirements vary by model and machine.

Course Curriculum

Module 1: Introduction to Local AI and Ollama

FREE preview

3 lessons

  1. 1Local AI and Ollama
  2. 2Install and Run a Local Model
  3. 3Call Ollama's HTTP API

Module 2: Getting Started with Spring AI

PRO

2 lessons

  1. 1Connect Spring Boot to Ollama with ChatClientSign in to access
  2. 2ChatModel and Runtime Model OptionsSign in to access

Module 3: Prompt Engineering and Structured Output

PRO

3 lessons

  1. 1Prompt Structure and Instruction DesignSign in to access
  2. 2Prompt Templates and Few-Shot ExamplesSign in to access
  3. 3Structured Output, Validation, and Invalid ResponsesSign in to access

Module 4: Conversation and Memory

PRO

4 lessons

  1. 1Conversation State, Roles, and Manual HistorySign in to access
  2. 2ChatMemory and Bounded Conversation WindowsSign in to access
  3. 3Persist Chat Memory with JDBCSign in to access
  4. 4Context Limits and Memory versus RAGSign in to access

Module 5: Embeddings and Vector Search

PRO

6 lessons

  1. 1Understand Embeddings and Embedding ModelsSign in to access
  2. 2Generate Embeddings with Spring AISign in to access
  3. 3Compare Vectors and Interpret SimilaritySign in to access
  4. 4Understand Vector Search and Storage ChoicesSign in to access
  5. 5Use Spring AI Document and VectorStoreSign in to access
  6. 6Build Semantic Search with SimpleVectorStoreSign in to access

Module 6: Building RAG Applications

PRO

7 lessons

  1. 1RAG Ingestion and Spring AI DocumentsSign in to access
  2. 2Ingest and Search a Knowledge FileSign in to access
  3. 3Chunk Documents with TokenTextSplitterSign in to access
  4. 4Choose Chunk Boundaries and Preprocess ContentSign in to access
  5. 5Tune Search and Filter MetadataSign in to access
  6. 6Build Manual RAG and Diagnose FailuresSign in to access
  7. 7Use QuestionAnswerAdvisorSign in to access

Module 7: AI Tool and Function Calling

PRO

4 lessons

  1. 1Understand the Tool-Calling LifecycleSign in to access
  2. 2Define and Register Spring AI ToolsSign in to access
  3. 3Design Structured Tool Arguments and ResultsSign in to access
  4. 4Validate Tool Calls and Test SelectionSign in to access

Module 8: Building Advanced AI Applications

PRO

4 lessons

  1. 1Choose RAG, Tools, or BothSign in to access
  2. 2Combine Conversation Memory with ToolsSign in to access
  3. 3Secure Tools and Extend Retrieval DeliberatelySign in to access
  4. 4Capstone: Build a Smart Order AssistantSign in to access

Module 9: Streaming AI Responses

PRO

4 lessons

  1. 1Stream a Basic ResponseSign in to access
  2. 2Expose SSE with Spring MVCSign in to access
  3. 3Stream with Memory and Handle InterruptionSign in to access
  4. 4Stream after RAG and Tool OrchestrationSign in to access

Module 10: Multimodal AI and Model Selection

PRO

3 lessons

  1. 1Understand Image Input with Spring AISign in to access
  2. 2Build an Image-Review EndpointSign in to access
  3. 3Select and Route ModelsSign in to access