Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaResult.java
Go to the documentation of this file.
1package io.github.ollama4j.models.response;
2
3import static io.github.ollama4j.utils.Utils.getObjectMapper;
4
5import com.fasterxml.jackson.core.JsonProcessingException;
6import lombok.Data;
7import lombok.Getter;
8
10@Getter
11@SuppressWarnings("unused")
12@Data
13public class OllamaResult {
20 private final String response;
21
28 private int httpStatusCode;
29
36 private long responseTime = 0;
37
38 public OllamaResult(String response, long responseTime, int httpStatusCode) {
39 this.response = response;
40 this.responseTime = responseTime;
41 this.httpStatusCode = httpStatusCode;
42 }
43
44 @Override
45 public String toString() {
46 try {
47 return getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
48 } catch (JsonProcessingException e) {
49 throw new RuntimeException(e);
50 }
51 }
52}
OllamaResult(String response, long responseTime, int httpStatusCode)