Class OpenAiUtil


  • public class OpenAiUtil
    extends java.lang.Object
    Class with utilities related to uses of OpenAi.
    Since:
    17.0.0
    Version:
    $Revision$ $Date$
    • Constructor Summary

      Constructors 
      Constructor Description
      OpenAiUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static io.reactivex.Flowable<com.theokanning.openai.service.ChatMessageAccumulator> createChatCompletionStreamToAccumulator​(com.theokanning.openai.completion.chat.ChatCompletionRequest chatCompletionRequest)
      Calls OpenAiApi.createChatCompletionStream(ChatCompletionRequest) and maps the stream to a Flowable of ChatMessageAccumulator.
      static com.theokanning.openai.client.OpenAiApi getOpenAiApi()
      Returns the Open AI API.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenAiUtil

        public OpenAiUtil()
    • Method Detail

      • getOpenAiApi

        public static com.theokanning.openai.client.OpenAiApi getOpenAiApi()
        Returns the Open AI API.
        Returns:
        the Open AI API.
        Throws:
        java.lang.IllegalStateException - if the OpenAiApi is not available to use.
        Since:
        17.0.0
      • createChatCompletionStreamToAccumulator

        public static io.reactivex.Flowable<com.theokanning.openai.service.ChatMessageAccumulator> createChatCompletionStreamToAccumulator​(com.theokanning.openai.completion.chat.ChatCompletionRequest chatCompletionRequest)
        Calls OpenAiApi.createChatCompletionStream(ChatCompletionRequest) and maps the stream to a Flowable of ChatMessageAccumulator.
        Parameters:
        chatCompletionRequest - the chat completion request.
        Returns:
        the flowable of chat message accumulator.
        Since:
        17.0.0