@mastra/evals 0.1.13-alpha.0 → 0.1.13-alpha.1
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/dist/index.cjs +5 -1
- package/dist/index.js +5 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var core = require('@mastra/core');
|
|
4
4
|
var hooks = require('@mastra/core/hooks');
|
|
5
5
|
var storage = require('@mastra/core/storage');
|
|
6
|
+
var utils = require('@mastra/core/utils');
|
|
6
7
|
|
|
7
8
|
// src/constants.ts
|
|
8
9
|
var GLOBAL_RUN_ID_ENV_KEY = "_MASTRA_GLOBAL_RUN_ID_";
|
|
@@ -58,12 +59,15 @@ async function attachListeners(mastra) {
|
|
|
58
59
|
}
|
|
59
60
|
hooks.registerHook(hooks.AvailableHooks.ON_EVALUATION, async (traceObject) => {
|
|
60
61
|
if (mastra?.storage) {
|
|
62
|
+
const logger = mastra?.getLogger();
|
|
63
|
+
const areFieldsValid = utils.checkEvalStorageFields(traceObject, logger);
|
|
64
|
+
if (!areFieldsValid) return;
|
|
61
65
|
await mastra.storage.insert({
|
|
62
66
|
tableName: storage.TABLE_EVALS,
|
|
63
67
|
record: {
|
|
64
68
|
input: traceObject.input,
|
|
65
69
|
output: traceObject.output,
|
|
66
|
-
result: JSON.stringify(traceObject.result),
|
|
70
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
67
71
|
agent_name: traceObject.agentName,
|
|
68
72
|
metric_name: traceObject.metricName,
|
|
69
73
|
instructions: traceObject.instructions,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { evaluate as evaluate$1 } from '@mastra/core';
|
|
2
2
|
import { registerHook, AvailableHooks } from '@mastra/core/hooks';
|
|
3
3
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
4
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
4
5
|
|
|
5
6
|
// src/constants.ts
|
|
6
7
|
var GLOBAL_RUN_ID_ENV_KEY = "_MASTRA_GLOBAL_RUN_ID_";
|
|
@@ -56,12 +57,15 @@ async function attachListeners(mastra) {
|
|
|
56
57
|
}
|
|
57
58
|
registerHook(AvailableHooks.ON_EVALUATION, async (traceObject) => {
|
|
58
59
|
if (mastra?.storage) {
|
|
60
|
+
const logger = mastra?.getLogger();
|
|
61
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
62
|
+
if (!areFieldsValid) return;
|
|
59
63
|
await mastra.storage.insert({
|
|
60
64
|
tableName: TABLE_EVALS,
|
|
61
65
|
record: {
|
|
62
66
|
input: traceObject.input,
|
|
63
67
|
output: traceObject.output,
|
|
64
|
-
result: JSON.stringify(traceObject.result),
|
|
68
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
65
69
|
agent_name: traceObject.agentName,
|
|
66
70
|
metric_name: traceObject.metricName,
|
|
67
71
|
instructions: traceObject.instructions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/evals",
|
|
3
|
-
"version": "0.1.13-alpha.
|
|
3
|
+
"version": "0.1.13-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"sentiment": "^5.0.2",
|
|
63
63
|
"string-similarity": "^4.0.4",
|
|
64
64
|
"zod": "^3.24.2",
|
|
65
|
-
"@mastra/core": "^0.6.4-alpha.
|
|
65
|
+
"@mastra/core": "^0.6.4-alpha.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"ai": "^4.0.0"
|