Get consistent JSON response from OpenAI / Chat-GPT

Опубликовано: 16 Сентябрь 2024
на канале: Thomas Janssen | Tom's Tech Academy
14k
194

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: