News for hackers. Stuff that matters.
Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by mittermayr on Wednesday January 31, 2024 @05:23AM (#39202101)
I have a suggestion that would make this very valuable for anyone starting in the field (part of which you already have implemented, great!):

Provide various templates for both pre-instructions as well as post-processing prompts. Like, some "tested" prompts that ensure (as best as possible) that the output is in certain formats (JSON, a list, a restricted CSV set, etc.), or that the input will ensure (as best as possible at least) to prevent basic jailbreaks from the main prompt.

It would take me a long time to get up to speed to what people working with ChatGPT every day have already figured out to work best in warming up GPT with a prompt as well as ensuring that the output doesn't escalate into something unexpected. Having those (reliable) templates would be fantastic for anyone starting!

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.
Re:Show HN: ChatGPT prompt builder – the simplest prompt bui... by gerlv on Wednesday January 31, 2024 @06:44AM (#39202653)
For API responses that require valid JSON - you can make requests in JSON mode - https://platform.openai.com/docs/api-reference/chat/create#c...

Edit: url to API docs