News for hackers. Stuff that matters.
Re:Show HN: I built a database GUI with ChatGPT integration by khazhoux on Sunday April 30, 2023 @02:46PM (#35765407)
Very cool.

But nearly every time I've asked ChatGPT for code, it gives me either plausible-but-wrong code, or total hallucinations (flags and APIs that could exist, but don't).

Re:Show HN: I built a database GUI with ChatGPT integration by calmoo on Sunday April 30, 2023 @04:12PM (#35766187)
Not my experience, nearly every time GPT 4 has produced code that compiles / runs first time without errors.
Re:Show HN: I built a database GUI with ChatGPT integration by Dennizz on Sunday April 30, 2023 @04:45PM (#35766445)
I've had mostly the same experience as calmoo.

And when it does go wrong, I've had good success telling it what it did do wrong. It will usually correct itself then.

Re:Show HN: I built a database GUI with ChatGPT integration by Closi on Tuesday May 02, 2023 @03:06AM (#35784306)
I think there are a few tricks I use to get correct code:

1) GPT4 is a must, the code quality is so much better than GPT3

2) You can use a longer explanation than you think. Be detailed in exactly what you want. Clearly describe function inputs and outputs.

3) Provide GPT3 with the APIs to use, and break these down. If you want it to call an API and do some logic, you can prompt it twice - once to build a function to get data from the API and once to build a function that requests from the function in the first request. Do both of these as separate chat GPT sessions.

4) Give GPT a chance to fix errors - pipe the exact errors back in after you have run them so GPT can amend its code.

5) if you want the code to operate/be written in a particular way then tell GPT and even provide pseudo code if worthwhile. If you want error handling, request it. If you want the SQL statements to be run in a transaction, request it. It probably won’t do these things by default.

6) don’t use even slightly obscure languages.