A classification prompt works well in the Foundry playground when three labelled examples are included. The developer now builds the same request in Python with a list of role-tagged chat messages. How should the three examples be supplied so that the model treats them as demonstrations rather than as the new request?
Choose one.
Placing few-shot examples in a chat-style request.
With chat-style APIs, few-shot examples are supplied as example user/assistant message pairs that follow the system message and come before the real user message; the model reads them as earlier turns that show the expected answer pattern. Fine-tuning is a different, permanent customization. Examples sent in an unrelated earlier request are not part of the context, and system messages after the user's question blur the request.
- Recall that few-shot examples are part of the prompt for this one request.
- In a role-tagged message list, a demonstration looks like a past user turn and the assistant's ideal reply.
- Place those pairs after the system message and before the real user message.
- Fine-tuning and separate requests do not put the examples into this request's context.
Exam tip: Few-shot in chat = example user/assistant pairs between the system message and the real question.
Generative AI Apps and Agents in Microsoft Foundry (AI-901) — the lesson that teaches this.