Class Run
java.lang.Object
com.jackdaw.chatwithnpc.openaiapi.Run
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classstatic classRepresents the result of a Run request.(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Stringprivate Run.RequiredActionprivate Stringprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcallFunctionsAndReply(ConversationHandler conversation) Call the functions and reply the messageprivate static RuncheckOrTimeOut(@NotNull Run run) private static RunbooleanCheck if the run is completedbooleanCheck if the run requires actionprivate voidreplyMessage(@NotNull ConversationHandler conversation) static @NotNull Run.RunResultrun(@NotNull ConversationHandler conversation) Run the assistant for the NPC from the OpenAI API, and it will return the result.private static Stringprivate @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
-