Chat GPT Code Generation

Apex offers automated base generation of entire packages / systems with the assistance of Chat GPT. Here's how it works:

  1. Running the gpt generate CLI command will prompt you to write a small description of the system you would like developed.
  2. An API call will be made to OpenAI to generate the SQL database schema for the system you described.
  3. The SQL database schema will be saved within the file chat_gpt.sql, and you will be prompted to modify as desired then press enter once done.
  4. SQL database schema will be appended to /etc/<PACKAGE/instal.sql and remove.sql files, executed against the database, menus within administration panel will be added, and all models, controllers and views necessary will be automatically generated using the code generation libraries available within Apex Opus.
  5. Go through everything automatically generated and make any necessary tweaks / modifications.

Generate Code with Chat GPT Assistance

Before you begin code generation, you must first register for an OpenAI API Key, then run the gpt init CLI command, such as:

apex gpt init <OPENAI_API_KEY>

This will store your API key for later use when making calls to OpenAI. Next, ensure you have the desired package already created using the package create CLI command that you would like the generated code assigned to, for example:

apex package create my-shop

Then simply go ahead and generate code with Chat GPT's assistance with the command:

apex gpt generate <PACKAGE>

apex gpt generate my-shop

Enter the desired system in plain English, press enter twice and the database schema plus all necessary code files will be automatically generated for you.