Interface ChatStreamer

All Known Implementing Classes:
ChatStreamerImpl
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ChatStreamer
Main orchestrator entry point. Implementations wire together ChatProvider + ToolExecutor + PartTracker + StreamWriter to run the multi-step loop.
  • Method Summary

    Modifier and Type
    Method
    Description
    stream(ChatRequest request, StreamWriter writer)
    Starts an asynchronous streaming chat loop.
  • Method Details

    • stream

      ChatHandle stream(ChatRequest request, StreamWriter writer)
      Starts an asynchronous streaming chat loop.

      The implementation calls the LLM, relays streaming deltas as StreamEvents to the writer, and when the LLM requests tool calls, executes them and feeds results back for subsequent iterations.

      Parameters:
      request - the chat request containing message history and options
      writer - the SSE stream writer for the HTTP response
      Returns:
      a handle to cancel the loop or await its completion