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, BasicAuth basicAuth, long requestTimeoutSeconds, boolean verbose)
 
OllamaChatResult call (OllamaChatRequest body, OllamaTokenHandler tokenHandler) throws OllamaBaseException, IOException, InterruptedException
 
OllamaChatResult callSync (OllamaChatRequest body) throws OllamaBaseException, IOException, InterruptedException
 
- Public Member Functions inherited from io.github.ollama4j.models.request.OllamaEndpointCaller
 OllamaEndpointCaller (String host, BasicAuth basicAuth, long requestTimeoutSeconds, boolean verbose)
 

Protected Member Functions

String getEndpointSuffix ()
 
boolean parseResponseAndAddToBuffer (String line, StringBuilder responseBuffer)
 
- Protected Member Functions inherited from io.github.ollama4j.models.request.OllamaEndpointCaller
HttpRequest.Builder getRequestBuilderDefault (URI uri)
 
String getBasicAuthHeaderValue ()
 
boolean isBasicAuthCredentialsSet ()
 

Detailed Description

Specialization class for requests

Definition at line 27 of file OllamaChatEndpointCaller.java.

Constructor & Destructor Documentation

◆ OllamaChatEndpointCaller()

io.github.ollama4j.models.request.OllamaChatEndpointCaller.OllamaChatEndpointCaller ( String host,
BasicAuth basicAuth,
long requestTimeoutSeconds,
boolean verbose )

Definition at line 33 of file OllamaChatEndpointCaller.java.

Member Function Documentation

◆ call()

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

Definition at line 73 of file OllamaChatEndpointCaller.java.

◆ callSync()

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

Definition at line 79 of file OllamaChatEndpointCaller.java.

◆ getEndpointSuffix()

String io.github.ollama4j.models.request.OllamaChatEndpointCaller.getEndpointSuffix ( )
protected

◆ parseResponseAndAddToBuffer()

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


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