QRCode icon indicating copy to clipboard operation
QRCode copied to clipboard

ChatGPT proposed code, refering to function in this library, which does not exist

Open 369Martin369 opened this issue 1 year ago • 2 comments

Hi, Code ChatGPT suggested:

String generateQRCode(const String& data) { QRCode qrcode; uint8_t qrcodeData[qrcode_getBufferSize(3)]; qrcode_initText(&qrcode, qrcodeData, 3, 0, data.c_str());

String qrCodeHtml = "<img src="data:image/png;base64,"; qrCodeHtml += qrcode_getQRCode(&qrcode); qrCodeHtml += "">";

return qrCodeHtml; }

But..."qrcode_getQRCode" is not declared in qrcode.h!: How comes that ChatGPT thinks this is part of Richard Moore's library??

369Martin369 avatar May 17 '24 19:05 369Martin369

CharGPT will often hallucinate. You cannot take its suggestions at face value and will often have to do additional research beyond code it proposes.

ricmoo avatar May 17 '24 19:05 ricmoo

(my low-level libraries tend to be exclusively C, so if you see C++ syntax it is likely a hallucination)

ricmoo avatar May 17 '24 19:05 ricmoo