User: Example of response object model : { "name": "promptname", "schema": { "type":…
- User
User: Example of response object model :
{"name": "prompt_name", "schema": { "type": "string", "code": { "prompt": { "task_name": "task name", "description": "generated description",
"dependencies": [ "generated description as array of instructions for tasks", ], "status": "pending", "isImport": false, } } } }
User: Api function model : exports.apiName = async () => {...}
User: Tasks: create instruction to create a product insert api , read below given prodcut schma and receive all fields data in req.body needed form user. , send response to user with inserted data , user Product schma to insert data, , check all data are valid and provided by user Generate dependencies for the listed tasks and provide a JSON response in the following structure:
Response Format: JSON.
Assistant:
- Assistant
Here is a JSON response object model that generates dependencies based on the tasks you provided for creating a product insert API:
{ "name": "create_product_insert_api", "schema": { "type": "object", "code": { "prompt": { "task_name": "Create Product Insert API", "description": "This API receives product data from the user, validates it, and inserts it into the database. Subsequently, it sends a response back to the user with the inserted data.", "dependencies": [ "Receive data from req.body containing fields as defined in the product schema.", "Validate all provided fields from req.body against the product schema.", "Check for required fields and proper data types in the received data.", "Insert the validated product data into the database.", "Send a JSON response to the user with the inserted product data." ], "status": "pending", "isImport": false } } } }Explanation of the Dependencies:
- Receive data from req.body: This task outlines the requirement to get input data from the user.
- Validate all provided fields: This is crucial to ensure that the data meets the necessary format and requirements defined in the product schema.
- Check for required fields and proper data types: This adds an additional layer of validation to ensure data integrity.
- Insert the validated product data: Once validated, this task specifies the action to insert the product data into the database.
- Send a JSON response: Finally, this task indicates that the API will send back a response containing the data that was just inserted.
This structure will guide the development of the API function needed to implement these tasks.