Class AsyncRawPromise


  • public class AsyncRawPromise
    extends ChatConfigurationStage
    Promise abstraction. Accepts callbacks which will be called when response is received.
    • Method Detail

      • then

        public void then​(Consumer<String> onEachLine,
                         Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse)
        Subscribe both to each line (whether streamed or from the whole response) and to the whole response when all lines are supplied.
        Parameters:
        onEachLine - callback that accepts each response line as a string
        onResponse - callback that accepts the ChatMessageResponse
      • onEachLine

        public void onEachLine​(Consumer<String> onEachLine)
        Subscribe to each line (whether streamed or from the whole response)
        Parameters:
        onEachLine - callback that accepts each response line as a string
      • then

        public void then​(Consumer<bg.codexio.ai.openai.api.payload.chat.response.ChatMessageResponse> onResponse)
        Subscribe to the whole response when all lines are supplied.
        Parameters:
        onResponse - callback that accepts the ChatMessageResponse