Class OllamaAsyncResultCallback
java.lang.Object
java.lang.Thread
io.github.amithkoujalgi.ollama4j.core.models.OllamaAsyncResultCallback
- All Implemented Interfaces:
Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionOllamaAsyncResultCallback
(HttpRequest.Builder requestBuilder, OllamaGenerateRequestModel ollamaRequestModel, long requestTimeoutSeconds) -
Method Summary
Modifier and TypeMethodDescriptionReturns the final completion/response when the execution completes.boolean
Returns the status of the thread.void
run()
void
setRequestTimeoutSeconds
(long requestTimeoutSeconds) Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
OllamaAsyncResultCallback
public OllamaAsyncResultCallback(HttpRequest.Builder requestBuilder, OllamaGenerateRequestModel ollamaRequestModel, long requestTimeoutSeconds)
-
-
Method Details
-
run
public void run() -
isComplete
public boolean isComplete()Returns the status of the thread. This does not indicate that the request was successful or a failure, rather it is just a status flag to indicate if the thread is active or ended.- Returns:
- boolean - status
-
getResponse
Returns the final completion/response when the execution completes. Does not return intermediate results.- Returns:
- String completion/response text
-
getStream
-
setRequestTimeoutSeconds
public void setRequestTimeoutSeconds(long requestTimeoutSeconds)
-