9package io.github.ollama4j.models.generate;
11import io.github.ollama4j.models.request.OllamaCommonRequest;
12import io.github.ollama4j.models.request.ThinkMode;
13import io.github.ollama4j.models.request.ThinkModeSerializer;
14import io.github.ollama4j.tools.Tools;
15import io.github.ollama4j.utils.OllamaRequestBody;
16import io.github.ollama4j.utils.Options;
18import java.io.IOException;
19import java.nio.file.Files;
20import java.util.ArrayList;
21import java.util.Base64;
31 private String prompt;
32 private List<String> images;
33 private String system;
34 private String context;
40 private boolean useTools;
63 this.setPrompt(prompt);
78 this.setFormat(
"json");
83 this.setOptions(
options.getOptionsMap());
93 this.setStream(streaming);
108 this.setThink(think);
113 this.setUseTools(useTools);
123 this.setSystem(system);
128 this.setContext(context);
133 this.setImages(images);
138 List<String> images =
new ArrayList<>();
139 for (File imageFile : imageFiles) {
140 images.add(Base64.getEncoder().encodeToString(Files.readAllBytes(imageFile.toPath())));
142 this.setImages(images);
155 return this.
toString().equals(o.toString());
OllamaGenerateRequest withTemplate(String template)
OllamaGenerateRequest withImages(List< File > imageFiles)
OllamaGenerateRequest build()
OllamaGenerateRequest withTools(List< Tools.Tool > tools)
OllamaGenerateRequest withOptions(Options options)
OllamaGenerateRequest withGetJsonResponse()
OllamaGenerateRequest withContext(String context)
OllamaGenerateRequest(String model, String prompt, List< String > images)
OllamaGenerateRequest withThink(ThinkMode think)
OllamaGenerateRequest withFormat(Map< String, Object > format)
OllamaGenerateRequest withSystem(String system)
OllamaGenerateRequest withPrompt(String prompt)
OllamaGenerateRequest withKeepAlive(String keepAlive)
OllamaGenerateRequest withRaw(boolean raw)
OllamaGenerateRequest withImagesBase64(List< String > images)
OllamaGenerateRequest withModel(String model)
OllamaGenerateRequest withUseTools(boolean useTools)
static OllamaGenerateRequest builder()
OllamaGenerateRequest(String model, String prompt)
OllamaGenerateRequest withStreaming(boolean streaming)
Map< String, Object > options