@mastra/deepeval 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +91 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @mastra/deepeval
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added the `@mastra/deepeval` observability exporter to send Mastra traces to Confident AI for evaluation and monitoring. ([#20599](https://github.com/mastra-ai/mastra/pull/20599))
|
|
8
|
+
|
|
9
|
+
Register it in your Mastra observability config:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Mastra } from '@mastra/core';
|
|
13
|
+
import { Observability } from '@mastra/observability';
|
|
14
|
+
import { DeepEvalExporter } from '@mastra/deepeval';
|
|
15
|
+
|
|
16
|
+
export const mastra = new Mastra({
|
|
17
|
+
observability: new Observability({
|
|
18
|
+
configs: {
|
|
19
|
+
deepeval: {
|
|
20
|
+
serviceName: 'my-service',
|
|
21
|
+
exporters: [new DeepEvalExporter()],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Set `CONFIDENT_API_KEY` (and optionally `CONFIDENT_TRACE_ENVIRONMENT`) to send traces. Mastra spans map to Confident AI's `AGENT`, `LLM`, `TOOL`, `RETRIEVER`, and `CUSTOM` span types, with model, token counts, tool calls, and metric collections carried through.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`89200ba`](https://github.com/mastra-ai/mastra/commit/89200bafa05444bb7949b363ce7b743e29867561), [`c950138`](https://github.com/mastra-ai/mastra/commit/c950138e72e4f317a40187e3800588731ab790ce), [`063c8b2`](https://github.com/mastra-ai/mastra/commit/063c8b2eb14e4e5ca021779bc33e8c3c031c8604), [`f4e964c`](https://github.com/mastra-ai/mastra/commit/f4e964cad57057301d6bed5c55bcdd730175b941), [`1f7bbd7`](https://github.com/mastra-ai/mastra/commit/1f7bbd7785a8d230aad02454ecabeb4a0b2cc96f), [`e47ff36`](https://github.com/mastra-ai/mastra/commit/e47ff36945720f4ee4caa09f6e83514d7d188608), [`fb9a6ac`](https://github.com/mastra-ai/mastra/commit/fb9a6ac11c9560518742ece60b49d6b062845fd3), [`aa2cec8`](https://github.com/mastra-ai/mastra/commit/aa2cec8501f634d51c2f3ebfb3dd3aa7af8d2ca2), [`2adf8eb`](https://github.com/mastra-ai/mastra/commit/2adf8eb4a70ed2b6cff2dd39281496ea0e025fac), [`8264611`](https://github.com/mastra-ai/mastra/commit/8264611510e421b818bc7395dc2ae4d9c2d518b2), [`44fc98b`](https://github.com/mastra-ai/mastra/commit/44fc98b9d1242aa87a3ab44bdce9e9f12c44d8c9), [`0f2ef41`](https://github.com/mastra-ai/mastra/commit/0f2ef4118da022e4f30dac4e9856cc3a8c97671c)]:
|
|
33
|
+
- @mastra/core@1.57.0-alpha.1
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @mastra/deepeval
|
|
2
|
+
|
|
3
|
+
[Confident AI](https://www.confident-ai.com/) observability exporter for Mastra applications. Sends your Mastra traces to Confident AI for evaluation and monitoring, built on the DeepEval SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/deepeval
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Zero-Config Setup
|
|
14
|
+
|
|
15
|
+
The exporter automatically reads credentials from environment variables:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Required
|
|
19
|
+
CONFIDENT_API_KEY=confident_...
|
|
20
|
+
|
|
21
|
+
# Optional
|
|
22
|
+
CONFIDENT_TRACE_ENVIRONMENT=production # Defaults to "development"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { Observability } from '@mastra/observability';
|
|
27
|
+
import { DeepEvalExporter } from '@mastra/deepeval';
|
|
28
|
+
|
|
29
|
+
const mastra = new Mastra({
|
|
30
|
+
...,
|
|
31
|
+
observability: new Observability({
|
|
32
|
+
configs: {
|
|
33
|
+
deepeval: {
|
|
34
|
+
serviceName: 'my-service',
|
|
35
|
+
exporters: [new DeepEvalExporter()],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Explicit Configuration
|
|
43
|
+
|
|
44
|
+
You can also pass credentials directly:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { Observability } from '@mastra/observability';
|
|
48
|
+
import { DeepEvalExporter } from '@mastra/deepeval';
|
|
49
|
+
|
|
50
|
+
const mastra = new Mastra({
|
|
51
|
+
...,
|
|
52
|
+
observability: new Observability({
|
|
53
|
+
configs: {
|
|
54
|
+
deepeval: {
|
|
55
|
+
serviceName: 'my-service',
|
|
56
|
+
exporters: [
|
|
57
|
+
new DeepEvalExporter({
|
|
58
|
+
apiKey: 'confident_...',
|
|
59
|
+
environment: 'production',
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Configuration Options
|
|
69
|
+
|
|
70
|
+
| Option | Type | Description |
|
|
71
|
+
| ------------------------- | ------------------------ | ----------------------------------------------------------------------------- |
|
|
72
|
+
| `apiKey` | `string` | Confident AI API key. Defaults to the `CONFIDENT_API_KEY` env var |
|
|
73
|
+
| `environment` | `string` | Trace environment. Defaults to `CONFIDENT_TRACE_ENVIRONMENT` or `development` |
|
|
74
|
+
| `name` | `string` | Trace name. Defaults to the Mastra `serviceName` |
|
|
75
|
+
| `tags` | `string[]` | Tags applied to every trace |
|
|
76
|
+
| `metadata` | `Record<string, any>` | Metadata applied to every trace |
|
|
77
|
+
| `metricCollection` | `string` | Trace-level metric collection |
|
|
78
|
+
| `llmMetricCollection` | `string` | Metric collection applied to LLM spans |
|
|
79
|
+
| `agentMetricCollection` | `string` | Metric collection applied to agent spans |
|
|
80
|
+
| `toolMetricCollectionMap` | `Record<string, string>` | Metric collection applied per tool name |
|
|
81
|
+
| `traceCaptureSink` | `(trace) => void` | Receives completed traces locally instead of posting (for offline evaluation) |
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
### Tracing
|
|
86
|
+
|
|
87
|
+
- **Native Confident AI spans**: Mastra spans become `LLM`, `TOOL`, `RETRIEVER`, `AGENT`, and `CUSTOM` spans
|
|
88
|
+
- **Type-specific fields**: Extracts model, token counts, tool calls, and per-type metadata
|
|
89
|
+
- **Error tracking**: Automatic error status and message tracking
|
|
90
|
+
- **Hierarchical traces**: Maintains parent-child relationships and posts the trace once the root span ends
|
|
91
|
+
- **Metric collections**: Attach Confident AI metric collections at the trace and per-span-type level
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mastra/deepeval",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "DeepEval (Confident AI) observability provider for Mastra - includes tracing and future observability features",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"CHANGELOG.md"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup --silent --config tsup.config.ts",
|
|
27
|
+
"build:watch": "pnpm build --watch",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest watch",
|
|
30
|
+
"lint": "eslint ."
|
|
31
|
+
},
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@mastra/observability": "workspace:*",
|
|
35
|
+
"deepeval": "^0.1.32"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@internal/lint": "workspace:*",
|
|
39
|
+
"@internal/types-builder": "workspace:*",
|
|
40
|
+
"@mastra/core": "workspace:*",
|
|
41
|
+
"@types/node": "22.20.1",
|
|
42
|
+
"@vitest/coverage-v8": "catalog:",
|
|
43
|
+
"@vitest/ui": "catalog:",
|
|
44
|
+
"eslint": "^10.4.1",
|
|
45
|
+
"tsup": "^8.5.1",
|
|
46
|
+
"typescript": "catalog:",
|
|
47
|
+
"vitest": "catalog:"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@mastra/core": ">=1.16.0-0 <2.0.0-0"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://mastra.ai",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
56
|
+
"directory": "observability/deepeval"
|
|
57
|
+
},
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=22.13.0"
|
|
63
|
+
}
|
|
64
|
+
}
|