![]() |
Ollama4j
A Java library (wrapper/binding) for Ollama server.
|
Public Member Functions | |
OllamaChatEndpointCaller (String host, Auth auth, long requestTimeoutSeconds) | |
OllamaChatResult | call (OllamaChatRequest body, OllamaChatTokenHandler tokenHandler) throws OllamaException, IOException, InterruptedException |
OllamaChatResult | callSync (OllamaChatRequest body) throws OllamaException, IOException, InterruptedException |
Static Public Attributes | |
static final String | endpoint = "/api/chat" |
Protected Member Functions | |
boolean | parseResponseAndAddToBuffer (String line, StringBuilder responseBuffer, StringBuilder thinkingBuffer) |
![]() | |
OllamaEndpointCaller (String host, Auth auth, long requestTimeoutSeconds) | |
HttpRequest.Builder | getRequestBuilderDefault (URI uri) |
boolean | isAuthCredentialsSet () |
Specialization class for requests
Definition at line 34 of file OllamaChatEndpointCaller.java.
io.github.ollama4j.models.request.OllamaChatEndpointCaller.OllamaChatEndpointCaller | ( | String | host, |
Auth | auth, | ||
long | requestTimeoutSeconds ) |
Definition at line 41 of file OllamaChatEndpointCaller.java.
OllamaChatResult io.github.ollama4j.models.request.OllamaChatEndpointCaller.call | ( | OllamaChatRequest | body, |
OllamaChatTokenHandler | tokenHandler ) throws OllamaException, IOException, InterruptedException |
Definition at line 84 of file OllamaChatEndpointCaller.java.
OllamaChatResult io.github.ollama4j.models.request.OllamaChatEndpointCaller.callSync | ( | OllamaChatRequest | body | ) | throws OllamaException, IOException, InterruptedException |
Definition at line 90 of file OllamaChatEndpointCaller.java.
|
protected |
Parses streamed Response line from ollama chat. Using com.fasterxml.jackson.databind.ObjectMapper#readValue(String, TypeReference)
should throw IllegalArgumentException
in case of null line or com.fasterxml.jackson.core.JsonParseException
in case the JSON Object cannot be parsed to a OllamaChatResponseModel
. Thus, the ResponseModel should never be null.
line | streamed line of ollama stream response |
responseBuffer | Stringbuffer to add latest response message part to |
Reimplemented from io.github.ollama4j.models.request.OllamaEndpointCaller.
Definition at line 57 of file OllamaChatEndpointCaller.java.
|
static |
Definition at line 37 of file OllamaChatEndpointCaller.java.