Prompt template
Run these steps in order.
01
Understand that GPT chat models require input as a series of messages, each with a role ('system', 'user', or 'assistant') and content. 02
Start conversations with a 'system' message to set the assistant's behavior, followed by alternating 'user' and 'assistant' messages. 03
Use 'user' messages to provide instructions or queries from end users or developers. 04
Use 'assistant' messages to include prior model responses or developer-provided example outputs. 05
Include previous conversation messages in each API call since models do not retain memory between calls; provide all relevant context each time. 06
Be aware of the model's token limit; shorten conversation history if necessary to fit within token limits. 07
Interpret API responses by extracting the assistant's reply from choices[0].message.content and check the finish_reason to determine if the output is complete or truncated.