by mittermayr · 2y ago · 0 comments
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!
Edit: url to API docs
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!
https://openai.com/blog/function-calling-and-other-api-updat...
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.