UiPath Documentation
private-test-cloud
2.2510
true
Test Cloud (プライベート) 管理ガイド
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

使用ガイド: AI Trust Layer を介した Mistral の接続

Automation Suite の Test Cloud (プライベート) で AI Trust Layer を介して Mistral を接続します。必要な設定と検証のガイダンスが含まれます。

このガイドでは、AI Trust Layer LLM の設定 機能を使用して、Microsoft Azure AI Foundry にデプロイされた Mistral モデルを UiPath Agents に接続する方法について説明します。Azure OpenAI テンプレートに基づいてカスタムの Integration Service コネクタを作成し、その要求フックを Mistral の API 要件に適合させます。

前提条件

  • クラスターで BYO AI ゲートウェイが有効になっている。詳しくは、「 AI Trust Layer を構成する」をご覧ください。
  • Azure AI Foundry にデプロイされた Mistral モデル ( mistral-small-2503など)
  • リソースの Azure AI Foundry エンドポイント URL
  • Azure AI Foundry リソースの API キー
  • Automation Suite での組織管理者のアクセス権
  • Integration Service とコネクタ ビルダーへのアクセス

カスタム コネクタを作成する

  1. [ 管理 ] > [AI Trust Layer ] > [LLM の設定 ] に移動し、[ 設定を追加] を選択します。
  2. [テナント]、[製品]、および [機能] の値を設定します。
  3. [ モデルの設定] の [ LLM 名 ] フィールドにカスタム エイリアスを入力し、[ API の種類 ] を [OpenAI] に設定します。
  4. [コネクタ] フィールドで、[カスタム コネクタを作成] を選択します。
  5. Azure OpenAI テンプレートを選択し、[コネクタを作成] を選択します。コネクタ ビルダーが開き、Azure OpenAI テンプレートが事前に入力された状態で開きます。

Mistral と互換性があるようにコネクタを編集します

Azure AI Foundry の Mistral モデルでは、厳密なスキーマ検証が使用され、Azure OpenAI テンプレートが既定で送信するすべてのフィールドを受け入れるわけではありません。各要求が Mistral エンドポイントに到達する前に、コネクタの preRequest フックでこれらの違いを解決する必要があります。

Azure OpenAI テンプレートの送信Azure AI Foundry での Mistral の期待フックによって適用される解像度
tool_choice: "required" またはオブジェクト フォーム"none""auto"、または "any"ツールが存在する場合の "any" に変換されます
parallel_tool_calls フィールドサポートされていないフィールド (extra_forbidden)要求本文から削除
max_completion_tokensmax_tokensフィールドの名前が変更されます
  1. コネクタ ビルダーで [ フック ] セクションを開き、 preRequest フックを選択します。

  2. フック本体全体を次のスクリプトに置き換えます。

    // Normalize query params and payload for Mistral on Azure AI Foundry.
    // Removes unsupported fields and adapts tool semantics for Mistral's strict schema.
    const _reqPath = (typeof request_path !== 'undefined') ? request_path : '';
    const _reqParams = (typeof request_parameters !== 'undefined') ? request_parameters : undefined;
    const _cfg = (typeof configuration !== 'undefined') ? configuration : undefined;
    
    if (['/query', '/v1/responses'].includes(_reqPath)) {
        return done();
    }
    
    let apiVersion = (_cfg && _cfg['api-version']) ? _cfg['api-version'] : "2023-05-15";
    if (_reqParams && _reqParams["api-version"]) {
        apiVersion = _reqParams["api-version"];
    }
    if (['/listAllModels', '/auth_validation'].includes(_reqPath)) {
        apiVersion = (_cfg && _cfg['api-version']) ? _cfg['api-version'] : "2023-10-01-preview";
    }
    
    // Resolve body across different runtime variable names
    let body = (typeof request_body !== 'undefined' && request_body) ? request_body :
               ((typeof request_vendor_body !== 'undefined' && request_vendor_body) ? request_vendor_body :
                ((typeof request !== 'undefined' && request && request.body) ? request.body : undefined));
    
    if (body && typeof body === 'string') {
        try { body = JSON.parse(body); } catch (e) { /* leave as-is */ }
    }
    
    if (body && typeof body === 'object') {
        // Remove field rejected by Mistral's strict schema
        if (Object.prototype.hasOwnProperty.call(body, 'parallel_tool_calls')) {
            delete body.parallel_tool_calls;
        }
    
        // Normalize tool_choice: Mistral accepts only 'none', 'auto', or 'any'
        const _allowedToolChoice = new Set(['none', 'auto', 'any']);
        const _hasTools = Object.prototype.hasOwnProperty.call(body, 'tools')
            && Array.isArray(body.tools) && body.tools.length > 0;
    
        if (Object.prototype.hasOwnProperty.call(body, 'tool_choice')) {
            if (body.tool_choice === 'required') {
                body.tool_choice = 'any';
            } else if (body.tool_choice && typeof body.tool_choice === 'object') {
                body.tool_choice = 'any';
            } else if (typeof body.tool_choice === 'string' && !_allowedToolChoice.has(body.tool_choice)) {
                body.tool_choice = _hasTools ? 'any' : 'auto';
            }
        } else if (_hasTools) {
            // Force tool usage: agent runtime expects tool calls when tools are configured
            body.tool_choice = 'any';
        }
    
        // Rename max_completion_tokens to max_tokens
        if (Object.prototype.hasOwnProperty.call(body, 'max_completion_tokens')) {
            if (!Object.prototype.hasOwnProperty.call(body, 'max_tokens')) {
                body.max_tokens = body.max_completion_tokens;
            }
            delete body.max_completion_tokens;
        }
    }
    
    const out = {
        request_vendor_parameters: { "api-version": apiVersion }
    };
    
    if (typeof request_body !== 'undefined') out.request_body = body;
    if (typeof request_vendor_body !== 'undefined') out.request_vendor_body = body;
    
    return done(out);
    // Normalize query params and payload for Mistral on Azure AI Foundry.
    // Removes unsupported fields and adapts tool semantics for Mistral's strict schema.
    const _reqPath = (typeof request_path !== 'undefined') ? request_path : '';
    const _reqParams = (typeof request_parameters !== 'undefined') ? request_parameters : undefined;
    const _cfg = (typeof configuration !== 'undefined') ? configuration : undefined;
    
    if (['/query', '/v1/responses'].includes(_reqPath)) {
        return done();
    }
    
    let apiVersion = (_cfg && _cfg['api-version']) ? _cfg['api-version'] : "2023-05-15";
    if (_reqParams && _reqParams["api-version"]) {
        apiVersion = _reqParams["api-version"];
    }
    if (['/listAllModels', '/auth_validation'].includes(_reqPath)) {
        apiVersion = (_cfg && _cfg['api-version']) ? _cfg['api-version'] : "2023-10-01-preview";
    }
    
    // Resolve body across different runtime variable names
    let body = (typeof request_body !== 'undefined' && request_body) ? request_body :
               ((typeof request_vendor_body !== 'undefined' && request_vendor_body) ? request_vendor_body :
                ((typeof request !== 'undefined' && request && request.body) ? request.body : undefined));
    
    if (body && typeof body === 'string') {
        try { body = JSON.parse(body); } catch (e) { /* leave as-is */ }
    }
    
    if (body && typeof body === 'object') {
        // Remove field rejected by Mistral's strict schema
        if (Object.prototype.hasOwnProperty.call(body, 'parallel_tool_calls')) {
            delete body.parallel_tool_calls;
        }
    
        // Normalize tool_choice: Mistral accepts only 'none', 'auto', or 'any'
        const _allowedToolChoice = new Set(['none', 'auto', 'any']);
        const _hasTools = Object.prototype.hasOwnProperty.call(body, 'tools')
            && Array.isArray(body.tools) && body.tools.length > 0;
    
        if (Object.prototype.hasOwnProperty.call(body, 'tool_choice')) {
            if (body.tool_choice === 'required') {
                body.tool_choice = 'any';
            } else if (body.tool_choice && typeof body.tool_choice === 'object') {
                body.tool_choice = 'any';
            } else if (typeof body.tool_choice === 'string' && !_allowedToolChoice.has(body.tool_choice)) {
                body.tool_choice = _hasTools ? 'any' : 'auto';
            }
        } else if (_hasTools) {
            // Force tool usage: agent runtime expects tool calls when tools are configured
            body.tool_choice = 'any';
        }
    
        // Rename max_completion_tokens to max_tokens
        if (Object.prototype.hasOwnProperty.call(body, 'max_completion_tokens')) {
            if (!Object.prototype.hasOwnProperty.call(body, 'max_tokens')) {
                body.max_tokens = body.max_completion_tokens;
            }
            delete body.max_completion_tokens;
        }
    }
    
    const out = {
        request_vendor_parameters: { "api-version": apiVersion }
    };
    
    if (typeof request_body !== 'undefined') out.request_body = body;
    if (typeof request_vendor_body !== 'undefined') out.request_vendor_body = body;
    
    return done(out);
    
  3. コネクタの設定で、[ ベース URL ] を Azure AI Foundry エンドポイント ( https://{your-resource-name}.openai.azure.com/openai) に設定します。

  4. 設定に一致するように [ 認証の種類 ] を設定します。この例では API キー (customApiKey) を使用していますが、 OAuth を含むサポートされている任意の認証の種類を使用できます。コネクタの設定を適宜更新してください。

  5. [ 保存] を選択し、 コネクタをパブリッシュします

Integration Service でコネクションを作成する

  1. Integration Service で [ コネクション ] に移動し、[ コネクションを追加] を選択します。
  2. パブリッシュしたカスタム コネクタを選択します。
  3. [ API キー ] フィールドに、Azure AI Foundry の API キーを入力します。
  4. [Azure OpenAI リソース] フィールドに、リソース名 (エンドポイント URL のサブドメイン部分https://.openai.azure.comを除いた部分) を入力します。
  5. [ 接続 ] を選択して、コネクションをプロビジョニングします。

LLM の設定を完了します

  1. [管理] > [AI Trust Layer] > [LLM の設定] に戻り、開始した設定を開きます。
  2. [ モデルの設定] で、[ コネクタ ] をパブリッシュ済みのコネクタに設定し、[ コネクション ] を作成したコネクションに設定します。
  3. [ LLM の識別子 ] フィールドに、Azure AI Foundry に表示されるとおりのデプロイ名を入力します。
    注:

    [LLM の識別子] フィールドの末尾に空白があると、DeploymentNotFound エラーが発生します。保存する前に、先頭または末尾にスペースがないことを確認します。

  4. [ 設定をテスト ] を選択して、AI Trust Layer プローブを実行します。
  5. プローブが成功した場合は、 [ 保存] を選択します。

結果

設定が保存され、指定した製品と機能について、UiPath Agents でミストラル モデルを使用できるようになります。呼び出しは AI Trust Layer を経由してルーティングされ、監査ログの [ソース: カスタム接続] に表示されます。

注:

カスタム コネクタの作成中に問題が発生した場合は、UiPath サポートにお問い合わせください。

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得