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,
16
List<OllamaChatMessage> chatHistory) {
17
super(response, responseTime, httpStatusCode);
18
this.chatHistory = chatHistory;
19
appendAnswerToChatHistory(response);
20
}
21
22
public
List<OllamaChatMessage>
getChatHistory
() {
23
return
chatHistory;
24
}
25
26
private
void
appendAnswerToChatHistory(String answer){
27
OllamaChatMessage
assistantMessage =
new
OllamaChatMessage
(
OllamaChatMessageRole
.
ASSISTANT
, answer);
28
this.chatHistory.add(assistantMessage);
29
}
30
31
32
}
io.github.ollama4j.models.chat.OllamaChatMessage
Definition
OllamaChatMessage.java:26
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:22
io.github.ollama4j.models.response.OllamaResult
Definition
OllamaResult.java:13
io.github.ollama4j.models.chat.OllamaChatMessageRole
Definition
OllamaChatMessageRole.java:8
io.github.ollama4j.models.chat.OllamaChatMessageRole.ASSISTANT
ASSISTANT
Definition
OllamaChatMessageRole.java:11
src
main
java
io
github
ollama4j
models
chat
OllamaChatResult.java
Generated by
1.12.0