Structured output with LangChain4j and Ollama
This example shows LangChain4j returning a typed Java record from a local Ollama model.
The record declares the expected shape, LangChain4j derives a JSON schema from it, and the response arrives as a validated object.
Requirements
Steps for running this example in the shell
- Start Ollama and pull the model:
bash
ollama serve
ollama pull llama3.2:1b- Run the application:
bash
mvn compile exec:javaOutput
ReleaseSummary[title=Release Readiness Check, priority=High, nextStep=Fix flaky integration tests]