
The ChatGPT API expects data to be in a specific JSON format. It provides a “messages” field in the input which is an array of message objects. Each object should contain a “role” (which can be ‘system’, ‘user’, or ‘assistant’) and “content” which holds the actual content of the message from the role. Here is an example:
```
‘messages’: [
{‘role’: ‘system’, ‘content’: ‘You are a helpful assistant.’},
{‘role’: ‘user’, ‘content’: ‘Who won the world series in 2020?’}
]
```