Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaRequestBody.java
Go to the documentation of this file.
1
package
io.github.ollama4j.utils;
2
3
import
java.net.http.HttpRequest.BodyPublisher;
4
import
java.net.http.HttpRequest.BodyPublishers;
5
6
import
com.fasterxml.jackson.annotation.JsonIgnore;
7
import
com.fasterxml.jackson.core.JsonProcessingException;
8
12
public
interface
OllamaRequestBody
{
13
19
@JsonIgnore
20
default
BodyPublisher
getBodyPublisher
(){
21
try
{
22
return
BodyPublishers.ofString(
23
Utils
.
getObjectMapper
().writeValueAsString(
this
));
24
}
catch
(JsonProcessingException e) {
25
throw
new
IllegalArgumentException(
"Request not Body convertible."
,e);
26
}
27
}
28
}
io.github.ollama4j.utils.Utils
Definition
Utils.java:13
io.github.ollama4j.utils.Utils.getObjectMapper
static ObjectMapper getObjectMapper()
Definition
Utils.java:17
io.github.ollama4j.utils.OllamaRequestBody
Definition
OllamaRequestBody.java:12
io.github.ollama4j.utils.OllamaRequestBody.getBodyPublisher
default BodyPublisher getBodyPublisher()
Definition
OllamaRequestBody.java:20
src
main
java
io
github
ollama4j
utils
OllamaRequestBody.java
Generated by
1.12.0