forked from Mirror/ollama4j
Issue #4: evalCount in response from ollama cannot be parsed
- Change `eval_count` identify in Java code to more appropriate `evalCount` - Change `evalCount` to `eval_count` in the JSON mapping - Configure JSON mapping to ignore unknown fields to avoid errors in case ollama expands its response
This commit is contained in:
parent
df9b9af063
commit
e2a8be42e0
@ -1,32 +1,23 @@
|
|||||||
package io.github.amithkoujalgi.ollama4j.core.models;
|
package io.github.amithkoujalgi.ollama4j.core.models;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class OllamaResponseModel {
|
public class OllamaResponseModel {
|
||||||
private String model;
|
private String model;
|
||||||
@JsonProperty("created_at")
|
private @JsonProperty("created_at") String createdAt;
|
||||||
private String createdAt;
|
|
||||||
private String response;
|
private String response;
|
||||||
private Boolean done;
|
private Boolean done;
|
||||||
private List<Integer> context;
|
private List<Integer> context;
|
||||||
@JsonProperty("total_duration")
|
private @JsonProperty("total_duration") Long totalDuration;
|
||||||
private Long totalDuration;
|
private @JsonProperty("load_duration") Long loadDuration;
|
||||||
|
private @JsonProperty("prompt_eval_duration") Long promptEvalDuration;
|
||||||
@JsonProperty("load_duration")
|
private @JsonProperty("eval_duration") Long evalDuration;
|
||||||
private Long loadDuration;
|
private @JsonProperty("prompt_eval_count") Integer promptEvalCount;
|
||||||
@JsonProperty("prompt_eval_duration")
|
private @JsonProperty("eval_count") Integer evalCount;
|
||||||
private Long promptEvalDuration;
|
|
||||||
@JsonProperty("eval_duration")
|
|
||||||
|
|
||||||
private Long evalDuration;
|
|
||||||
@JsonProperty("prompt_eval_count")
|
|
||||||
|
|
||||||
private Integer promptEvalCount;
|
|
||||||
@JsonProperty("evalCount")
|
|
||||||
|
|
||||||
private Integer eval_count;
|
|
||||||
|
|
||||||
public String getModel() {
|
public String getModel() {
|
||||||
return model;
|
return model;
|
||||||
@ -108,11 +99,11 @@ public class OllamaResponseModel {
|
|||||||
this.promptEvalCount = promptEvalCount;
|
this.promptEvalCount = promptEvalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getEval_count() {
|
public Integer getEvalCount() {
|
||||||
return eval_count;
|
return evalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEval_count(Integer eval_count) {
|
public void setEvalCount(Integer eval_count) {
|
||||||
this.eval_count = eval_count;
|
this.evalCount = eval_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user