Interface ChatProvider

All Known Implementing Classes:
LangChain4jChatProvider, NoOpChatProvider
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 ChatProvider
Abstraction for calling an LLM and receiving streaming chunks via callbacks.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Receives streaming chunks from an LLM response.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sends the conversation history to the LLM and streams the response back via the listener.
  • Method Details

    • stream

      void stream(List<UIMessage> messages, ChatProvider.Listener listener)
      Sends the conversation history to the LLM and streams the response back via the listener.

      Implementations must call ChatProvider.Listener.onFinish(com.axelor.ai.chat.ChatResult) exactly once, after all content callbacks. This method blocks until the LLM response is fully consumed.

      Parameters:
      messages - the conversation history to send
      listener - receives streaming deltas and the finish signal