OpenAI ====== Access OpenAI's ChatGPT services for text and image generation! Note that you must be logged in to use this service, and you must provide this service with a valid OpenAI API key to use (for your account only!). Do not share your OpenAI API key with anyone else! .. toctree:: :maxdepth: 2 :titlesonly: :caption: RPC Categories RPCS ---- .. function:: OpenAI.generateImage(prompt: String, size: Resolution?) Generates an image given a prompt. **Arguments:** - ``prompt: String`` (`String `__) - The prompt to provide to ChatGPT for completion. - ``size: Resolution?`` (`Resolution `__) - The resolution of the generated image. Note that larger images are more expensive to generate. **Returns:** ``Image`` (`Image `__) - The generated image .. function:: OpenAI.generateText(prompt: AnyOf, List>>) Generate text given a prompt. The prompt can take any of the following forms: - A single piece of text. - A list of multiple pieces of text representing a back-and-forth dialog. - A list of pairs representing a dialog. The second value of each pair is the dialog spoken, and the first value is the role of the speaker ("system", "user", or "assistant"). User represents the human using the tool, assistant represents ChatGPT itself, and System is a special role you can use to give instructions for ChatGPT to follow. Note that this service does not maintain a chat history with ChatGPT. Because of this, if you would like to have a continued dialog rather than one-off completions, you must keep track of the dialog yourself in a list and provide the full dialog list to this service. **Arguments:** - ``prompt: AnyOf, List>>`` (`AnyOf `__ | `String `__ | `List `__ | `Tuple `__ | `Role `__) - The prompt to provide to ChatGPT for completion. **Returns:** ``String`` (`String `__) - The generated text .. function:: OpenAI.setKey(key: String) Sets the OpenAI API key for the currently logged in account. Ideally, you should only run this command once per account from a throw-away project to avoid leaking your API key to other users. **Arguments:** - ``key: String`` (`String `__) - The new OpenAI API key to use for this account