Skip to main content

Table of Contents

Module spoon_ai.callbacks.streaming_stdout

StreamingStdOutCallbackHandler Objects​

class StreamingStdOutCallbackHandler(BaseCallbackHandler)

Callback handler that streams tokens to standard output.

on_llm_new_token​

def on_llm_new_token(token: str, **kwargs: Any) -> None

Print token to stdout immediately.

Arguments:

  • token - The new token to print
  • **kwargs - Additional context (ignored)

on_llm_end​

def on_llm_end(response: Any, **kwargs: Any) -> None

Print newline after LLM completes.

Arguments:

  • response - The complete LLM response (ignored)
  • **kwargs - Additional context (ignored)