From 1038ecfce15ea1fde688cf9d68c421f260ca389d Mon Sep 17 00:00:00 2001 From: AllenWriter Date: Wed, 30 Apr 2025 11:54:45 +0800 Subject: [PATCH] Docs: update Weave --- docs.json | 8 +- .../integrate-weave.mdx | 334 +++++++++++++++++ .../integrate-weave.mdx | 336 ++++++++++++++++++ .../integrate-weave.mdx | 334 +++++++++++++++++ 4 files changed, 1009 insertions(+), 3 deletions(-) create mode 100644 en/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx create mode 100644 ja-jp/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx create mode 100644 zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx diff --git a/docs.json b/docs.json index 3fbf1f0b..5e548ade 100644 --- a/docs.json +++ b/docs.json @@ -208,7 +208,8 @@ "en/guides/monitoring/integrate-external-ops-tools/README", "en/guides/monitoring/integrate-external-ops-tools/integrate-langsmith", "en/guides/monitoring/integrate-external-ops-tools/integrate-langfuse", - "en/guides/monitoring/integrate-external-ops-tools/integrate-opik" + "en/guides/monitoring/integrate-external-ops-tools/integrate-opik", + "en/guides/monitoring/integrate-external-ops-tools/integrate-weave" ] } ] @@ -697,7 +698,8 @@ "zh-hans/guides/monitoring/integrate-external-ops-tools/readme", "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-langfuse", "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-langsmith", - "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik" + "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik", + "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-weave" ] }, "zh-hans/guides/monitoring/analysis" @@ -993,7 +995,7 @@ }, "ja-jp/getting-started/cloud", { - "group": "Dify 社区版", + "group": "Dify コミュニティ版", "pages": [ "ja-jp/getting-started/install-self-hosted/README", "ja-jp/getting-started/install-self-hosted/docker-compose", diff --git a/en/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx b/en/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx new file mode 100644 index 00000000..2fa55572 --- /dev/null +++ b/en/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx @@ -0,0 +1,334 @@ +--- +title: Integrate W&B Weave +description: SaaS | Community version ≥ v1.3.1 +--- + +### What is W&b Weave + +Weights & Biases (W&B) Weave is a framework for tracking, experimenting with, evaluating, deploying, and improving LLM-based applications. Designed for flexibility and scalability, Weave supports every stage of your LLM application development workflow: + + + For more details, please refer to [Weave](https://weave-docs.wandb.ai/). + + +*** + +### How to Configure Weave + +#### 1. Register/Login + +Register/Login to [W&B Weave](https://wandb.ai/signup) and get your API key. Then, copy your API key from [here](https://wandb.ai/authorize). + +#### 2. Integrating W&B Weave with Dify + +Configure Weave in the Dify application. Open the application you need to monitor, open **Monitoring** in the side menu, and select **Tracing app performance** on the page. + +![](https://assets-docs.dify.ai/2025/04/c33e8fda75ee9052ed23c8690e314862.png) + +After clicking configure, paste the **API Key** and **project name**, also specify the **W&B entity**(optionally, default is your username) into the configuration and save. + +![](https://assets-docs.dify.ai/2025/04/60bce1ae7b883825b13526d172ae0073.png) + +Once successfully saved, you can view the monitoring status on the current page. + +![](https://assets-docs.dify.ai/2025/04/9486cee7bbb61f069842c9ea860e679c.png) + +### Viewing Monitoring Data in Weave + +Once configured, the debug or production data from applications within Dify can be monitored in Weave. + +![](https://assets-docs.dify.ai/2025/04/a1c5aa80325e6d0223d48a178393baec.png) + +When you switch to Weave, you can view detailed operation logs of Dify applications in the dashboard. + +![](https://assets-docs.dify.ai/2025/04/2cb04027c00b606029fcc26af2801bfe.png) + +Detailed LLM operation logs through Weave will help you optimize the performance of your Dify application. + +### Monitoring Data List + +#### **Workflow/Chatflow Trace Information** + +**Used to track workflows and chatflows** + +| Workflow | Weave Trace | +| ---------------------------------------- | ---------------------------- | +| workflow_app_log_id/workflow_run_id | id | +| user_session_id | placed in metadata | +| workflow_{id} | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| Model token consumption | usage_metadata | +| metadata | extra | +| error | error | +| workflow | tags | +| "conversation_id/none for workflow" | conversation_id in metadata | +| conversion_id | parent_run_id | + +**Workflow Trace Info** + +* workflow_id - Unique identifier of the workflow +* conversation_id - Conversation ID +* workflow_run_id - ID of the current run +* tenant_id - Tenant ID +* elapsed_time - Time taken for the current run +* status - Run status +* version - Workflow version +* total_tokens - Total tokens used in the current run +* file_list - List of processed files +* triggered_from - Source that triggered the current run +* workflow_run_inputs - Input data for the current run +* workflow_run_outputs - Output data for the current run +* error - Errors encountered during the current run +* query - Query used during the run +* workflow_app_log_id - Workflow application log ID +* message_id - Associated message ID +* start_time - Start time of the run +* end_time - End time of the run +* workflow node executions - Information about workflow node executions +* Metadata + * workflow_id - Unique identifier of the workflow + * conversation_id - Conversation ID + * workflow_run_id - ID of the current run + * tenant_id - Tenant ID + * elapsed_time - Time taken for the current run + * status - Run status + * version - Workflow version + * total_tokens - Total tokens used in the current run + * file_list - List of processed files + * triggered_from - Source that triggered the current run + +#### **Message Trace Information** + +**Used to track LLM-related conversations** + +| Chat | Weave Trace | +| -------------------------------- | ---------------------------- | +| message_id | id | +| user_session_id | placed in metadata | +| “message_{id}" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| Model token consumption | usage_metadata | +| metadata | extra | +| error | error | +| "message", conversation_mode | tags | +| conversation_id | conversation_id in metadata | +| conversion_id | parent_run_id | + +**Message Trace Info** + +* message_id - Message ID +* message_data - Message data +* user_session_id - User session ID +* conversation_model - Conversation mode +* message_tokens - Number of tokens in the message +* answer_tokens - Number of tokens in the answer +* total_tokens - Total number of tokens in the message and answer +* error - Error information +* inputs - Input data +* outputs - Output data +* file_list - List of processed files +* start_time - Start time +* end_time - End time +* message_file_data - File data associated with the message +* conversation_mode - Conversation mode +* Metadata + * conversation_id - Conversation ID + * ls_provider - Model provider + * ls_model_name - Model ID + * status - Message status + * from_end_user_id - ID of the sending user + * from_account_id - ID of the sending account + * agent_based - Whether the message is agent-based + * workflow_run_id - Workflow run ID + * from_source - Message source + +#### **Moderation Trace Information** + +**Used to track conversation moderation** + +| Moderation | Weave Trace | +| ------------- | -------------------- | +| user_id | placed in metadata | +| “moderation" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| moderation | tags | +| message_id | parent_run_id | + +**Moderation Trace Info** + +* message_id - Message ID +* user_id: User ID +* workflow_app_log_id - Workflow application log ID +* inputs - Moderation input data +* message_data - Message data +* flagged - Whether the content is flagged for attention +* action - Specific actions taken +* preset_response - Preset response +* start_time - Moderation start time +* end_time - Moderation end time +* Metadata + * message_id - Message ID + * action - Specific actions taken + * preset_response - Preset response + +#### **Suggested Question Trace Information** + +**Used to track suggested questions** + +| Suggested Question | Weave Trace | +| ---------------------- | -------------------- | +| user_id | placed in metadata | +| suggested_question | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| suggested_question | tags | +| message_id | parent_run_id | + +**Message Trace Info** + +* message_id - Message ID +* message_data - Message data +* inputs - Input content +* outputs - Output content +* start_time - Start time +* end_time - End time +* total_tokens - Number of tokens +* status - Message status +* error - Error information +* from_account_id - ID of the sending account +* agent_based - Whether the message is agent-based +* from_source - Message source +* model_provider - Model provider +* model_id - Model ID +* suggested_question - Suggested question +* level - Status level +* status_message - Status message +* Metadata + * message_id - Message ID + * ls_provider - Model provider + * ls_model_name - Model ID + * status - Message status + * from_end_user_id - ID of the sending user + * from_account_id - ID of the sending account + * workflow_run_id - Workflow run ID + * from_source - Message source + +#### **Dataset Retrieval Trace Information** + +**Used to track knowledge base retrieval** + +| Dataset Retrieval | Weave Trace | +| --------------------- | -------------------- | +| user_id | placed in metadata | +| dataset_retrieval | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| dataset_retrieval | tags | +| message_id | parent_run_id | + +**Dataset Retrieval Trace Info** + +* message_id - Message ID +* inputs - Input content +* documents - Document data +* start_time - Start time +* end_time - End time +* message_data - Message data +* Metadata + * message_id - Message ID + * ls_provider - Model provider + * ls_model_name - Model ID + * status - Message status + * from_end_user_id - ID of the sending user + * from_account_id - ID of the sending account + * agent_based - Whether the message is agent-based + * workflow_run_id - Workflow run ID + * from_source - Message source + +#### **Tool Trace Information** + +**Used to track tool invocation** + +| Tool | Weave Trace | +| --------------------- | -------------------- | +| user_id | placed in metadata | +| tool_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| "tool", tool_name | tags | +| message_id | parent_run_id | + +#### **Tool Trace Info** + +* message_id - Message ID +* tool_name - Tool name +* start_time - Start time +* end_time - End time +* tool_inputs - Tool inputs +* tool_outputs - Tool outputs +* message_data - Message data +* error - Error information, if any +* inputs - Inputs for the message +* outputs - Outputs of the message +* tool_config - Tool configuration +* time_cost - Time cost +* tool_parameters - Tool parameters +* file_url - URL of the associated file +* Metadata + * message_id - Message ID + * tool_name - Tool name + * tool_inputs - Tool inputs + * tool_outputs - Tool outputs + * tool_config - Tool configuration + * time_cost - Time cost + * error - Error information, if any + * tool_parameters - Tool parameters + * message_file_id - Message file ID + * created_by_role - Role of the creator + * created_user_id - User ID of the creator + +**Generate Name Trace Information** + +**Used to track conversation title generation** + +| Generate Name | Weave Trace | +| ----------------- | -------------------- | +| user_id | placed in metadata | +| generate_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| generate_name | tags | + +**Generate Name Trace Info** + +* conversation_id - Conversation ID +* inputs - Input data +* outputs - Generated conversation name +* start_time - Start time +* end_time - End time +* tenant_id - Tenant ID +* Metadata + * conversation_id - Conversation ID + * tenant_id - Tenant ID diff --git a/ja-jp/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx b/ja-jp/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx new file mode 100644 index 00000000..3f6e9e98 --- /dev/null +++ b/ja-jp/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx @@ -0,0 +1,336 @@ +--- +title: W&B Weaveの統合 +description: SaaS | コミュニティ版 ≥ v1.3.1 +--- + +### W&B Weaveとは + +Weights & Biases (W&B) Weaveは、LLMベースのアプリケーションの追跡、実験、評価、デプロイ、改善のためのフレームワークです。柔軟性とスケーラビリティを考慮して設計されたWeaveは、LLMアプリケーション開発ワークフローのあらゆる段階をサポートします: + + + 詳細については、[Weave](https://weave-docs.wandb.ai/)を参照してください。 + + +*** + +### Weaveの設定方法 + +#### 1. [W&B Weave](https://wandb.ai/signup)に登録/ログイン + +APIキーを取得する + +次に、https://wandb.ai でWeights & Biases (W&B)アカウントを作成し、https://wandb.ai/authorize からAPIキーをコピーします + +#### 2. W&B WeaveをDifyと統合する + +DifyアプリケーションでWeaveを設定します。監視が必要なアプリケーションを開き、サイドメニューの**モニタリング**を開き、ページ上の**アプリケーションパフォーマンスの追跡**を選択します。 + +![](https://assets-docs.dify.ai/2025/04/c33e8fda75ee9052ed23c8690e314862.png) + +設定をクリックした後、**APIキー**と**プロジェクト名**を貼り付け、**W&Bエンティティ**(オプション、デフォルトはユーザー名)も指定して設定を保存します。 + +![](https://assets-docs.dify.ai/2025/04/60bce1ae7b883825b13526d172ae0073.png) + +正常に保存されると、現在のページで監視状態を確認できます。 + +![](https://assets-docs.dify.ai/2025/04/9486cee7bbb61f069842c9ea860e679c.png) + +### Weaveでモニタリングデータを表示する + +設定が完了すると、Dify内のアプリケーションからのデバッグまたは本番データをWeaveで監視できます。 + +![](https://assets-docs.dify.ai/2025/04/a1c5aa80325e6d0223d48a178393baec.png) + +Weaveに切り替えると、ダッシュボードでDifyアプリケーションの詳細な操作ログを確認できます。 + +![](https://assets-docs.dify.ai/2025/04/2cb04027c00b606029fcc26af2801bfe.png) + +Weaveを通じた詳細なLLM操作ログは、Difyアプリケーションのパフォーマンスを最適化するのに役立ちます。 + +### モニタリングデータリスト + +#### **ワークフロー/チャットフロートレース情報** + +**ワークフローとチャットフローを追跡するために使用** + +| ワークフロー | Weaveトレース | +| ------------------------------------ | ---------------------------- | +| workflow_app_log_id/workflow_run_id | id | +| user_session_id | メタデータに配置 | +| workflow_{id} | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| モデルトークン消費量 | usage_metadata | +| metadata | extra | +| error | error | +| workflow | tags | +| "conversation_id/none for workflow" | メタデータ内のconversation_id | +| conversion_id | parent_run_id | + +**ワークフロートレース情報** + +* 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関連の会話を追跡するために使用** + +| チャット | Weaveトレース | +| ---------------------------------- | ----------------------------- | +| message_id | id | +| user_session_id | メタデータに配置 | +| "message_{id}" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| モデルトークン消費量 | usage_metadata | +| metadata | extra | +| error | error | +| "message", conversation_mode | tags | +| conversation_id | メタデータ内のconversation_id | +| conversion_id | parent_run_id | + +**メッセージトレース情報** + +* 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 - メッセージソース + +#### **モデレーショントレース情報** + +**会話モデレーションを追跡するために使用** + +| モデレーション | Weaveトレース | +| ------------- | ----------------------- | +| user_id | メタデータに配置 | +| "moderation" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| \[moderation] | tags | +| message_id | parent_run_id | + +**モデレーショントレース情報** + +* 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 - プリセット応答 + +#### **提案質問トレース情報** + +**提案された質問を追跡するために使用** + +| 提案質問 | Weaveトレース | +| ---------------------- | ----------------------- | +| user_id | メタデータに配置 | +| suggested_question | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| suggested_question | tags | +| message_id | parent_run_id | + +**メッセージトレース情報** + +* message_id - メッセージID +* message_data - メッセージデータ +* inputs - 入力内容 +* outputs - 出力内容 +* start_time - 開始時間 +* end_time - 終了時間 +* total_tokens - トークン数 +* status - メッセージステータス +* error - エラー情報 +* from_account_id - 送信アカウントのID +* agent_based - メッセージがエージェントベースかどうか +* from_source - メッセージソース +* model_provider - モデルプロバイダー +* model_id - モデルID +* suggested_question - 提案された質問 +* level - ステータスレベル +* status_message - ステータスメッセージ +* メタデータ + * message_id - メッセージID + * ls_provider - モデルプロバイダー + * ls_model_name - モデルID + * status - メッセージステータス + * from_end_user_id - 送信ユーザーのID + * from_account_id - 送信アカウントのID + * workflow_run_id - ワークフロー実行ID + * from_source - メッセージソース + +#### **データセット検索トレース情報** + +**ナレッジベース検索を追跡するために使用** + +| データセット検索 | Weaveトレース | +| --------------------- | ----------------------- | +| user_id | メタデータに配置 | +| dataset_retrieval | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| dataset_retrieval | tags | +| message_id | parent_run_id | + +**データセット検索トレース情報** + +* message_id - メッセージID +* inputs - 入力内容 +* documents - ドキュメントデータ +* start_time - 開始時間 +* end_time - 終了時間 +* message_data - メッセージデータ +* メタデータ + * message_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 - メッセージソース + +#### **ツールトレース情報** + +**ツール呼び出しを追跡するために使用** + +| ツール | Weaveトレース | +| --------------------- | ----------------------- | +| user_id | メタデータに配置 | +| tool_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| \["tool", tool_name] | tags | +| message_id | parent_run_id | + +#### **ツールトレース情報** + +* message_id - メッセージID +* tool_name - ツール名 +* start_time - 開始時間 +* end_time - 終了時間 +* tool_inputs - ツール入力 +* tool_outputs - ツール出力 +* message_data - メッセージデータ +* error - エラー情報(もしあれば) +* inputs - メッセージの入力 +* outputs - メッセージの出力 +* tool_config - ツール設定 +* time_cost - 時間コスト +* tool_parameters - ツールパラメータ +* file_url - 関連ファイルのURL +* メタデータ + * message_id - メッセージID + * tool_name - ツール名 + * tool_inputs - ツール入力 + * tool_outputs - ツール出力 + * tool_config - ツール設定 + * time_cost - 時間コスト + * error - エラー情報(もしあれば) + * tool_parameters - ツールパラメータ + * message_file_id - メッセージファイルID + * created_by_role - 作成者のロール + * created_user_id - 作成者のユーザーID + +**名前生成トレース情報** + +**会話タイトル生成を追跡するために使用** + +| 名前生成 | Weaveトレース | +| ----------------- | ----------------------- | +| user_id | メタデータに配置 | +| generate_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| generate_name | tags | + +**名前生成トレース情報** + +* conversation_id - 会話ID +* inputs - 入力データ +* outputs - 生成された会話名 +* start_time - 開始時間 +* end_time - 終了時間 +* tenant_id - テナントID +* メタデータ + * conversation_id - 会話ID + * tenant_id - テナントID diff --git a/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx b/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx new file mode 100644 index 00000000..45932b19 --- /dev/null +++ b/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-weave.mdx @@ -0,0 +1,334 @@ +--- +title: 集成 W&B Weave +description: SaaS | 社区版版本号 ≥ v1.3.1 +--- + +### 什么是 W&B Weave + +Weights & Biases (W&B) Weave 是一个用于跟踪、实验、评估、部署和改进基于 LLM 的应用程序的框架。Weave 专为灵活性和可扩展性而设计,支持 LLM 应用程序开发工作流的每个阶段: + + + 更多详情,请参考 [Weave](https://weave-docs.wandb.ai/)。 + + +*** + +### 如何配置 Weave + +#### 1. 注册/登录 + +前往 [W&B Weave](https://wandb.ai/signup) 注册/登录。创建一个 Weights & Biases (W&B) 账户,并在[此处](https://wandb.ai/authorize)复制 API 密钥。 + +#### 2. 将 W&B Weave 与 Dify 集成 + +在 Dify 应用程序中配置 Weave。打开需要监控的应用程序,在侧边菜单中打开**监控**,在页面上选择**跟踪应用性能**。 + +![](https://assets-docs.dify.ai/2025/04/c33e8fda75ee9052ed23c8690e314862.png) + +点击配置后,粘贴 **API 密钥**和**项目名称**,指定 **W&B 实体**(可选,默认为您的用户名)到配置中并保存。 + +![](https://assets-docs.dify.ai/2025/04/60bce1ae7b883825b13526d172ae0073.png) + +成功保存后,您可以在当前页面查看监控状态。 + +![](https://assets-docs.dify.ai/2025/04/9486cee7bbb61f069842c9ea860e679c.png) + +### 在 Weave 中查看监控数据 + +配置完成后,Dify 内应用的调试或生产数据可以在 Weave 中进行监控。 + +![](https://assets-docs.dify.ai/2025/04/a1c5aa80325e6d0223d48a178393baec.png) + +当您切换到 Weave 时,可以在仪表板中查看 Dify 应用程序的详细操作日志。 + +![](https://assets-docs.dify.ai/2025/04/2cb04027c00b606029fcc26af2801bfe.png) + +通过 Weave 获取的详细 LLM 操作日志将帮助您优化 Dify 应用程序的性能。 + +### 监控数据列表 + +#### **工作流/对话流追踪信息** + +**用于追踪工作流和对话流** + +| 工作流 | Weave 追踪 | +| ---------------------------------------- | ---------------------------- | +| workflow_app_log_id/workflow_run_id | id | +| user_session_id | 放置在元数据中 | +| workflow_{id} | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| 模型令牌消耗 | usage_metadata | +| metadata | extra | +| error | error | +| workflow | tags | +| "conversation_id/none for workflow" | 元数据中的 conversation_id | +| conversion_id | parent_run_id | + +**工作流追踪信息** + +* 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 相关的对话** + +| 聊天 | Weave 追踪 | +| -------------------------------- | ----------------------------- | +| message_id | id | +| user_session_id | 放置在元数据中 | +| "message_{id}" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| 模型令牌消耗 | usage_metadata | +| metadata | extra | +| error | error | +| "message", conversation_mode | tags | +| conversation_id | 元数据中的 conversation_id | +| conversion_id | parent_run_id | + +**消息追踪信息** + +* 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 - 消息来源 + +#### **审核追踪信息** + +**用于追踪对话审核** + +| 审核 | Weave 追踪 | +| ------------- | ---------------------- | +| user_id | 放置在元数据中 | +| "moderation" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| \[moderation] | tags | +| message_id | parent_run_id | + +**审核追踪信息** + +* 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 - 预设响应 + +#### **建议问题追踪信息** + +**用于追踪建议的问题** + +| 建议问题 | Weave 追踪 | +| ---------------------- | ---------------------- | +| user_id | 放置在元数据中 | +| suggested_question | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| suggested_question | tags | +| message_id | parent_run_id | + +**消息追踪信息** + +* message_id - 消息 ID +* message_data - 消息数据 +* inputs - 输入内容 +* outputs - 输出内容 +* start_time - 开始时间 +* end_time - 结束时间 +* total_tokens - 令牌数 +* status - 消息状态 +* error - 错误信息 +* from_account_id - 发送账户的 ID +* agent_based - 消息是否基于代理 +* from_source - 消息来源 +* model_provider - 模型提供商 +* model_id - 模型 ID +* suggested_question - 建议的问题 +* level - 状态级别 +* status_message - 状态消息 +* 元数据 + * message_id - 消息 ID + * ls_provider - 模型提供商 + * ls_model_name - 模型 ID + * status - 消息状态 + * from_end_user_id - 发送用户的 ID + * from_account_id - 发送账户的 ID + * workflow_run_id - 工作流运行 ID + * from_source - 消息来源 + +#### **数据集检索追踪信息** + +**用于追踪知识库检索** + +| 数据集检索 | Weave 追踪 | +| --------------------- | --------------------- | +| user_id | 放置在元数据中 | +| dataset_retrieval | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| dataset_retrieval | tags | +| message_id | parent_run_id | + +**数据集检索追踪信息** + +* message_id - 消息 ID +* inputs - 输入内容 +* documents - 文档数据 +* start_time - 开始时间 +* end_time - 结束时间 +* message_data - 消息数据 +* 元数据 + * message_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 - 消息来源 + +#### **工具追踪信息** + +**用于追踪工具调用** + +| 工具 | Weave 追踪 | +| --------------------- | ----------------------- | +| user_id | 放置在元数据中 | +| tool_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| \["tool", tool_name] | tags | +| message_id | parent_run_id | + +#### **工具追踪信息** + +* message_id - 消息 ID +* tool_name - 工具名称 +* start_time - 开始时间 +* end_time - 结束时间 +* tool_inputs - 工具输入 +* tool_outputs - 工具输出 +* message_data - 消息数据 +* error - 错误信息(如果有) +* inputs - 消息的输入 +* outputs - 消息的输出 +* tool_config - 工具配置 +* time_cost - 时间成本 +* tool_parameters - 工具参数 +* file_url - 关联文件的 URL +* 元数据 + * message_id - 消息 ID + * tool_name - 工具名称 + * tool_inputs - 工具输入 + * tool_outputs - 工具输出 + * tool_config - 工具配置 + * time_cost - 时间成本 + * error - 错误信息(如果有) + * tool_parameters - 工具参数 + * message_file_id - 消息文件 ID + * created_by_role - 创建者的角色 + * created_user_id - 创建者的用户 ID + +**生成名称追踪信息** + +**用于追踪对话标题生成** + +| 生成名称 | Weave 追踪 | +| ----------------- | ---------------------- | +| user_id | 放置在元数据中 | +| generate_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | extra | +| generate_name | tags | + +**生成名称追踪信息** + +* conversation_id - 对话 ID +* inputs - 输入数据 +* outputs - 生成的对话名称 +* start_time - 开始时间 +* end_time - 结束时间 +* tenant_id - 租户 ID +* 元数据 + * conversation_id - 对话 ID + * tenant_id - 租户 ID \ No newline at end of file