Class GPTCompletionCallback.GPTCompletionCallbackWrapper
- java.lang.Object
-
- com.composum.ai.backend.base.service.chat.GPTCompletionCallback.GPTCompletionCallbackWrapper
-
- All Implemented Interfaces:
GPTCompletionCallback
- Enclosing interface:
- GPTCompletionCallback
public static class GPTCompletionCallback.GPTCompletionCallbackWrapper extends Object implements GPTCompletionCallback
Forwards all methods to a delegate.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.composum.ai.backend.base.service.chat.GPTCompletionCallback
GPTCompletionCallback.GPTCompletionCallbackWrapper, GPTCompletionCallback.GPTCompletionCollector, GPTCompletionCallback.GPTToolExecutionContext
-
-
Field Summary
Fields Modifier and Type Field Description protected GPTCompletionCallback
delegate
-
Constructor Summary
Constructors Constructor Description GPTCompletionCallbackWrapper(GPTCompletionCallback delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Notifies that the request is completely finished / closed, nothing more will arrive.GPTCompletionCallback.GPTToolExecutionContext
getToolExecutionContext()
For tool calls: set the context to execute actions in.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.void
setRequest(String json)
For debugging - the request that was sent to ChatGPT as JSON.void
toolDelta(List<GPTToolCall> toolCalls)
Called when a tool call is made.
-
-
-
Field Detail
-
delegate
@Nonnull protected GPTCompletionCallback delegate
-
-
Constructor Detail
-
GPTCompletionCallbackWrapper
public GPTCompletionCallbackWrapper(@Nonnull GPTCompletionCallback delegate)
-
-
Method Detail
-
onFinish
public void onFinish(GPTFinishReason finishReason)
Description copied from interface:GPTCompletionCallback
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).- Specified by:
onFinish
in interfaceGPTCompletionCallback
-
onNext
public void onNext(String chars)
Description copied from interface:GPTCompletionCallback
Called when a couple of characters come in.- Specified by:
onNext
in interfaceGPTCompletionCallback
-
onError
public void onError(Throwable throwable)
Description copied from interface:GPTCompletionCallback
Called when an error occurs.- Specified by:
onError
in interfaceGPTCompletionCallback
-
setLoggingId
public void setLoggingId(String loggingId)
Description copied from interface:GPTCompletionCallback
For debugging: this sets the internal ID that is used for logging purposes. Not a good ID give to the world, though.- Specified by:
setLoggingId
in interfaceGPTCompletionCallback
-
setRequest
public void setRequest(String json)
Description copied from interface:GPTCompletionCallback
For debugging - the request that was sent to ChatGPT as JSON.- Specified by:
setRequest
in interfaceGPTCompletionCallback
-
close
public void close()
Description copied from interface:GPTCompletionCallback
Notifies that the request is completely finished / closed, nothing more will arrive.- Specified by:
close
in interfaceGPTCompletionCallback
-
toolDelta
public void toolDelta(List<GPTToolCall> toolCalls)
Description copied from interface:GPTCompletionCallback
Called when a tool call is made.- Specified by:
toolDelta
in interfaceGPTCompletionCallback
-
getToolExecutionContext
public GPTCompletionCallback.GPTToolExecutionContext getToolExecutionContext()
Description copied from interface:GPTCompletionCallback
For tool calls: set the context to execute actions in.- Specified by:
getToolExecutionContext
in interfaceGPTCompletionCallback
-
-