Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
Model.java
Go to the documentation of this file.
1package io.github.ollama4j.models.response;
2
3import java.time.OffsetDateTime;
4
5import com.fasterxml.jackson.annotation.JsonProperty;
6import com.fasterxml.jackson.core.JsonProcessingException;
7import io.github.ollama4j.utils.Utils;
8import lombok.Data;
9
10@Data
11public class Model {
12
13 private String name;
14 private String model;
15 @JsonProperty("modified_at")
16 private OffsetDateTime modifiedAt;
17 @JsonProperty("expires_at")
18 private OffsetDateTime expiresAt;
19 private String digest;
20 private long size;
21 @JsonProperty("details")
22 private ModelMeta modelMeta;
23
24
30 public String getModelName() {
31 return name.split(":")[0];
32 }
33
39 public String getModelVersion() {
40 return name.split(":")[1];
41 }
42
43 @Override
44 public String toString() {
45 try {
46 return Utils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
47 } catch (JsonProcessingException e) {
48 throw new RuntimeException(e);
49 }
50 }
51
52}
static ObjectMapper getObjectMapper()
Definition Utils.java:17