Class OllamaEndpointCaller
java.lang.Object
io.github.amithkoujalgi.ollama4j.core.models.request.OllamaEndpointCaller
- Direct Known Subclasses:
OllamaChatEndpointCaller
,OllamaGenerateEndpointCaller
Abstract helperclass to call the ollama api server.
-
Constructor Summary
ConstructorsConstructorDescriptionOllamaEndpointCaller
(String host, BasicAuth basicAuth, long requestTimeoutSeconds, boolean verbose) -
Method Summary
Modifier and TypeMethodDescriptioncallSync
(OllamaRequestBody body) Calls the api server on the given host and endpoint suffix asynchronously, aka waiting for the response.protected abstract String
protected abstract boolean
parseResponseAndAddToBuffer
(String line, StringBuilder responseBuffer)
-
Constructor Details
-
OllamaEndpointCaller
-
-
Method Details
-
getEndpointSuffix
-
parseResponseAndAddToBuffer
-
callSync
public OllamaResult callSync(OllamaRequestBody body) throws OllamaBaseException, IOException, InterruptedException Calls the api server on the given host and endpoint suffix asynchronously, aka waiting for the response.- Parameters:
body
- POST body payload- Returns:
- result answer given by the assistant
- Throws:
OllamaBaseException
- any response code than 200 has been returnedIOException
- in case the responseStream can not be readInterruptedException
- in case the server is not reachable or network issues happen
-