Interface GPTCompletionCallback
-
- All Known Implementing Classes:
GPTCompletionCallback.GPTCompletionCollector
public interface GPTCompletionCallback
For a streaming mode this is given as parameter for the method call and receives the streamed data; the method returns only when the response is complete.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
GPTCompletionCallback.GPTCompletionCollector
A simple collector that just takes note of things.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
onError(Throwable throwable)
Called when an error occurs.void
onFinish(GPTFinishReason finishReason)
This is called when the response is complete to specify the reason (e.g.void
onNext(String chars)
Called when a couple of characters come in.void
setLoggingId(String loggingId)
For debugging: this sets the internal ID that is used for logging purposes.default void
setRequest(String json)
For debugging - the request that was sent to ChatGPT as JSON.
-
-
-
Method Detail
-
onFinish
void onFinish(GPTFinishReason finishReason)
This is called when the response is complete to specify the reason (e.g.GPTFinishReason.STOP
when done orGPTFinishReason.LENGTH
if the maximum length has been reached).
-
onNext
void onNext(String chars)
Called when a couple of characters come in.
-
onError
void onError(Throwable throwable)
Called when an error occurs.
-
setLoggingId
void setLoggingId(String loggingId)
For debugging: this sets the internal ID that is used for logging purposes. Not a good ID give to the world, though.
-
setRequest
default void setRequest(String json)
For debugging - the request that was sent to ChatGPT as JSON.
-
-