How to use ChatGPT with Node-RED
This deep dive demonstrates how to use ChatGPT with Node‑RED.
Things To Note
All Block Outputscontain all the info that comes out once an image is triggered.
- Copy the debug output from the
All Block Outputs.

All Block Outputs
This node outputs data after each capture made by the camera and containing all AI block data. The data is in the form of a JSON object. The data includes the following:
| Payload Field | Type | Description |
|---|---|---|
payload.capture_id | integer | The capture ID of this capture |
payload.recipe_id | integer | The recipe ID of this recipe |
payload.camera_id | string | A unique string identifier for this camera |
payload.inspection_id | integer | A rolling 16-bit integer that increments for each inspection |
payload.inspection_time | string | ISO 8601 formatted timestamp of the capture for each inspection |
payload.image_url | string | HTTP url to the capture image (jpg) |
payload.alignment.success | boolean | Successful algined part or not |
payload.alignment.center_location_x | integer | Center location x of aligned part |
payload.alignment.center_location_y | integer | Center location y of aligned part |
payload.alignment.confidence | float (0-1) | Confidence of alignment |
ChatGPT/Gemini/Copilot
- Enter the prompt: “Here is the Input I have from Node Red : Insert the copied value here. enter prompt when you want it to fail and return msg.payload in boolean True or False”

Example
- Here we have taught the AI to look for holes in the mounting plate.

- Copy the values from the Node-RED
debugblock and paste it in ChatGPT with the following example prompt.- “Here is the Input I have from Node Red : Insert the copied value here. I want the camera to fail if there are less than 11 holes and return msg.payload in boolean True or False”

- Take a look at the
functionblock and read the comments on the logic. - See if it's doing the right thing (what was asked of it), and if so, copy the code it gives you.
- Get a
functionnode from the nodes and connect it to theInspection Pass/Failblock.


- Copy the code in the
functionblock, make sure all the nodes are connected correctly and click Deploy.


