|
| 1 | +--- |
| 2 | +title: Prompt engineering techniques with Azure OpenAI |
| 3 | +titleSuffix: Azure OpenAI Service |
| 4 | +description: Learn about the options for how to use prompt engineering with GPT-3, ChatGPT, and GPT-4 models |
| 5 | +author: slundberg |
| 6 | +ms.author: mbullwin |
| 7 | +ms.service: cognitive-services |
| 8 | +ms.topic: conceptual |
| 9 | +ms.date: 04/20/2023 |
| 10 | +manager: nitinme |
| 11 | +keywords: ChatGPT, GPT-4, prompt engineering, meta prompts, chain of thought |
| 12 | +zone_pivot_groups: openai-prompt |
| 13 | +--- |
| 14 | + |
| 15 | +# Prompt engineering techniques |
| 16 | + |
| 17 | +This guide will walk you through some advanced techniques in prompt design and prompt engineering. If you're new to prompt engineering, we recommend starting with our [introduction to prompt engineering guide](prompt-engineering.md). |
| 18 | + |
| 19 | +While the principles of prompt engineering can be generalized across many different model types, certain models expect a specialized prompt structure. For Azure OpenAI GPT models, there are currently two distinct APIs where prompt engineering comes into play: |
| 20 | + |
| 21 | +- Chat Completion API. |
| 22 | +- Completion API. |
| 23 | + |
| 24 | +Each API requires input data to be formatted differently, which in turn impacts overall prompt design. The **Chat Completion API** supports the ChatGPT (preview) and GPT-4 (preview) models. These models are designed to take input formatted in a [specific chat-like transcript](../how-to/chatgpt.md) stored inside an array of dictionaries. |
| 25 | + |
| 26 | +The **Completion API** supports the older GPT-3 models and has much more flexible input requirements in that it takes a string of text with no specific format rules. Technically the ChatGPT (preview) models can be used with either APIs, but we strongly recommend using the Chat Completion API for these models. To learn more, please consult our [in-depth guide on using these APIs](../how-to/chatgpt.md). |
| 27 | + |
| 28 | +The techniques in this guide will teach you strategies for increasing the accuracy and grounding of responses you generate with a Large Language Model (LLM). It is, however, important to remember that even when using prompt engineering effectively you still need to validate the responses the models generate. Just because a carefully crafted prompt worked well for a particular scenario doesn't necessarily mean it will generalize more broadly to certain use cases. Understanding the [limitations of LLMs](/legal/cognitive-services/openai/transparency-note?context=%2Fazure%2Fcognitive-services%2Fopenai%2Fcontext%2Fcontext#limitations), is just as important as understanding how to leverage their strengths. |
| 29 | + |
| 30 | +::: zone pivot="programming-language-chat-completions" |
| 31 | + |
| 32 | +[!INCLUDE [Prompt Chat Completion](../includes/prompt-chat-completion.md)] |
| 33 | + |
| 34 | +::: zone-end |
| 35 | + |
| 36 | +::: zone pivot="programming-language-completions" |
| 37 | + |
| 38 | +[!INCLUDE [Prompt Completion](../includes/prompt-completion.md)] |
| 39 | + |
| 40 | +::: zone-end |
0 commit comments