Basic assistant with LangChain4j and Ollama
This example shows the smallest LangChain4j AI service backed by a local Ollama model.
The Assistant interface carries the system instruction as an annotation, and LangChain4j generates the implementation at runtime.
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
LangChain4j is a Java library that lets you build applications on top of large language models.