Class OllamaDecisionModel

java.lang.Object
dev.langchain4j.model.ollama.OllamaDecisionModel
All Implemented Interfaces:
DecisionModel

@Experimental public class OllamaDecisionModel extends Object implements DecisionModel
A DecisionModel backed by the decision models that Ollama runs locally, such as Nimble, Tev1 and Clef, through its System One API (POST /v1/systemone, Ollama v0.35.0 or later).

Download a decision model first, for example with ollama pull nimble, then:

DecisionModel model = OllamaDecisionModel.builder()
        .baseUrl("http://localhost:11434")
        .modelName("nimble")
        .build();
The input can be text, a Map of named values, or a list of TextContents and ImageContents. Images can be judged only by models with vision, such as Clef: they are sent alongside the input, which refers to each of them by its position, for example [image 1]. Images are numbered from 1 in the order they appear in the input, across all values of a Map input.

Images given by an http, https or file URL are downloaded or read by this class, on the calling thread (also for DecisionModel.decideAsync(DecisionRequest)), before the request is sent. Do not pass URLs that come from untrusted sources, such as users or retrieved content: download and check them yourself, and pass the image as base64 data.

Since:
1.23.0