forked from Mirror/ollama4j
parent
9c6a55f7b0
commit
f8ca4d041d
@ -1,6 +1,7 @@
|
|||||||
package io.github.amithkoujalgi.ollama4j.core.models;
|
package io.github.amithkoujalgi.ollama4j.core.models;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
@ -13,9 +14,9 @@ public class Model {
|
|||||||
private String name;
|
private String name;
|
||||||
private String model;
|
private String model;
|
||||||
@JsonProperty("modified_at")
|
@JsonProperty("modified_at")
|
||||||
private LocalDateTime modifiedAt;
|
private OffsetDateTime modifiedAt;
|
||||||
@JsonProperty("expires_at")
|
@JsonProperty("expires_at")
|
||||||
private LocalDateTime expiresAt;
|
private OffsetDateTime expiresAt;
|
||||||
private String digest;
|
private String digest;
|
||||||
private long size;
|
private long size;
|
||||||
@JsonProperty("details")
|
@JsonProperty("details")
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package io.github.amithkoujalgi.ollama4j.unittests.jackson;
|
||||||
|
|
||||||
|
import io.github.amithkoujalgi.ollama4j.core.models.Model;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class TestModelRequestSerialization extends AbstractSerializationTest<Model> {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeserializationOfModelResponseWithOffsetTime(){
|
||||||
|
String serializedTestStringWithOffsetTime = "{\n"
|
||||||
|
+ "\"name\": \"codellama:13b\",\n"
|
||||||
|
+ "\"modified_at\": \"2023-11-04T14:56:49.277302595-07:00\",\n"
|
||||||
|
+ "\"size\": 7365960935,\n"
|
||||||
|
+ "\"digest\": \"9f438cb9cd581fc025612d27f7c1a6669ff83a8bb0ed86c94fcf4c5440555697\",\n"
|
||||||
|
+ "\"details\": {\n"
|
||||||
|
+ "\"format\": \"gguf\",\n"
|
||||||
|
+ "\"family\": \"llama\",\n"
|
||||||
|
+ "\"families\": null,\n"
|
||||||
|
+ "\"parameter_size\": \"13B\",\n"
|
||||||
|
+ "\"quantization_level\": \"Q4_0\"\n"
|
||||||
|
+ "}}";
|
||||||
|
deserialize(serializedTestStringWithOffsetTime,Model.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeserializationOfModelResponseWithZuluTime(){
|
||||||
|
String serializedTestStringWithZuluTimezone = "{\n"
|
||||||
|
+ "\"name\": \"codellama:13b\",\n"
|
||||||
|
+ "\"modified_at\": \"2023-11-04T14:56:49.277302595Z\",\n"
|
||||||
|
+ "\"size\": 7365960935,\n"
|
||||||
|
+ "\"digest\": \"9f438cb9cd581fc025612d27f7c1a6669ff83a8bb0ed86c94fcf4c5440555697\",\n"
|
||||||
|
+ "\"details\": {\n"
|
||||||
|
+ "\"format\": \"gguf\",\n"
|
||||||
|
+ "\"family\": \"llama\",\n"
|
||||||
|
+ "\"families\": null,\n"
|
||||||
|
+ "\"parameter_size\": \"13B\",\n"
|
||||||
|
+ "\"quantization_level\": \"Q4_0\"\n"
|
||||||
|
+ "}}";
|
||||||
|
deserialize(serializedTestStringWithZuluTimezone,Model.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user