Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaRequestBody.java
Go to the documentation of this file.
1
/*
2
* Ollama4j - Java library for interacting with Ollama server.
3
* Copyright (c) 2025 Amith Koujalgi and contributors.
4
*
5
* Licensed under the MIT License (the "License");
6
* you may not use this file except in compliance with the License.
7
*
8
*/
9
package
io.github.ollama4j.utils;
10
11
import
com.fasterxml.jackson.annotation.JsonIgnore;
12
import
com.fasterxml.jackson.core.JsonProcessingException;
13
import
java.net.http.HttpRequest.BodyPublisher;
14
import
java.net.http.HttpRequest.BodyPublishers;
15
19
public
interface
OllamaRequestBody
{
20
26
@JsonIgnore
27
default
BodyPublisher
getBodyPublisher
() {
28
try
{
29
return
BodyPublishers.ofString(
Utils
.
getObjectMapper
().writeValueAsString(
this
));
30
}
catch
(JsonProcessingException e) {
31
throw
new
IllegalArgumentException(
"Request not Body convertible."
, e);
32
}
33
}
34
}
io.github.ollama4j.utils.Utils
Definition
Utils.java:25
io.github.ollama4j.utils.Utils.getObjectMapper
static ObjectMapper getObjectMapper()
Definition
Utils.java:32
io.github.ollama4j.utils.OllamaRequestBody
Definition
OllamaRequestBody.java:19
io.github.ollama4j.utils.OllamaRequestBody.getBodyPublisher
default BodyPublisher getBodyPublisher()
Definition
OllamaRequestBody.java:27
src
main
java
io
github
ollama4j
utils
OllamaRequestBody.java
Generated by
1.12.0