As from GPT-3.5- Turbo, Chat-GPT allows to set response_format as part of the parameters of an API call. But even using this parameter doesn't guarantee the response is in a consistent format. In this video I show how you can ensure a consistent response and how to avoid invalid JSON response because of insufficient tokens.
️ Copy the source code here
️ Links
Python Open File function:
JSON Mode Documentation:
️ Other helpful videos
️ Follow me
LinkedIn:
Instagram: