Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Langchain4j & Ollama - Integrating LLMs with Ja...

Langchain4j & Ollama - Integrating LLMs with Java programs {Workshop} @ OpenSlava 2025

Slides from my workshop at OpenSlava 2025 (October 15th) titled "Langchain4j & Ollama - Integrating LLMs with Java programs".
The code, including the step-by-step guidance is available here: https://github.com/deors/workshop-langchain4j

Avatar for Jorge Hidalgo

Jorge Hidalgo

October 15, 2025
Tweet

More Decks by Jorge Hidalgo

Other Decks in Technology

Transcript

  1. Associate Director – Software Engineering – Accenture Iberia Lead –

    DevOps & Platform Engineering Enterprise & Systems Architecture – Advanced Technology Center Java Global Community of Practice Java Champion Very active with open source and technology communities: Co-organizer – MálagaJUG / BoquerónSec Co-organizer – OpenSouthCode / OpenSouthKids Codemotion Ambassador @deors.bsky.social in/deors Jorge Hidalgo Copyright © 2025 Jorge Hidalgo – CC BY 4.0 3
  2. Langchain4j Library to simplify integration of AI- based systems into

    Java programs https://github.com/langchain4j/langchain4j https://docs.langchain4j.dev/
  3. Langchain4j “Hello World” public class OpenAiHelloWorld { void main() {

    // OpenAI model ChatLanguageModel model = OpenAiChatModel .withApiKey(”YOUR_OPENAI_API_KEY")); // the first prompt var message = "Hello world!"; System.out.println("\n>>> " + message); var answer = model.generate(message); System.out.println(answer); } }
  4. Ollama Platform to manage and run language models locally (among

    other things) https://github.com/ollama/ollama https://ollama.com/
  5. Ollama Inspect the model registry Download a model Upgrade it

    regularly Manage multiple versions of a given model Create your own models Fine-tune an existing model Run a model locally (CPU and GPU) Serve models exposing a REST API Things that can be done with Ollama