@mastra/dynamodb 0.0.0-rag-chunk-extract-llm-option-20250926183645 → 0.0.0-roamin-openaivoice-speak-options-passing-20250926163614
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 +3 -7
- package/dist/entities/index.d.ts +0 -15
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/score.d.ts +0 -15
- package/dist/entities/score.d.ts.map +1 -1
- package/dist/index.cjs +24 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -92
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/score/index.d.ts +0 -8
- package/dist/storage/domains/score/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +0 -9
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
|
4
4
|
import { MastraStorage, StoreOperations, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, LegacyEvalsStorage, TABLE_AI_SPANS, TABLE_RESOURCES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
|
|
5
5
|
import { Entity, Service } from 'electrodb';
|
|
6
6
|
import { MessageList } from '@mastra/core/agent';
|
|
7
|
-
import { saveScorePayloadSchema } from '@mastra/core/scores';
|
|
8
7
|
|
|
9
8
|
// src/storage/index.ts
|
|
10
9
|
|
|
@@ -371,10 +370,6 @@ var scoreEntity = new Entity({
|
|
|
371
370
|
type: "string",
|
|
372
371
|
required: false
|
|
373
372
|
},
|
|
374
|
-
spanId: {
|
|
375
|
-
type: "string",
|
|
376
|
-
required: false
|
|
377
|
-
},
|
|
378
373
|
runId: {
|
|
379
374
|
type: "string",
|
|
380
375
|
required: true
|
|
@@ -661,11 +656,6 @@ var scoreEntity = new Entity({
|
|
|
661
656
|
index: "gsi6",
|
|
662
657
|
pk: { field: "gsi6pk", composite: ["entity", "threadId"] },
|
|
663
658
|
sk: { field: "gsi6sk", composite: ["createdAt"] }
|
|
664
|
-
},
|
|
665
|
-
bySpan: {
|
|
666
|
-
index: "gsi7",
|
|
667
|
-
pk: { field: "gsi7pk", composite: ["entity", "traceId", "spanId"] },
|
|
668
|
-
sk: { field: "gsi7sk", composite: ["createdAt"] }
|
|
669
659
|
}
|
|
670
660
|
}
|
|
671
661
|
});
|
|
@@ -2186,47 +2176,34 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
|
|
|
2186
2176
|
}
|
|
2187
2177
|
}
|
|
2188
2178
|
async saveScore(score) {
|
|
2189
|
-
|
|
2190
|
-
try {
|
|
2191
|
-
validatedScore = saveScorePayloadSchema.parse(score);
|
|
2192
|
-
} catch (error) {
|
|
2193
|
-
throw new MastraError(
|
|
2194
|
-
{
|
|
2195
|
-
id: "STORAGE_DYNAMODB_STORE_SAVE_SCORE_FAILED",
|
|
2196
|
-
domain: ErrorDomain.STORAGE,
|
|
2197
|
-
category: ErrorCategory.THIRD_PARTY
|
|
2198
|
-
},
|
|
2199
|
-
error
|
|
2200
|
-
);
|
|
2201
|
-
}
|
|
2179
|
+
this.logger.debug("Saving score", { scorerId: score.scorerId, runId: score.runId });
|
|
2202
2180
|
const now = /* @__PURE__ */ new Date();
|
|
2203
2181
|
const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
2204
2182
|
const scoreData = {
|
|
2205
2183
|
entity: "score",
|
|
2206
2184
|
id: scoreId,
|
|
2207
|
-
scorerId:
|
|
2208
|
-
traceId:
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
threadId: validatedScore.threadId || "",
|
|
2185
|
+
scorerId: score.scorerId,
|
|
2186
|
+
traceId: score.traceId || "",
|
|
2187
|
+
runId: score.runId,
|
|
2188
|
+
scorer: typeof score.scorer === "string" ? score.scorer : JSON.stringify(score.scorer),
|
|
2189
|
+
preprocessStepResult: typeof score.preprocessStepResult === "string" ? score.preprocessStepResult : JSON.stringify(score.preprocessStepResult),
|
|
2190
|
+
analyzeStepResult: typeof score.analyzeStepResult === "string" ? score.analyzeStepResult : JSON.stringify(score.analyzeStepResult),
|
|
2191
|
+
score: score.score,
|
|
2192
|
+
reason: score.reason,
|
|
2193
|
+
preprocessPrompt: score.preprocessPrompt,
|
|
2194
|
+
generateScorePrompt: score.generateScorePrompt,
|
|
2195
|
+
analyzePrompt: score.analyzePrompt,
|
|
2196
|
+
reasonPrompt: score.reasonPrompt,
|
|
2197
|
+
input: typeof score.input === "string" ? score.input : JSON.stringify(score.input),
|
|
2198
|
+
output: typeof score.output === "string" ? score.output : JSON.stringify(score.output),
|
|
2199
|
+
additionalContext: typeof score.additionalContext === "string" ? score.additionalContext : JSON.stringify(score.additionalContext),
|
|
2200
|
+
runtimeContext: typeof score.runtimeContext === "string" ? score.runtimeContext : JSON.stringify(score.runtimeContext),
|
|
2201
|
+
entityType: score.entityType,
|
|
2202
|
+
entityData: typeof score.entity === "string" ? score.entity : JSON.stringify(score.entity),
|
|
2203
|
+
entityId: score.entityId,
|
|
2204
|
+
source: score.source,
|
|
2205
|
+
resourceId: score.resourceId || "",
|
|
2206
|
+
threadId: score.threadId || "",
|
|
2230
2207
|
createdAt: now.toISOString(),
|
|
2231
2208
|
updatedAt: now.toISOString()
|
|
2232
2209
|
};
|
|
@@ -2379,43 +2356,6 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
|
|
|
2379
2356
|
);
|
|
2380
2357
|
}
|
|
2381
2358
|
}
|
|
2382
|
-
async getScoresBySpan({
|
|
2383
|
-
traceId,
|
|
2384
|
-
spanId,
|
|
2385
|
-
pagination
|
|
2386
|
-
}) {
|
|
2387
|
-
this.logger.debug("Getting scores by span", { traceId, spanId, pagination });
|
|
2388
|
-
try {
|
|
2389
|
-
const query = this.service.entities.score.query.bySpan({ entity: "score", traceId, spanId });
|
|
2390
|
-
const results = await query.go();
|
|
2391
|
-
const allScores = results.data.map((data) => this.parseScoreData(data));
|
|
2392
|
-
allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
2393
|
-
const startIndex = pagination.page * pagination.perPage;
|
|
2394
|
-
const endIndex = startIndex + pagination.perPage;
|
|
2395
|
-
const paginatedScores = allScores.slice(startIndex, endIndex);
|
|
2396
|
-
const total = allScores.length;
|
|
2397
|
-
const hasMore = endIndex < total;
|
|
2398
|
-
return {
|
|
2399
|
-
scores: paginatedScores,
|
|
2400
|
-
pagination: {
|
|
2401
|
-
total,
|
|
2402
|
-
page: pagination.page,
|
|
2403
|
-
perPage: pagination.perPage,
|
|
2404
|
-
hasMore
|
|
2405
|
-
}
|
|
2406
|
-
};
|
|
2407
|
-
} catch (error) {
|
|
2408
|
-
throw new MastraError(
|
|
2409
|
-
{
|
|
2410
|
-
id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_SPAN_FAILED",
|
|
2411
|
-
domain: ErrorDomain.STORAGE,
|
|
2412
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
2413
|
-
details: { traceId, spanId, page: pagination.page, perPage: pagination.perPage }
|
|
2414
|
-
},
|
|
2415
|
-
error
|
|
2416
|
-
);
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
2359
|
};
|
|
2420
2360
|
var TracesStorageDynamoDB = class extends TracesStorage {
|
|
2421
2361
|
service;
|
|
@@ -2929,8 +2869,7 @@ var DynamoDBStore = class extends MastraStorage {
|
|
|
2929
2869
|
resourceWorkingMemory: true,
|
|
2930
2870
|
hasColumn: false,
|
|
2931
2871
|
createTable: false,
|
|
2932
|
-
deleteMessages: false
|
|
2933
|
-
getScoresBySpan: true
|
|
2872
|
+
deleteMessages: false
|
|
2934
2873
|
};
|
|
2935
2874
|
}
|
|
2936
2875
|
/**
|
|
@@ -3189,13 +3128,6 @@ var DynamoDBStore = class extends MastraStorage {
|
|
|
3189
3128
|
}) {
|
|
3190
3129
|
return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
|
|
3191
3130
|
}
|
|
3192
|
-
async getScoresBySpan({
|
|
3193
|
-
traceId,
|
|
3194
|
-
spanId,
|
|
3195
|
-
pagination
|
|
3196
|
-
}) {
|
|
3197
|
-
return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
|
|
3198
|
-
}
|
|
3199
3131
|
};
|
|
3200
3132
|
|
|
3201
3133
|
export { DynamoDBStore };
|