Class OpenAIPrompter
java.lang.Object
ua.mcchickenstudio.opencreative.coding.prompters.OpenAIPrompter
- All Implemented Interfaces:
CodingPrompter,PrompterModelCapable,Manager,ShutDownable,Startable,Toggleable
OpenAIPrompter
This class represents a coding prompter, that uses ChatGPT to generate a code.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull CompletableFuture<String> generateCode(@NotNull String nickname, @NotNull UUID uuid, @NotNull String text, int actionsLimit) Generates a code by player's prompt.@NotNull StringgetModel()@NotNull StringgetName()Returns name of manager, that will be displayed by request in the logs.booleanChecks whether manager was started successfully and it currently works.voidvoidSets the token for coding prompter.voidshutdown()Does tasks on shutdown.voidstart()Does tasks on start.
-
Constructor Details
-
OpenAIPrompter
public OpenAIPrompter()
-
-
Method Details
-
generateCode
@NotNull public @NotNull CompletableFuture<String> generateCode(@NotNull @NotNull String nickname, @NotNull @NotNull UUID uuid, @NotNull @NotNull String text, int actionsLimit) Description copied from interface:CodingPrompterGenerates a code by player's prompt. Returns- Specified by:
generateCodein interfaceCodingPrompter- Parameters:
nickname- name of player.uuid- uuid of player.text- prompt to generate code.actionsLimit- limit of actions per executor.- Returns:
- code script YAML, or reason why code refused to generate.
-
getModel
- Specified by:
getModelin interfacePrompterModelCapable
-
setModel
- Specified by:
setModelin interfacePrompterModelCapable
-
setToken
Description copied from interface:CodingPrompterSets the token for coding prompter.- Specified by:
setTokenin interfaceCodingPrompter- Parameters:
token- new token.
-
start
public void start()Description copied from interface:StartableDoes tasks on start. -
shutdown
public void shutdown()Description copied from interface:ShutDownableDoes tasks on shutdown.- Specified by:
shutdownin interfaceShutDownable
-
isWorking
public boolean isWorking()Description copied from interface:ToggleableChecks whether manager was started successfully and it currently works.- Specified by:
isWorkingin interfaceToggleable- Returns:
- true - started up, false - shut downed.
-
getName
Description copied from interface:ManagerReturns name of manager, that will be displayed by request in the logs.
-