Class Run
java.lang.Object
com.jackdaw.chatwithnpc.openaiapi.Run
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
static class
Represents the result of a Run request.(package private) static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private Run.RequiredAction
private String
private String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
callFunctionsAndReply
(ConversationHandler conversation) Call the functions and reply the messageprivate static Run
checkOrTimeOut
(@NotNull Run run) private static Run
boolean
Check if the run is completedboolean
Check if the run requires actionprivate void
replyMessage
(@NotNull ConversationHandler conversation) static @NotNull Run.RunResult
run
(@NotNull ConversationHandler conversation) Run the assistant for the NPC from the OpenAI API, and it will return the result.private static String
private @NotNull String
-
Field Details
-
id
-
thread_id
-
assistant_id
-
status
-
required_action
-
-
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
- Throws:
Exception
-
toJson
-
fromJson
-
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
- Throws:
Exception
-
callFunctionsAndReply
Call the functions and reply the message- Parameters:
conversation
- The conversation handler
-
replyMessage
- Throws:
Exception
-