Verifying the Official Azure OpenAI Prompt Structure

AI・機械学習カテゴリを表すパンダのイラスト AI & Machine Learning

This article is a technical commentary and implementation example created using AI. Although the published code and procedures are based on primary sources, the author has not verified their operation on actual hardware. Behavior may vary depending on the environment and version.

Announcement and Theme Overview

Based on information described in primary sources, this article explains the basic concepts and structuring methods of prompt engineering in Azure OpenAI. Prompts provide instructions or context to the model to complete a task, and the model responds based on the fundamental behavior of probabilistically generating the optimal text that follows.

Why It Is Interesting

At first glance, generative AI models appear to be answering questions, but internally they output “the words with the highest probability of following next” based on their training data. An interesting feature is that by understanding this mechanism and properly utilizing the components of a prompt, it becomes easier to obtain the intended output.

Use Cases in Windows and Office

[Scheduled to be verified in a Windows environment] When combining Azure OpenAI with applications on Windows or Microsoft Office in business operations, it is expected that structured prompts will be applied. For example, in routine writing tasks or data summarization, using prompts that organize instructions and supporting content is expected to help suppress variations in output.

What We Will Try This Time

We will organize the basic concepts and component design principles of prompts shown in primary sources, and examine the roles and combination methods of each element, including Instructions. We will also mention that these may not be recommended for reasoning models (such as gpt-5 or the o-series).

Experimental Procedure

  1. Verify the basic behavior of prompts based on primary sources.

  2. Organize the concepts of prompt components (such as Instructions).

  3. Prepare to summarize the differences between the Chat Completion API (roles of system, user, and assistant) and the Completion API in actual API usage as comparison items.

  4. As [Pre-hardware verification], confirm the concepts of the presented comparison table categorized by structural element.

Code and Commands

As an example of a prompt described in primary sources, we illustrate the concept for understanding completion behavior trends when the beginning of a famous text is input.

Prompt: Four score and seven years ago our
Completion: fathers brought forth on this continent, a new nation, conceived in Liberty...

Additionally, the concept is shown where the Chat Completion API sends data as an array categorized by role, as follows.

[
  {"role": "system", "content": "You are a helpful assistant."},
  {"role": "user", "content": "プロンプトの構成要素について説明してください。"}
]

Results to Verify

As described in primary sources, the model outputs a response determined to have the highest probability based on training data and targets. It does not pass through a dedicated Q&A code path for questions; rather, because continuing with an answer is the most natural output, it can be confirmed that it appears to be answering as a result.

What Was Learned

All contents covered in this article are unverified on actual hardware. Within the scope confirmed from primary sources, prompts are text for communication between the user and the GPT model, and we learned that there are differences in input structure (such as arrays of dictionaries and role definitions) between the Completion API and the Chat Completion API. The primary sources also state that prompt construction has an artistic aspect and requires learning because behaviors vary across models.

Practical Notes

  • The contents of this article have not been verified for operation on actual hardware.

  • The techniques introduced here may not be recommended for reasoning models (such as gpt-5 or the o-series).

  • Since behaviors differ depending on the model, verification must be performed according to the actual environment and version. Please verify for yourself.

Reference Information

  • source_title: Azure OpenAI prompt engineering concepts

  • source_url: https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/prompt-engineering

ライセンス:本記事のテキスト/コードは特記なき限り CC BY 4.0 です。引用の際は出典URL(本ページ)を明記してください。
利用ポリシー もご参照ください。

コメント

Copied title and URL