A developer is building an application on OpenAI's Chat Completions API and needs to send the model both a high-level instruction that should shape its behavior for the whole conversation and the end user's own question. Per OpenAI's API documentation, how should these two pieces of context be structured in the request?
- Both pieces of context are sent as a single combined string, since the Chat Completions API has no way to distinguish who authored which part of the input
- Only the end user's question can be sent to the model; there is no supported way to give it standing instructions that apply to the whole conversation
- The high-level instruction must be repeated inside every individual user message, since a message with a system role is discarded by the API after the first turn
- Per OpenAI's API documentation, the request is built as an array of role-tagged messages: the high-level instruction is sent as a system message placed at the start of the array, the end user's question is sent as a user message, and any of the model's own prior responses are represented back to it as assistant messages
Why D? And why not the others?
Correct answer: D. Per OpenAI's API documentation, the request is built as an array of role-tagged messages: the high-level instruction is sent as a system message placed at the start of the array, the end user's question is sent as a user message, and any of the model's own prior responses are represented back to it as assistant messages
OpenAI's Chat Completions API documentation structures a request as an ordered array of messages, each tagged with a role: a system message near the start of the array carries high-level, developer-authored instructions meant to shape the model's behavior for the whole conversation, a user message carries the end user's own input, and an assistant message represents the model's own prior output fed back into the conversation so it can be attended to on later turns. The option describing one combined untagged string ignores that each message in the array carries its own distinct role rather than being an undifferentiated blob. The option claiming there is no way to give standing instructions ignores the system message's explicit documented purpose. The option claiming a system message is discarded after the first turn is incorrect; it remains present in the array on each subsequent request unless the developer removes it themselves.
Source: OpenAI API documentation: Chat Completions, message roles (system, user, assistant)