mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 20:07:10 +02:00
Merge pull request #5 from reckart/bugfix/4-evalCount-in-response-from-ollama-cannot-be-parsed
Issue #4: evalCount in response from ollama cannot be parsed.
Thanks @reckart! I had actually made some updates for the `OllamaResponseModel` class to ignore the unknown fields but somehow had missed the `eval_count`.
About your third point,
> Configure JSON mapping to ignore unknown fields to avoid errors in case ollama expands its response
I believe this would take care of unknown fields and we do not have to explicitly mark the fields to be ignored: df9b9af063/src/main/java/io/github/amithkoujalgi/ollama4j/core/OllamaAPI.java (L40-L41)
This commit is contained in:
commit
0d6af4b4a5
@ -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