Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
PromptBuilder.java
Go to the documentation of this file.
1/*
2 * Ollama4j - Java library for interacting with Ollama server.
3 * Copyright (c) 2025 Amith Koujalgi and contributors.
4 *
5 * Licensed under the MIT License (the "License");
6 * you may not use this file except in compliance with the License.
7 *
8*/
9package io.github.ollama4j.utils;
10
27public class PromptBuilder {
28
29 private final StringBuilder prompt;
30
34 public PromptBuilder() {
35 this.prompt = new StringBuilder();
36 }
37
44 public PromptBuilder add(String text) {
45 prompt.append(text);
46 return this;
47 }
48
55 public PromptBuilder addLine(String text) {
56 prompt.append(text).append("\n");
57 return this;
58 }
59
67 prompt.append("\n--------------------------------------------------\n");
68 return this;
69 }
70
76 public String build() {
77 return prompt.toString();
78 }
79}
PromptBuilder addLine(String text)