Class GPTCompletionCallback.GPTCompletionCollector
- java.lang.Object
 - 
- com.composum.ai.backend.base.service.chat.GPTCompletionCallback.GPTCompletionCollector
 
 
- 
- All Implemented Interfaces:
 GPTCompletionCallback
- Enclosing interface:
 - GPTCompletionCallback
 
public static class GPTCompletionCallback.GPTCompletionCollector extends Object implements GPTCompletionCallback
A simple collector that just takes note of things. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface com.composum.ai.backend.base.service.chat.GPTCompletionCallback
GPTCompletionCallback.GPTCompletionCallbackWrapper, GPTCompletionCallback.GPTCompletionCollector, GPTCompletionCallback.GPTToolExecutionContext 
 - 
 
- 
Constructor Summary
Constructors Constructor Description GPTCompletionCollector() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowablegetError()GPTFinishReasongetFinishReason()StringgetResult()List<GPTToolCall>getToolCalls()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.voidtoolDelta(List<GPTToolCall> toolCalls)Called when a tool call is made.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.composum.ai.backend.base.service.chat.GPTCompletionCallback
close, setRequest 
 - 
 
 - 
 
- 
- 
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
 
- 
getFinishReason
public GPTFinishReason getFinishReason()
 
- 
getResult
public String getResult()
 
- 
getError
public Throwable getError()
 
- 
toolDelta
public void toolDelta(List<GPTToolCall> toolCalls)
Description copied from interface:GPTCompletionCallbackCalled when a tool call is made.- Specified by:
 toolDeltain interfaceGPTCompletionCallback
 
- 
getToolCalls
public List<GPTToolCall> getToolCalls()
 
- 
getToolExecutionContext
public GPTCompletionCallback.GPTToolExecutionContext getToolExecutionContext()
Description copied from interface:GPTCompletionCallbackFor tool calls: set the context to execute actions in.- Specified by:
 getToolExecutionContextin interfaceGPTCompletionCallback
 
 - 
 
 -