Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaChatResult.java
Go to the documentation of this file.
1
package
io.github.ollama4j.models.chat;
2
3
import
java.util.List;
4
5
import
io.github.ollama4j.models.response.OllamaResult;
6
11
public
class
OllamaChatResult
extends
OllamaResult
{
12
13
private
List<OllamaChatMessage> chatHistory;
14
15
public
OllamaChatResult
(String response,
long
responseTime,
int
httpStatusCode, List<OllamaChatMessage> chatHistory) {
16
super(response, responseTime, httpStatusCode);
17
this.chatHistory = chatHistory;
18
appendAnswerToChatHistory(response);
19
}
20
21
public
List<OllamaChatMessage>
getChatHistory
() {
22
return
chatHistory;
23
}
24
25
private
void
appendAnswerToChatHistory(String answer) {
26
OllamaChatMessage
assistantMessage =
new
OllamaChatMessage
(
OllamaChatMessageRole
.
ASSISTANT
, answer);
27
this.chatHistory.add(assistantMessage);
28
}
29
}
io.github.ollama4j.models.chat.OllamaChatMessageRole
Definition
OllamaChatMessageRole.java:14
io.github.ollama4j.models.chat.OllamaChatMessageRole.ASSISTANT
static final OllamaChatMessageRole ASSISTANT
Definition
OllamaChatMessageRole.java:19
io.github.ollama4j.models.chat.OllamaChatMessage
Definition
OllamaChatMessage.java:27
io.github.ollama4j.models.chat.OllamaChatResult
Definition
OllamaChatResult.java:11
io.github.ollama4j.models.chat.OllamaChatResult.OllamaChatResult
OllamaChatResult(String response, long responseTime, int httpStatusCode, List< OllamaChatMessage > chatHistory)
Definition
OllamaChatResult.java:15
io.github.ollama4j.models.chat.OllamaChatResult.getChatHistory
List< OllamaChatMessage > getChatHistory()
Definition
OllamaChatResult.java:21
io.github.ollama4j.models.response.OllamaResult
Definition
OllamaResult.java:13
src
main
java
io
github
ollama4j
models
chat
OllamaChatResult.java
Generated by
1.12.0