Interface ResponseCompleteListener

All Superinterfaces:
Serializable
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 ResponseCompleteListener extends Serializable
Listener for LLM response completion events.

The listener is called after each successful exchange — when the assistant's stream has completed without error. This is the recommended hook for persisting conversation state (via AIOrchestrator.getHistory()), triggering follow-up actions, or updating UI elements.

The response text may be empty if the model emitted only tool calls or stopped without producing visible content. Such turns are still successful exchanges; check event.getResponse().isEmpty() if your listener should only react to text-bearing responses. Empty responses are not appended to AIOrchestrator.getHistory().

The listener is not called when:

  • The LLM response fails with an error or times out
  • History is restored via Builder.withHistory()

Threading: This listener is called from a background thread (Reactor scheduler). It is safe to perform blocking I/O (e.g. database writes) directly. To update Vaadin UI components from this listener, use ui.access().