3 ms·
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 t
by mittermayr 3y ago
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!
- globalise83 3y agoOne 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!
- H8crilA 3y agoThis is what function calling is for. https://openai.com/blog/function-calling-and-other-api-updates https://openai.com/blog/function-calling-and-other-api-updat...
- globalise83 3y agoNice! Thanks for the pointer
- tcdent 3y agoIt 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.
- gerlv 3y agoFor API responses that require valid JSON - you can make requests in JSON mode - https://platform.openai.com/docs/api-reference/chat/create#chat-create-response_format https://platform.openai.com/docs/api-reference/chat/create#c... Edit: url to API docs