> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LangSmith の統合

> このドキュメントは AI によって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/cloud/use-dify/monitor/integrations/integrate-langsmith) を参照してください。

### 1 LangSmith とは

LangSmith は LLM アプリケーションの開発、コラボレーション、テスト、デプロイ、監視などのツールを提供するプラットフォームです。

<Info>
  LangSmith の公式サイト：[https://www.langchain.com/langsmith](https://www.langchain.com/langsmith)
</Info>

### 2 LangSmith の使い方

#### 1. LangSmith の[公式サイト](https://www.langchain.com/langsmith)から登録し、ログインする。

#### 2. LangSmith からプロジェクトを作成します

ログイン後、ホームページの **New Project** をクリックし、新たな **プロジェクト**を作成します。このプロジェクトは、Dify 内の **アプリ**と連動したデータモニタリングに使用されます。

<Frame>
  ![新たなプロジェクトを作成します。](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/58e20105fcc0771ca2431e8e5dcc42d3.png)
</Frame>

作成する後、プロジェクトの中にチェクできます。

<Frame>
  ![LangSmith の中にプロジェクトをチェクします。](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/642c0ff7edfdfe77fba43aa22cc3fa71.png)
</Frame>

#### 3. プロジェクト認証情報の作成

左のサイドバーでプロジェクト **設定** を見つける。

<Frame>
  ![プロジェクトを設定し](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/c49a1fc769215193928ff0d880422f89.png)
</Frame>

**Create API Key** をクリックし，新たな認証情報を作ります。

<Frame>
  ![プロジェクトの API Key を作ります。](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/7082286b0d12af4bc0c84d9a3acf8b1b.png)
</Frame>

**Personal Access Token** を選び，のちほとの API 身分証明の時使えます。

<Frame>
  ![Personal Access Token を選択します](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/75a69bd4dd02f0ffc0313589ae12fb36.png)
</Frame>

新たな API key をコピーし、保存します。

<Frame>
  ![新たな API key をコピーします](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/723e96a13e8f722d6df714b11ffd0bb1.png)
</Frame>

#### 4. Dify アプリの中に LangSmith を設定します

監視用のアプリのサイトメニューの **監視** ボタンをクリックし，**設定** をクリックします。

<Frame>
  ![LangSmith を設定します](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/b6c7e5d4c2ca2092d59465cca27bc69c.png)
</Frame>

それから，LangSmith から作った **API Key** と **プロジェクト名**を **設定**の中に貼り付け、保存します。

<Frame>
  ![ LangSmith を設定します。](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/93dfabcadb7b2ff597f54beb5e642124.png)
</Frame>

<Info>
  設定したプロジェクト名は LangSmith のいるプロジェクト名と必ず一致します。一致しない場合、データの同期時に LangSmith は自動的に新しいプロジェクトを作成します。
</Info>

保存に成功すると、現在のページで監視状態を見ることができます。

<Frame>
  ![監視状態を見る](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/43369dc4de8f606c166fae2efab97d73.png)
</Frame>

### LangSmith でのモニタリングデータの表示

Dify 内のアプリケーションからデバッグや製品データを設定することで、LangSmith にてそのデータをモニタリングすることができます。

<Frame>
  ![Dify におけるアプリケーションのデバッグ](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/a1370fdbb79257cba31a565ac6764802.png)
</Frame>

LangSmith に切り替えると、ダッシュボード上で Dify アプリケーションの詳細な操作ログを見ることができます。

<Frame>
  ![LangSmith でのアプリケーションデータの表示](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/2833b2ffa20927b5328e9624b065beea.png)
</Frame>

LangSmith を通じて得られる詳細な大規模言語モデル（LLM）の操作ログは、Dify アプリケーションのパフォーマンスを最適化するために役立ちます。

<Frame>
  ![LangSmith でのアプリケーションデータの表示](https://assets-docs.dify.ai/dify-enterprise-mintlify/jp/guides/monitoring/integrate-external-ops-tools/beeb4ee50c80de8db7400c1f65727c8c.png)
</Frame>

### モニタリングデータリスト

#### ワークフロー/チャットフローのトレース情報

ワークフローやチャットフローを追跡するために使用されます。

<table>
  <thead>
    <tr>
      <th>ワークフロー</th>
      <th>LangSmith Chain</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>workflow\_app\_log\_id/workflow\_run\_id</td>
      <td>ID</td>
    </tr>

    <tr>
      <td>user\_session\_id</td>
      <td>- メタデータに配置</td>
    </tr>

    <tr>
      <td>
        {"workflow_{id}"}
      </td>

      <td>名前</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>開始時間</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>終了時間</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>入力</td>
    </tr>

    <tr>
      <td>outputs</td>
      <td>出力</td>
    </tr>

    <tr>
      <td>モデルトークン消費</td>
      <td>使用メタデータ</td>
    </tr>

    <tr>
      <td>metadata</td>
      <td>追加情報</td>
    </tr>

    <tr>
      <td>エラー</td>
      <td>エラー</td>
    </tr>

    <tr>
      <td>\[workflow]</td>
      <td>タグ</td>
    </tr>

    <tr>
      <td>"conversation\_id/none for workflow"</td>
      <td>メタデータ内の conversation\_id</td>
    </tr>

    <tr>
      <td>conversion\_id</td>
      <td>親実行 ID</td>
    </tr>
  </tbody>
</table>

**ワークフロートレース情報**

* workflow\_id：ワークフローの固有識別子
* conversation\_id：会話 ID
* workflow\_run\_id：現在の実行 ID
* tenant\_id：テナント ID
* elapsed\_time：現在の実行にかかった時間
* status：実行ステータス
* version：ワークフローのバージョン
* total\_tokens：現在の実行で使用されるトークンの合計数
* file\_list：処理されたファイルのリスト
* triggered\_from：現在の実行を引き起こしたソース
* workflow\_run\_inputs：現在の実行の入力データ
* workflow\_run\_outputs：現在の実行の出力データ
* error：現在の実行中に発生したエラー
* query：実行中に使用されたクエリ
* workflow\_app\_log\_id：ワークフローアプリケーションログ ID
* message\_id：関連メッセージ ID
* start\_time：実行の開始時間
* end\_time：実行の終了時間
* workflow node executions：ワークフローノード実行に関する情報
* メタデータ
  * workflow\_id：ワークフローの固有識別子
  * conversation\_id：会話 ID
  * workflow\_run\_id：現在の実行 ID
  * tenant\_id：テナント ID
  * elapsed\_time：現在の実行にかかった時間
  * status：実行ステータス
  * version：ワークフローのバージョン
  * total\_tokens：現在の実行で使用されるトークンの合計数
  * file\_list：処理されたファイルのリスト
  * triggered\_from：現在の実行を引き起こしたソース

#### メッセージトレース情報

大規模言語モデル（LLM）関連の会話を追跡するために使用されます。

<table>
  <thead>
    <tr>
      <th>チャット</th>
      <th>LangSmith LLM</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>message\_id</td>
      <td>ID</td>
    </tr>

    <tr>
      <td>user\_session\_id</td>
      <td>- メタデータに配置</td>
    </tr>

    <tr>
      <td>
        {'"message_{id}"'}
      </td>

      <td>名前</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>開始時間</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>終了時間</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>入力</td>
    </tr>

    <tr>
      <td>outputs</td>
      <td>出力</td>
    </tr>

    <tr>
      <td>モデルトークン消費</td>
      <td>使用メタデータ</td>
    </tr>

    <tr>
      <td>metadata</td>
      <td>追加情報</td>
    </tr>

    <tr>
      <td>エラー</td>
      <td>エラー</td>
    </tr>

    <tr>
      <td>\["message", conversation\_mode]</td>
      <td>タグ</td>
    </tr>

    <tr>
      <td>conversation\_id</td>
      <td>メタデータ内の conversation\_id</td>
    </tr>

    <tr>
      <td>conversion\_id</td>
      <td>親実行 ID</td>
    </tr>
  </tbody>
</table>

**メッセージトレース情報**

* message\_id：メッセージ ID
* message\_data：メッセージデータ
* user\_session\_id：ユーザーセッション ID
* conversation\_model：会話モード
* message\_tokens：メッセージ中のトークン数
* answer\_tokens：回答のトークン数
* total\_tokens：メッセージと回答の合計トークン数
* error：エラー情報
* inputs：入力データ
* outputs：出力データ
* file\_list：処理されたファイルのリスト
* start\_time：開始時間
* end\_time：終了時間
* message\_file\_data：メッセージに関連付けられたファイルデータ
* conversation\_mode：会話モード
* メタデータ
  * conversation\_id：会話 ID
  * ls\_provider：モデルプロバイダ
  * ls\_model\_name：モデル ID
  * status：メッセージステータス
  * from\_end\_user\_id：送信ユーザーの ID
  * from\_account\_id：送信アカウントの ID
  * agent\_based：メッセージがエージェントベースかどうか
  * workflow\_run\_id：ワークフロー実行 ID
  * from\_source：メッセージのソース

#### モデレーショントレース情報

会話のモデレーションを追跡するために使用されます。

<table>
  <thead>
    <tr>
      <th>モデレーション</th>
      <th>LangSmith Tool</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>user\_id</td>
      <td>- メタデータに配置</td>
    </tr>

    <tr>
      <td>“moderation"</td>
      <td>名前</td>
    </tr>

    <tr>
      <td>start\_time</td>
      <td>開始時間</td>
    </tr>

    <tr>
      <td>end\_time</td>
      <td>終了時間</td>
    </tr>

    <tr>
      <td>inputs</td>
      <td>入力</td>
    </tr>

    <tr>
      <td>outputs</td>
      <td>出力</td>
    </tr>

    <tr>
      <td>metadata</td>
      <td>追加情報</td>
    </tr>

    <tr>
      <td>\[moderation]</td>
      <td>タグ</td>
    </tr>

    <tr>
      <td>message\_id</td>
      <td>親実行 ID</td>
    </tr>
  </tbody>
</table>

**モデレーショントレース情報**

* message\_id：メッセージ ID
* user\_id：ユーザーID
* workflow\_app\_log\_id：ワークフローアプリケーションログ ID
* inputs：モデレーションの入力データ
* message\_data：メッセージデータ
* flagged：コンテンツに注意が必要かどうか
* action：実行された具体的なアクション
* preset\_response：プリセット応答
* start\_time：モデレーション開始時間
* end\_time：モデレーション終了時間
* メタデータ
  * message\_id：メッセージ ID
  * action：実行された具体的なアクション
  * preset\_response：プリセット応答

#### 提案された質問トレース情報

提案された質問を追跡するために使用されます。
