forked from Mirror/ollama4j
Adds toString implementation for Model and ModelMeta to be json represented
This commit is contained in:
parent
09442d37a3
commit
13b7111a42
@ -1,6 +1,8 @@
|
||||
package io.github.amithkoujalgi.ollama4j.core.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.github.amithkoujalgi.ollama4j.core.utils.Utils;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -34,4 +36,13 @@ public class Model {
|
||||
return name.split(":")[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return Utils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package io.github.amithkoujalgi.ollama4j.core.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.github.amithkoujalgi.ollama4j.core.utils.Utils;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -21,4 +23,13 @@ public class ModelMeta {
|
||||
|
||||
@JsonProperty("quantization_level")
|
||||
private String quantizationLevel;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return Utils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user