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.JsonIgnoreProperties;
6import com.fasterxml.jackson.annotation.JsonProperty;
7import com.fasterxml.jackson.core.JsonProcessingException;
8import io.github.ollama4j.utils.Utils;
9import lombok.Data;
10
11@Data
12@JsonIgnoreProperties(ignoreUnknown = true)
13public class Model {
14
15 private String name;
16 private String model;
17 @JsonProperty("modified_at")
18 private OffsetDateTime modifiedAt;
19 @JsonProperty("expires_at")
20 private OffsetDateTime expiresAt;
21 private String digest;
22 private long size;
23 @JsonProperty("details")
24 private ModelMeta modelMeta;
25
26
32 public String getModelName() {
33 return name.split(":")[0];
34 }
35
41 public String getModelVersion() {
42 return name.split(":")[1];
43 }
44
45 @Override
46 public String toString() {
47 try {
48 return Utils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
49 } catch (JsonProcessingException e) {
50 throw new RuntimeException(e);
51 }
52 }
53
54}
static ObjectMapper getObjectMapper()
Definition Utils.java:17