Proof of concept of generating testing data with OpenAI. This project consists in an app made with Qodly Studio. The app purpose is to generate data for dataclasses (tables) defined in the project structure.
Check out this video and learn how to use the app.
- Follow these steps activate Qodly Studio with 4D v20 R2 minimum: https://developer.4d.com/docs/WebServer/qodly-studio
- Get an OpenAI API Key: https://platform.openai.com/account/api-keys
- Open the project in 4D.
- Run Qodly Studio and then Preview.
- In the app settings, paste your OpenAI API Key and save.
- This demo lists your project dataclasses and their attributes: feel free to add or remove dataclasses and attributes, then refresh the dataclasses lists.
- For each attribute, you can set whether the app will: leave it blank, generate a random value, or query OpenAI API to get a set of data.
- For each attribute set to be generated by OpenAI API, values are asked by set or 10 by default, but this can be tuned by setting another value for "AI Request set". This might speed up large dataset generation.
- For each attribute, define an "AI remark" to describe what kind of data you want to get. For example "French firstnames" or "Typical timesheet comment".
- For each attribute, the "Preview" button will get a list of 5 values from OpenAI, so that you can get an idea of the result before generating records.
- Many to one relations are automatically set: a random target entity is always selected when needed.
- When you finished to define all attributes of a DataClass, press "Generate" after setting how many records you want to create.
- Querying OpenAI can take time: the more tokens are returned by OpenAI API, the longer it is. So don't be surprised if records creation does not start right after pressing the "Generate" button.
- OpenAI offers a streaming mode. Implementing this, together with HTTPRequest asynchronous callbacks, would allow records generation to start much faster.
- Error management in this proof of concept is minimal