@mastra/lance 0.3.2-alpha.0 → 0.3.3-alpha.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 +20 -0
- package/dist/index.cjs +63 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +8 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/lance
|
|
2
2
|
|
|
3
|
+
## 0.3.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update peer deps ([#8154](https://github.com/mastra-ai/mastra/pull/8154))
|
|
8
|
+
|
|
9
|
+
- Lance db support to fetch scores by trace and span id ([#8154](https://github.com/mastra-ai/mastra/pull/8154))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`a7243e2`](https://github.com/mastra-ai/mastra/commit/a7243e2e58762667a6e3921e755e89d6bb0a3282), [`7fceb0a`](https://github.com/mastra-ai/mastra/commit/7fceb0a327d678e812f90f5387c5bc4f38bd039e), [`df64f9e`](https://github.com/mastra-ai/mastra/commit/df64f9ef814916fff9baedd861c988084e7c41de), [`809eea0`](https://github.com/mastra-ai/mastra/commit/809eea092fa80c3f69b9eaf078d843b57fd2a88e), [`683e5a1`](https://github.com/mastra-ai/mastra/commit/683e5a1466e48b686825b2c11f84680f296138e4), [`3679378`](https://github.com/mastra-ai/mastra/commit/3679378673350aa314741dc826f837b1984149bc), [`7775bc2`](https://github.com/mastra-ai/mastra/commit/7775bc20bb1ad1ab24797fb420e4f96c65b0d8ec), [`db1891a`](https://github.com/mastra-ai/mastra/commit/db1891a4707443720b7cd8a260dc7e1d49b3609c), [`e8f379d`](https://github.com/mastra-ai/mastra/commit/e8f379d390efa264c4e0874f9ac0cf8839b07777), [`652066b`](https://github.com/mastra-ai/mastra/commit/652066bd1efc6bb6813ba950ed1d7573e8b7d9d4), [`ea8d386`](https://github.com/mastra-ai/mastra/commit/ea8d386cd8c5593664515fd5770c06bf2aa980ef), [`c2a4919`](https://github.com/mastra-ai/mastra/commit/c2a4919ba6797d8bdb1509e02287496eef69303e), [`0130986`](https://github.com/mastra-ai/mastra/commit/0130986fc62d0edcc626dd593282661dbb9af141)]:
|
|
12
|
+
- @mastra/core@0.19.0-alpha.1
|
|
13
|
+
|
|
14
|
+
## 0.3.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a)]:
|
|
21
|
+
- @mastra/core@0.18.0
|
|
22
|
+
|
|
3
23
|
## 0.3.2-alpha.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var error = require('@mastra/core/error');
|
|
|
5
5
|
var storage = require('@mastra/core/storage');
|
|
6
6
|
var agent = require('@mastra/core/agent');
|
|
7
7
|
var apacheArrow = require('apache-arrow');
|
|
8
|
+
var scores = require('@mastra/core/scores');
|
|
8
9
|
var vector = require('@mastra/core/vector');
|
|
9
10
|
var filter = require('@mastra/core/vector/filter');
|
|
10
11
|
|
|
@@ -1398,13 +1399,27 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1398
1399
|
this.client = client;
|
|
1399
1400
|
}
|
|
1400
1401
|
async saveScore(score) {
|
|
1402
|
+
let validatedScore;
|
|
1403
|
+
try {
|
|
1404
|
+
validatedScore = scores.saveScorePayloadSchema.parse(score);
|
|
1405
|
+
} catch (error$1) {
|
|
1406
|
+
throw new error.MastraError(
|
|
1407
|
+
{
|
|
1408
|
+
id: "LANCE_STORAGE_SAVE_SCORE_FAILED",
|
|
1409
|
+
text: "Failed to save score in LanceStorage",
|
|
1410
|
+
domain: error.ErrorDomain.STORAGE,
|
|
1411
|
+
category: error.ErrorCategory.THIRD_PARTY
|
|
1412
|
+
},
|
|
1413
|
+
error$1
|
|
1414
|
+
);
|
|
1415
|
+
}
|
|
1401
1416
|
try {
|
|
1402
1417
|
const id = crypto.randomUUID();
|
|
1403
1418
|
const table = await this.client.openTable(storage.TABLE_SCORERS);
|
|
1404
1419
|
const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
|
|
1405
1420
|
const allowedFields = new Set(schema.fields.map((f) => f.name));
|
|
1406
1421
|
const filteredScore = {};
|
|
1407
|
-
Object.keys(
|
|
1422
|
+
Object.keys(validatedScore).forEach((key) => {
|
|
1408
1423
|
if (allowedFields.has(key)) {
|
|
1409
1424
|
filteredScore[key] = score[key];
|
|
1410
1425
|
}
|
|
@@ -1580,6 +1595,44 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1580
1595
|
);
|
|
1581
1596
|
}
|
|
1582
1597
|
}
|
|
1598
|
+
async getScoresBySpan({
|
|
1599
|
+
traceId,
|
|
1600
|
+
spanId,
|
|
1601
|
+
pagination
|
|
1602
|
+
}) {
|
|
1603
|
+
try {
|
|
1604
|
+
const table = await this.client.openTable(storage.TABLE_SCORERS);
|
|
1605
|
+
const { page = 0, perPage = 10 } = pagination || {};
|
|
1606
|
+
const offset = page * perPage;
|
|
1607
|
+
const query = table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`).limit(perPage);
|
|
1608
|
+
if (offset > 0) query.offset(offset);
|
|
1609
|
+
const records = await query.toArray();
|
|
1610
|
+
const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
|
|
1611
|
+
const scores = processResultWithTypeConversion(records, schema);
|
|
1612
|
+
const allRecords = await table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`).toArray();
|
|
1613
|
+
const total = allRecords.length;
|
|
1614
|
+
return {
|
|
1615
|
+
pagination: {
|
|
1616
|
+
page,
|
|
1617
|
+
perPage,
|
|
1618
|
+
total,
|
|
1619
|
+
hasMore: offset + scores.length < total
|
|
1620
|
+
},
|
|
1621
|
+
scores
|
|
1622
|
+
};
|
|
1623
|
+
} catch (error$1) {
|
|
1624
|
+
throw new error.MastraError(
|
|
1625
|
+
{
|
|
1626
|
+
id: "LANCE_STORAGE_GET_SCORES_BY_SPAN_FAILED",
|
|
1627
|
+
text: "Failed to get scores by traceId and spanId in LanceStorage",
|
|
1628
|
+
domain: error.ErrorDomain.STORAGE,
|
|
1629
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
1630
|
+
details: { error: error$1?.message }
|
|
1631
|
+
},
|
|
1632
|
+
error$1
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1583
1636
|
};
|
|
1584
1637
|
var StoreTracesLance = class extends storage.TracesStorage {
|
|
1585
1638
|
client;
|
|
@@ -2072,7 +2125,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2072
2125
|
resourceWorkingMemory: true,
|
|
2073
2126
|
hasColumn: true,
|
|
2074
2127
|
createTable: true,
|
|
2075
|
-
deleteMessages: false
|
|
2128
|
+
deleteMessages: false,
|
|
2129
|
+
getScoresBySpan: true
|
|
2076
2130
|
};
|
|
2077
2131
|
}
|
|
2078
2132
|
async getResourceById({ resourceId }) {
|
|
@@ -2242,6 +2296,13 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2242
2296
|
}) {
|
|
2243
2297
|
return this.stores.scores.getScoresByEntityId({ entityId, entityType, pagination });
|
|
2244
2298
|
}
|
|
2299
|
+
async getScoresBySpan({
|
|
2300
|
+
traceId,
|
|
2301
|
+
spanId,
|
|
2302
|
+
pagination
|
|
2303
|
+
}) {
|
|
2304
|
+
return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
|
|
2305
|
+
}
|
|
2245
2306
|
};
|
|
2246
2307
|
var LanceFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
2247
2308
|
translate(filter) {
|