StreamingCallback

  • StreamingCallback is a callback function designed to receive streaming results.

  • The interface includes an abstract method onNewText which is called when new text becomes available during streaming.

  • The onNewText method takes a String parameter named additionalText which represents the newly available text.

public interface StreamingCallback

Callback function to receive a streaming result.

Public Method Summary

void
onNewFunctionCall(FunctionCall functionCall)
Called when a new function call is available mid-stream.
abstract void
onNewText(String additionalText)
Called when a new text is available.
void
onNewThought(String additionalThought)
Called when a new thought is available.

Public Methods

public void onNewFunctionCall (FunctionCall functionCall)

Called when a new function call is available mid-stream.

When streaming is enabled with tools declared, complete predicted function calls are also conveyed in the terminal chunk upon turn completion. This callback allows receiving and executing tools incrementally as they are predicted.

Parameters
functionCall the predicted function call.

public abstract void onNewText (String additionalText)

Called when a new text is available.

Parameters
additionalText the new text.

public void onNewThought (String additionalThought)

Called when a new thought is available.

Parameters
additionalThought the new thought text.