Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
io.github.ollama4j.models.request.OllamaChatEndpointCaller Class Reference
Inheritance diagram for io.github.ollama4j.models.request.OllamaChatEndpointCaller:
io.github.ollama4j.models.request.OllamaEndpointCaller

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)
 
- Protected Member Functions inherited from io.github.ollama4j.models.request.OllamaEndpointCaller
 OllamaEndpointCaller (String host, Auth auth, long requestTimeoutSeconds)
 
HttpRequest.Builder getRequestBuilderDefault (URI uri)
 
boolean isAuthCredentialsSet ()
 

Detailed Description

Specialization class for requests

Definition at line 34 of file OllamaChatEndpointCaller.java.

Constructor & Destructor Documentation

◆ OllamaChatEndpointCaller()

io.github.ollama4j.models.request.OllamaChatEndpointCaller.OllamaChatEndpointCaller ( String host,
Auth auth,
long requestTimeoutSeconds )

Definition at line 41 of file OllamaChatEndpointCaller.java.

Member Function Documentation

◆ call()

OllamaChatResult io.github.ollama4j.models.request.OllamaChatEndpointCaller.call ( OllamaChatRequest body,
OllamaChatTokenHandler tokenHandler ) throws OllamaException, IOException, InterruptedException

Definition at line 84 of file OllamaChatEndpointCaller.java.

◆ callSync()

OllamaChatResult io.github.ollama4j.models.request.OllamaChatEndpointCaller.callSync ( OllamaChatRequest body) throws OllamaException, IOException, InterruptedException

Definition at line 90 of file OllamaChatEndpointCaller.java.

◆ parseResponseAndAddToBuffer()

boolean io.github.ollama4j.models.request.OllamaChatEndpointCaller.parseResponseAndAddToBuffer ( String line,
StringBuilder responseBuffer,
StringBuilder thinkingBuffer )
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.

Parameters
linestreamed line of ollama stream response
responseBufferStringbuffer to add latest response message part to
Returns
TRUE, if ollama-Response has 'done' state

Reimplemented from io.github.ollama4j.models.request.OllamaEndpointCaller.

Definition at line 57 of file OllamaChatEndpointCaller.java.

Member Data Documentation

◆ endpoint

final String io.github.ollama4j.models.request.OllamaChatEndpointCaller.endpoint = "/api/chat"
static

Definition at line 37 of file OllamaChatEndpointCaller.java.


The documentation for this class was generated from the following file: