次の方法で共有


OpenAI エージェント

このエージェントは、OpenAI サービスと対話するためのユーザーフレンドリーなプラットフォームを提供するように設計されています。 パブリック OpenAI サービスまたは Azure OpenAI サービスのプライベート デプロイに接続できます。 セキュリティとプライバシーを強化するために、Azure OpenAI デプロイを使用することをお勧めします。

前提 条件

  • OpenAI の場合、エージェントを使用するには、モデル名の と API キー 必要があります。

  • Azure OpenAI サービスの場合、エージェントを使用するには、エンドポイントデプロイ名モデル名、および API キー 必要があります。

構成

開始する前に、OpenAI 実装の詳細を使用してエージェントを構成する必要があります。 エージェントを構成するには、 /agent config openai-gpt コマンドを使用して、デフォルトのエディターで構成ファイルを開きます。

  • Azure OpenAI には、 endpointdeployment 名、 model 名が必要です。
  • パブリックOpenAIは、 model 名のみを必要とします。 エンドポイントもデプロイ名もありません。

次の例に基づいてファイルを更新します。

{
  // Declare GPT instances.
  "GPTs": [
    // To use the Azure OpenAI service:
    // - Set `Endpoint` to the endpoint of your Azure OpenAI service,
    //     or the endpoint to the Azure API Management service if you are using it as a gateway.
    // - Set `Deployment` to the deployment name of your Azure OpenAI service.
    // - Set `ModelName` to the name of the model used for your deployment, e.g. "gpt-4-0613".
    // - Set `Key` to the access key of your Azure OpenAI service,
    //     or the key of the Azure API Management service if you are using it as a gateway.
    {
      "Name": "ps-az-gpt4",
      "Description": "A GPT instance with expertise in PowerShell scripting and command line utilities. Use gpt-4 running in Azure.",
      "Endpoint": "<insert your Azure OpenAI endpoint>",
      "Deployment": "<insert your deployment name>",
      "ModelName": "<insert the model name>",   // required field to infer properties of the service, such as token limit.
      "Key": "<insert your key>",
      "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 `Windows 11` 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 '```powershell' 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."
    },

    // To use the public OpenAI service:
    // - Ignore the `Endpoint` and `Deployment` keys.
    // - Set `ModelName` to the name of the model to be used.
    // - Set `Key` to be the OpenAI access token.
    // For example:
    {
        "Name": "ps-gpt4o",
        "Description": "A GPT instance with expertise in PowerShell scripting and command line utilities. Use gpt-4o running in OpenAI.",
        "ModelName": "gpt-4o",
        "Key": "<insert your key>",
        "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 `Windows 11` 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 '```powershell' 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.
  "Active": "ps-az-gpt4"
}

手記

Azure OpenAI 構成のエンドポイントには、デプロイを含む完全なエンドポイントは必要ありません (たとえば、エンドポイント形式 ( https://<YourServiceName>.openai.azure.com) のみを使用できます)。

Microsoft Entra ID 認証のサポート

パスワードとキーを安全に保つために、Azure OpenAI インスタンスに Entra ID 認証のサポートを追加しました。 これで、構成ファイルにキーを格納せずに Azure OpenAI リソースにアクセスできるようになりました。 次の例は、Entra ID 認証を設定する方法を示しています。

{
  // Declare GPT instances.
  "GPTs": [
      // Declaration of an Azure OpenAI instance with EntraID authentication
      {
        "Name": "ps-az-entraId",
        "Description": "A GPT instance with expertise in PowerShell scripting using Entra ID authentication.",
        "Endpoint": "<Your Endpoint>",
        "Deployment": "<Your Deployment Name>",
        "ModelName": "<Your Model Name>",
        "AuthType": "EntraID",
        "SystemPrompt": "You are a helpful and friendly assistant with expertise in PowerShell scripting and command line."
      }
  ],

  // Specify the default GPT instance to use for user query.
  "Active": "ps-az-entraId"
}

Azure OpenAI では、認証に次の資格情報の階層が使用されます。

  • EnvironmentCredential
  • WorkloadIdentityCredential
  • ManagedIdentityCredential
  • SharedTokenCacheCredential
  • VisualStudioCredential
  • AzureCliCredential
  • AzurePowerShellCredential
  • AzureDeveloperCliCredential
  • InteractiveBrowserCredential

これらの資格情報の詳細については、 DefaultAzureCredential の .NET ドキュメントを参照してください。

GPTの

GPT は、ベース OpenAI モデルのカスタマイズされたバージョンです。 GPT を使用して、モデルに指定したシステム プロンプトに基づいて、フォーカスされた応答を提供します。 GPO は、エージェントの設定ファイルで構成されます。 各 GPT 構成には、名前、説明、対象となる OpenAI モデル、および対話のためのシステム プロンプトが含まれます。 システム プロンプトは、特定のシナリオをサポートするようにカスタマイズできます。 各構成では、特定のドメインまたはシナリオに合わせて調整された個別の GPT を作成できます。 さらに、必要に応じて GPT ごとに異なる OpenAI モデルを選択できます。

命令

コマンド /gpt は、GPT の管理を容易にするために用意されています。

  • /gpt use <gpt-name>を実行して別のGPTインスタンスに切り替えるか、/gpt useを実行して使用可能なものから選択します。
  • /gpt list <gpt-name> を実行して GPT 定義の詳細を表示するか、/gpt list 実行して使用可能なすべての GPT を一覧表示します。
aish:1> /gpt --help
Description:
  Command for GPT management within the 'openai-gpt' agent.

Usage:
  gpt [command] [options]

Options:
  -h, --help  Show help and usage information

Commands:
  list <GPT>  List a specific GPT, or all available GPTs.
  use <GPT>   Specify a GPT to use, or choose one from the available GPTs.

その他のOpenAI互換モデルのサポート

AI Shell v1.0.0-preview.2 のリリースにより、 openai-gpt エージェントは OpenAI API 仕様に準拠するサードパーティ モデルにサポートを拡張し、より柔軟な AI エクスペリエンスを実現します。 これらのモデルの多くは、SLM と LLM をローカルで実行するためのオープン ソース ツールです。 openai-gpt エージェントは、次のモデルをサポートするようになりました。

これらのモデルを使用するには、エージェント設定ファイルで endpointkey、および model 名を設定するだけで済みます。 次の openai.agents.config ファイルには、新しい AI プロバイダーのうち 2 つの構成例が含まれています。 エンドポイントとモデル名の詳細については、特定のモデルのドキュメントを参照してください。

AI Shell v1.0.0-preview.4 のリリースにより、 openai-gpt エージェントは次のモデル名をサポートします。

  • o1
  • o3
  • o4-mini
  • gpt-4.1
  • gpt-4o
  • gpt-4
  • gpt-4-32k
  • gpt-4-turbo
  • gpt-3.5-turbo