たまーに使う AI Shell では私は OpenAI の有料版を持っていないため、いつもは Azure エージェント (@azure) で利用しています。
しかし今日このドキュメントを読んだら、自分が Azure にデプロイした Azure OpenAI Service が OpenAI エージェント (@openai-gpt) で使えることがわかりました。
https://learn.microsoft.com/ja-jp/powershell/utility-modules/aishell/developer/deploy-azlearn.microsoft.com
エージェントの構成
次のように AI Shell を起動して、@openai-gpt エージェントの構成ファイルを編集します。
Start-AIShell AI Shell 1.0.0-preview.7 Welcome to AI Shell! We’re excited to have you explore our Public Preview. Documentation is available at aka.ms/AIShell-Docs, and we’d love to hear your thoughts - share your feedback with us at aka.ms/AIShell-Feedback. Please select an AI agent to use: (You can switch to another agent later by typing @<agent name>) > openai-gpt azure @openai-gpt> /agent config
「3. デプロイを使用するようにエージェントを構成する」にあるJSONを参考に、自分が使用する Azure OpenAI Service の情報を入力します。
{ // Declare GPT instances. "GPTs": [ { "Name": "ps-az-gpt4", "Description": "<insert description here>", "Endpoint": "<insert endpoint here>", "Deployment": "<insert deployment name here>", "ModelName": "gpt-4", "Key": "<insert key here>", "SystemPrompt": "1. You are a helpful and friendly assistant with expertise in PowerShell scripting and command line.\n2. Assume user is using the operating system `osx` unless otherwise specified.\n3. Use the `code block` syntax in markdown to encapsulate any part in responses that is code, YAML, JSON or XML, but not table.\n4. When encapsulating command line code, use '```ps1' if it's PowerShell command; use '```sh' if it's non-PowerShell CLI command.\n5. When generating CLI commands, never ever break a command into multiple lines. Instead, always list all parameters and arguments of the command on the same line.\n6. Please keep the response concise but to the point. Do not overexplain." } ], // Specify the default GPT instance to use for user query. // For example: "ps-az-gpt4" "Active": "ps-az-gpt4" }
AI Shell で /refresh コマンドを実行すると "Active" に指定した GPT インスタンスが利用可能になります。
@openai-gpt> /refresh AI Shell 1.0.0-preview.7 Using the agent openai-gpt: Active GPT: gpt-4o. my gpt-4o Run /help for more instructions. @openai-gpt> @openai-gpt> 日本の首都は? 日本の首都は東京です。
GPT-5を使う構成
GPT-5 を使用する場合、モデルは gpt-5-chat を使用します。
gpt-5 モデルでも Code completions に対応しているはずですが、、AI Shell で利用してもエラーになります。
AI Shell 1.0.0-preview.7 Using the agent openai-gpt: Active GPT: gpt-5-chat. my gpt-5-chat Run /help for more instructions. @openai-gpt> 日本の首都は? 日本の首都は**東京(とうきょう)**です。 @openai-gpt>