---
schema_version: "1"
id: ae71a79a960a37bd552104748dec025da4e8867268ce89f2dddc8b9f6f0495c9
title: Einstein AI Connector 1.0 のツール操作の設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/einstein-ai-connector/1.0/configuring-tools-operations.md
canonical_url: https://docs.mulesoft.com/jp/einstein-ai-connector/1.0/configuring-tools-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e04bd6370db37a26a3831da7c178e12a1eb50aced29631dfc5476db364ffbd69
description: MuleSoft Documentation Site
release: "1.0"
latest: false
---
# Einstein AI Connector 1.0 のツール操作の設定

AI モデルがプロンプトに直接回答できないときに、外部ツールを使用できる自律エージェントを作成するには、​**Tools use AI service**​ 操作を使用します。

## [](#始める前に)始める前に

ツール操作を使用するには、操作で API を正常に実行するために必要なすべての API 情報を含む ​`tools.config.json`​ ファイルを作成する必要があります。次に例を示します。

```json
[
    {
        "action": "Execute POST requests for API endpoints.",
        "url": "http://check-inventory-material.cloudhub.io/mmbe",
        "name": "Check Inventory",
        "method": "POST",
        "headers": "Basic XXX",
        "example-payload": "{\n \"materialNo\": \"paramValue\"}",
        "query": [
            "Check inventory in SAP",
            "Check Stock Overview",
            "Show product availability for MULETEST0",
            "Check the inventory for MULETEST0",
            "Check Stock for 400-110"
        ],
        "description": "Check inventory details for material in SAP by providing the materialNo as input for paramValue. Please use the materialNo and not materialNumber. This action applies whenever users' intent is 'Stock overview', 'product availability', 'Inventory', 'available stock'. Use the headers to perform the request."
    },
    {
        "action": "Execute GET requests for API endpoints.",
        "url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/612eb739-4266-4f4c-bf2f-29953c153d80/accounts-api/1.0.1/m/accounts",
        "name": "Show Accounts",
        "method": "GET",
        "headers": "",
        "example-payload": "{}",
        "query": [
            "Get all accounts",
            "Show all accounts from CRM"
        ],
        "description": "Get all accounts from a CRM. This action applies whenever users' intent is 'CRM accounts', 'customers', 'customer accounts', 'accounts'."
    },
    {
        "action": "Execute GET requests for API endpoints.",
        "url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/7b99cead-a984-497b-9e6c-c16a3b4dcb76/employee-api/1.0.1/m/employees",
        "name": "Show Employees",
        "method": "GET",
        "headers": "",
        "example-payload": "{}",
        "query": [
            "Get all employee information",
            "Show employees for the country Switzerland",
            "How many employees do we have",
            "Show a list of all employees"
        ],
        "description": "Get all information about employees. This action applies whenever users' intent is 'employees', 'workforce'."
    }
]
```

ツール配列内の各オブジェクトは自律エージェントで使用できるツールを表すため、各項目をできるだけ正確に記述することが重要です。

- `action`
    
    この項目では、次のオプションがサポートされます。
    
    - API エンドポイントへの ​`Execute GET`​ 要求。
    - API エンドポイントへの ​`Execute POST`​ 要求。
- `url`
    
    リソースパスを含むエンドポイントへの完全な URL。
- `name`
    
    自然言語でのアクションの名前。
- `method`
    
    エンドポイントの HTTP メソッド。POST と GET のみがサポートされています。
- `headers`
    
    エンドポイントへの認証に必要な HTTP ヘッダー。基本認証のみがサポートされています。
- `example-payload`
    
    JSON 形式のサンプルペイロード。
- `query`
    
    このアクションを呼び出すためにユーザーが使用できるサンプルクエリ。
- `description`
    
    ツールの使用方法の詳細な説明。説明は、LLM が目的と使用方法を理解できる包括的なものである必要があります。

`tools.config.json`​ へのファイルパスにアプリケーションが実行時にアクセスできることを確認します。

## [](#tools-use-ai-service-操作の設定)Tools Use AI Service 操作の設定

**Tools use AI service**​ 操作を設定する手順は、次のとおりです。

Unresolved include directive in modules/ROOT/pages/configuring-tools-operations.adoc - include::connectors::partial$t-configure-operations.adoc\[\] \* **Prompt (プロンプト)**

\+ LLM に送信するプロンプト。 \* **Input Stream (入力ストリーム)**

### [](#出力設定)出力設定

この操作の応答には、メイン LLM 応答を含む JSON ペイロードが含まれます。また、トークン利用状況やツール利用状況 (ブール値) などの属性がメインペイロード内ではなく属性の一部として含まれます。

プロンプトが「What is the capital of Switzerland? (スイスの首都は?)」の場合の JSON ペイロードのサンプル応答を次に示します。

```json
{
    "response": "The capital of Switzerland is Bern."
}
```

「Show me the latest account created in Salesforce (Salesforce で作成された最新の取引先を表示して)」など、プロンプトでツールを介した外部データへのアクセスを要求された場合、AI モデルは設定済みのツールを使用して情報を取得します。結果は次のようになります。

```json
{
    "response": "The latest account created in Salesforce is:\n\n- **Name:** MuleTalks\n- **Id:** 0010600002JKf42AAD\n- **Created Date:** 2024-07-10T20:21:36.000Z\n\nIf you have any further questions or need additional assistance, feel free to ask!"
}
```

操作では、JSON ペイロードに加えて、トークンとツールの利用状況に関する情報が含まれる属性が返されます。次に例を示します。

```json
{
    "tokenUsage": { (1)
        "outputCount": 9,
        "totalCount": 18,
        "inputCount": 9
    },
    "additionalAttributes": { (2)
        "toolsUsed": "true"
    }
}
```

<table>
<tbody><tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>tokenUsage: 操作のトークン利用状況に関するデータを提供します。
<div class="ulist">
<ul>
<li>
<p><code>outputCount</code></p>
<div class="paragraph">
<p>応答で生成されたトークン数</p>
</div>
</li>
<li>
<p><code>totalCount</code></p>
<div class="paragraph">
<p>入力と出力を含め操作全体で処理されたトークンの合計数</p>
</div>
</li>
<li>
<p><code>inputCount</code></p>
<div class="paragraph">
<p>入力クエリまたはドキュメントから処理されたトークン数</p>
</div>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td><code>additionalAttributes</code>​ には、​<code>toolsUsed</code>​ のブール値が含まれます。
<div class="ulist">
<ul>
<li>
<p><code>true</code></p>
<div class="paragraph">
<p>応答を収集または生成するために API やインテグレーションなどの外部ツールが使用されました。</p>
</div>
</li>
<li>
<p><code>false</code></p>
<div class="paragraph">
<p>外部ツールは使用されず、応答は内部ナレッジのみに基づきました。</p>
</div>
</li>
</ul>
</div></td>
</tr>
</tbody></table>

## [](#関連情報)関連情報

- [Using Anypoint Code Builder to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-acb)
- [Studio を使用したコネクタの設定](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)
- [Einstein AI Connector の概要](https://docs.mulesoft.com/jp/einstein-ai-connector/1.0/)
- [Einstein AI Connector リファレンス](https://docs.mulesoft.com/jp/einstein-ai-connector/1.0/einstein-ai-connector-reference)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)