News for hackers. Stuff that matters.
Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by globalise83 on Wednesday January 31, 2024 @05:50AM (#39202278)
One thing I found helps if I want the responses to be valid JSON, seems to work:

where result contains all of the <data expected> and the result is valid JSON. Do NOT under any circumstances deviate from this format! Ensure all of the value <data expected> are complete, do not leave ANY of them out. Do not add ANY other text to your answer except for the JSON result.

I found that just asking for valid JSON didn't always work out as expected (e.g. gpt-4 API would add formatting etc., so I became more and more of a micromanager!

Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by H8crilA on Wednesday January 31, 2024 @06:39AM (#39202616)
Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by globalise83 on Wednesday January 31, 2024 @03:11PM (#39208729)
Nice! Thanks for the pointer
Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by tcdent on Wednesday January 31, 2024 @11:34AM (#39205789)
It does not really need to be that intense. I get very reliable results from the gpt4 api using this template:

  You are a data cleaner and JSON formatter
  Take the input data and format it into attributes
  Your output will be fed directly to `json.loads`
  
  Example input:
  foo bar baz bat
  
  Example format:
  {
     "string": "foo bar baz bat", 
  }
You can give it multiple input examples, too. I often use a "minimum viable" example so that it knows it's ok to return empty attributes instead of hallucinating when the data is sparse.