create-mastra 0.2.2-alpha.0 → 0.2.2
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.js +46 -25
- package/dist/index.js.map +1 -1
- package/dist/templates/dev.entry.js +7 -2
- package/package.json +2 -2
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { evaluate } from '@mastra/core/eval';
|
|
4
4
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
5
5
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
6
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
6
7
|
import { mastra } from '#mastra';
|
|
7
8
|
import { createNodeServer } from '#server';
|
|
8
|
-
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
await createNodeServer(mastra, { playground: true, swaggerUI: true });
|
|
11
11
|
|
|
@@ -23,12 +23,17 @@ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agen
|
|
|
23
23
|
|
|
24
24
|
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
25
25
|
if (mastra.storage) {
|
|
26
|
+
// Check for required fields
|
|
27
|
+
const logger = mastra?.getLogger();
|
|
28
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
29
|
+
if (!areFieldsValid) return;
|
|
30
|
+
|
|
26
31
|
await mastra.storage.insert({
|
|
27
32
|
tableName: TABLE_EVALS,
|
|
28
33
|
record: {
|
|
29
34
|
input: traceObject.input,
|
|
30
35
|
output: traceObject.output,
|
|
31
|
-
result: JSON.stringify(traceObject.result),
|
|
36
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
32
37
|
agent_name: traceObject.agentName,
|
|
33
38
|
metric_name: traceObject.metricName,
|
|
34
39
|
instructions: traceObject.instructions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mastra",
|
|
3
|
-
"version": "0.2.2
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Create Mastra apps with one command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
53
53
|
"typescript": "^5.8.2",
|
|
54
54
|
"@internal/lint": "0.0.1",
|
|
55
|
-
"mastra": "^0.4.3
|
|
55
|
+
"mastra": "^0.4.3"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=20"
|