> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # Confident AI exporter [Confident AI](https://www.confident-ai.com/) は、開発環境と本番環境の両方で信頼性の高い AI アプリケーションを構築するチーム向けの LLM Observability・評価プラットフォームです。 `@mastra/deepeval` パッケージは Mastra の Trace を Confident AI に送信します。送信先では、Trace に対してメトリクスを実行し、時間の経過に伴う品質を追跡できます。このパッケージは、プラットフォームを支えるオープンソースの評価 SDK である [DeepEval](https://www.confident-ai.com/docs) を基盤としています。 ## インストール **npm**: ```bash npm install @mastra/deepeval@latest ``` **pnpm**: ```bash pnpm add @mastra/deepeval@latest ``` **Yarn**: ```bash yarn add @mastra/deepeval@latest ``` **Bun**: ```bash bun add @mastra/deepeval@latest ``` ## 設定 ### 前提条件 1. **Confident AI アカウント**: [confident-ai.com](https://www.confident-ai.com/) で登録する 2. **API key**: Confident AI の Project 設定で生成する 3. **環境変数**: 認証情報を設定する ```bash CONFIDENT_API_KEY=confident_proj_xxxxxxxxxxxxx # Optional CONFIDENT_TRACE_ENVIRONMENT=production # Defaults to "development" ``` ### ゼロコンフィグセットアップ 環境変数を設定すると、設定を渡さずに exporter を使用できます。 ```typescript import { Mastra } from '@mastra/core' import { Observability } from '@mastra/observability' import { DeepEvalExporter } from '@mastra/deepeval' export const mastra = new Mastra({ observability: new Observability({ configs: { deepeval: { serviceName: 'my-service', exporters: [new DeepEvalExporter()], }, }, }), }) ``` ### 明示的な設定 認証情報を直接渡すこともできます(環境変数より優先されます)。 ```typescript import { Mastra } from '@mastra/core' import { Observability } from '@mastra/observability' import { DeepEvalExporter } from '@mastra/deepeval' export const mastra = new Mastra({ observability: new Observability({ configs: { deepeval: { serviceName: 'my-service', exporters: [ new DeepEvalExporter({ apiKey: process.env.CONFIDENT_API_KEY, environment: 'production', }), ], }, }, }), }) ``` ### Metric collection Confident AI は、Project で定義された Metric collection を使用して、受信した Trace を評価します。Metric collection は Trace レベルまたは Span type ごとに関連付けます。Trace レベルのメトリクスは Trace 全体に対して実行され、Type ごとのメトリクスは一致する Span に対して実行されます。 ```typescript new DeepEvalExporter({ metricCollection: 'trace-metrics', // trace-level llmMetricCollection: 'llm-metrics', // applied to LLM spans agentMetricCollection: 'agent-metrics', // applied to agent spans toolMetricCollectionMap: { search: 'search-tool-metrics', // applied to the "search" tool }, }) ``` ### 完全な設定 ```typescript new DeepEvalExporter({ apiKey: process.env.CONFIDENT_API_KEY, environment: 'production', // Default: "development" name: 'my-trace', // Default: the Mastra serviceName tags: ['production'], metadata: { team: 'growth' }, }) ``` ## Span type のマッピング Mastra の Span は、Confident AI に表示される次の Span type にマッピングされます。 | Mastra Span type | Confident AI Span type | | ---------------------------------------------------------------------- | ---------------------- | | `AGENT_RUN`, `WORKFLOW_RUN` | `AGENT` | | `MODEL_GENERATION` | `LLM` | | `TOOL_CALL`, `MCP_TOOL_CALL`, `PROVIDER_TOOL_CALL`, `CLIENT_TOOL_CALL` | `TOOL` | | `RAG_EMBEDDING`, `RAG_VECTOR_OPERATION` | `RETRIEVER` | | その他のエクスポート対象 Span type | `CUSTOM` | ## 関連項目 - [Tracing の概要](https://mastra.zisheng.pro/ja/docs/observability/tracing/overview) - [DeepEvalExporter リファレンス](https://mastra.zisheng.pro/ja/reference/observability/tracing/exporters/confident-ai) - [Confident AI ドキュメント](https://www.confident-ai.com/docs)