mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 03:47:13 +02:00
Handled ignorable JSON fields of Ollama response
This commit is contained in:
parent
3a45746a63
commit
7c4b17454b
@ -1,5 +1,6 @@
|
||||
package io.github.amithkoujalgi.ollama4j.core;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.amithkoujalgi.ollama4j.core.exceptions.OllamaBaseException;
|
||||
import io.github.amithkoujalgi.ollama4j.core.models.*;
|
||||
@ -33,7 +34,8 @@ public class OllamaAPI {
|
||||
private final String host;
|
||||
private boolean verbose = false;
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private final ObjectMapper objectMapper = new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
/**
|
||||
* Instantiates the Ollama API.
|
||||
@ -240,6 +242,7 @@ public class OllamaAPI {
|
||||
con.setRequestMethod("POST");
|
||||
con.setDoOutput(true);
|
||||
con.setRequestProperty("Content-Type", "application/json");
|
||||
System.out.println(ollamaRequestModel.toString());
|
||||
try (OutputStream out = con.getOutputStream()) {
|
||||
out.write(ollamaRequestModel.toString().getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user