Ask HN: How do you make the LLM generate good code?

  • Posted 2 hours ago by bjourne
  • 1 points
Lately, I wanted to see if I could get the bot to help me organize my music collection. Specifically, I want it to code a Python function that takes the path to an audio file of a song and returns the name of the canonical (i.e., first) album of that song. If one ignores remasters, live recordings, bootlegs, etc., this is an easy heuristic surjective mapping: Smoke on the Water -> Machine Head, Come as You Are -> Nevermind, Fools Gold -> The Stone Roses.

I can code this function quickly using the MusicBrainz API and I believe most other HN readers can too. Yet many hours later, no matter how I prompt the bot I can't get it to do it. This is what ChatGPT generates---other bots reply with similar garbage:

https://chatgpt.com/share/6a396ea9-44d4-83eb-bdfd-216dfcc87e99

They complain about how the problem is ambiguous (is not) or how MusicBrainz doesn't have the data (it does). Am I prompting the bot incorrectly or not using powerful enough coding models? The results are very underwhelming.

3 comments

    Loading..
    Loading..
    Loading..