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 GPTCompletionCallbackdelegate 
- 
Constructor Summary
Constructors Constructor Description GPTCompletionCallbackWrapper(GPTCompletionCallback delegate) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Notifies that the request is completely finished / closed, nothing more will arrive.GPTCompletionCallback.GPTToolExecutionContextgetToolExecutionContext()For tool calls: set the context to execute actions in.voidonError(Throwable throwable)Called when an error occurs.voidonFinish(GPTFinishReason finishReason)This is called when the response is complete to specify the reason (e.g.voidonNext(String chars)Called when a couple of characters come in.voidsetLoggingId(String loggingId)For debugging: this sets the internal ID that is used for logging purposes.voidsetRequest(String json)For debugging - the request that was sent to ChatGPT as JSON.voidtoolDelta(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:GPTCompletionCallbackThis is called when the response is complete to specify the reason (e.g.GPTFinishReason.STOPwhen done orGPTFinishReason.LENGTHif the maximum length has been reached).- Specified by:
 onFinishin interfaceGPTCompletionCallback
 
- 
onNext
public void onNext(String chars)
Description copied from interface:GPTCompletionCallbackCalled when a couple of characters come in.- Specified by:
 onNextin interfaceGPTCompletionCallback
 
- 
onError
public void onError(Throwable throwable)
Description copied from interface:GPTCompletionCallbackCalled when an error occurs.- Specified by:
 onErrorin interfaceGPTCompletionCallback
 
- 
setLoggingId
public void setLoggingId(String loggingId)
Description copied from interface:GPTCompletionCallbackFor debugging: this sets the internal ID that is used for logging purposes. Not a good ID give to the world, though.- Specified by:
 setLoggingIdin interfaceGPTCompletionCallback
 
- 
setRequest
public void setRequest(String json)
Description copied from interface:GPTCompletionCallbackFor debugging - the request that was sent to ChatGPT as JSON.- Specified by:
 setRequestin interfaceGPTCompletionCallback
 
- 
close
public void close()
Description copied from interface:GPTCompletionCallbackNotifies that the request is completely finished / closed, nothing more will arrive.- Specified by:
 closein interfaceGPTCompletionCallback
 
- 
toolDelta
public void toolDelta(List<GPTToolCall> toolCalls)
Description copied from interface:GPTCompletionCallbackCalled when a tool call is made.- Specified by:
 toolDeltain interfaceGPTCompletionCallback
 
- 
getToolExecutionContext
public GPTCompletionCallback.GPTToolExecutionContext getToolExecutionContext()
Description copied from interface:GPTCompletionCallbackFor tool calls: set the context to execute actions in.- Specified by:
 getToolExecutionContextin interfaceGPTCompletionCallback
 
 - 
 
 -