1package io.github.ollama4j.models.request;
4import java.net.http.HttpRequest;
5import java.time.Duration;
7import org.slf4j.Logger;
8import org.slf4j.LoggerFactory;
10import io.github.ollama4j.OllamaAPI;
19 private static final Logger LOG = LoggerFactory.getLogger(
OllamaAPI.class);
21 private final String host;
22 private final Auth auth;
23 private final long requestTimeoutSeconds;
24 private final boolean verbose;
29 this.requestTimeoutSeconds = requestTimeoutSeconds;
30 this.verbose = verbose;
45 HttpRequest.Builder requestBuilder =
46 HttpRequest.newBuilder(uri)
47 .header(
"Content-Type",
"application/json")
48 .timeout(Duration.ofSeconds(
this.requestTimeoutSeconds));
52 return requestBuilder;
61 return this.auth !=
null;
abstract String getAuthHeaderValue()
abstract String getEndpointSuffix()
HttpRequest.Builder getRequestBuilderDefault(URI uri)
boolean isAuthCredentialsSet()
abstract boolean parseResponseAndAddToBuffer(String line, StringBuilder responseBuffer)
OllamaEndpointCaller(String host, Auth auth, long requestTimeoutSeconds, boolean verbose)