java.lang.Object
com.jackdaw.chatwithnpc.openaiapi.Run

public class Run extends Object
  • Field Details

  • Constructor Details

    • Run

      public Run()
  • Method Details

    • run

      @NotNull public static @NotNull Run.RunResult run(@NotNull @NotNull ConversationHandler conversation) throws Exception
      Run the assistant for the NPC from the OpenAI API, and it will return the result.
      Parameters:
      conversation - The conversation handler
      Returns:
      The result of the run
      Throws:
      Exception - If the run status is null
    • checkOrTimeOut

      private static Run checkOrTimeOut(@NotNull @NotNull Run run) throws Exception
      Throws:
      Exception
    • toJson

      private static String toJson(Map map)
    • fromJson

      private static Run fromJson(String json)
    • isCompleted

      public boolean isCompleted()
      Check if the run is completed
      Returns:
      True if the run is completed
    • isRequiresAction

      public boolean isRequiresAction()
      Check if the run requires action
      Returns:
      True if the run requires action
    • updateStatus

      @NotNull private @NotNull String updateStatus() throws Exception
      Throws:
      Exception
    • callFunctionsAndReply

      public void callFunctionsAndReply(ConversationHandler conversation)
      Call the functions and reply the message
      Parameters:
      conversation - The conversation handler
    • replyMessage

      private void replyMessage(@NotNull @NotNull ConversationHandler conversation) throws Exception
      Throws:
      Exception