@mastra/lance 0.0.0-new-scorer-api-20250801075530 → 0.0.0-new-button-export-20251219130424
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 +1111 -3
- package/README.md +64 -7
- package/dist/index.cjs +1525 -1403
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1526 -1404
- package/dist/index.js.map +1 -1
- package/dist/storage/{domains/operations → db}/index.d.ts +21 -2
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/db/utils.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +23 -39
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +29 -9
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +28 -14
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +88 -109
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts +5 -5
- package/dist/vector/index.d.ts +8 -5
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +29 -11
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -25
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -34
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
- package/dist/storage/domains/utils.d.ts.map +0 -1
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -2
- package/src/storage/domains/legacy-evals/index.ts +0 -156
- package/src/storage/domains/memory/index.ts +0 -947
- package/src/storage/domains/operations/index.ts +0 -489
- package/src/storage/domains/scores/index.ts +0 -221
- package/src/storage/domains/traces/index.ts +0 -212
- package/src/storage/domains/utils.ts +0 -158
- package/src/storage/domains/workflows/index.ts +0 -207
- package/src/storage/index.test.ts +0 -10
- package/src/storage/index.ts +0 -442
- package/src/vector/filter.test.ts +0 -295
- package/src/vector/filter.ts +0 -443
- package/src/vector/index.test.ts +0 -1493
- package/src/vector/index.ts +0 -941
- package/src/vector/types.ts +0 -16
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -22
- package/vitest.config.ts +0 -11
- /package/dist/storage/{domains → db}/utils.d.ts +0 -0
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ const message = await storage.load({
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// Load messages from a thread
|
|
117
|
-
const messages = await storage.
|
|
117
|
+
const messages = await storage.listMessages({
|
|
118
118
|
threadId: '123e4567-e89b-12d3-a456-426614174001',
|
|
119
119
|
});
|
|
120
120
|
```
|
|
@@ -124,7 +124,7 @@ const messages = await storage.getMessages({
|
|
|
124
124
|
### Creating Threads
|
|
125
125
|
|
|
126
126
|
```typescript
|
|
127
|
-
import type { StorageThreadType } from '@mastra/core';
|
|
127
|
+
import type { StorageThreadType } from '@mastra/core/storage';
|
|
128
128
|
|
|
129
129
|
// Create a new thread
|
|
130
130
|
const thread: StorageThreadType = {
|
|
@@ -142,7 +142,7 @@ const savedThread = await storage.saveThread({ thread });
|
|
|
142
142
|
### Working with Messages
|
|
143
143
|
|
|
144
144
|
```typescript
|
|
145
|
-
import type { MessageType } from '@mastra/core';
|
|
145
|
+
import type { MessageType } from '@mastra/core/memory';
|
|
146
146
|
|
|
147
147
|
// Create messages
|
|
148
148
|
const messages: MessageType[] = [
|
|
@@ -175,10 +175,12 @@ const messages: MessageType[] = [
|
|
|
175
175
|
// Save messages
|
|
176
176
|
await storage.saveMessages({ messages });
|
|
177
177
|
|
|
178
|
-
// Retrieve messages with context
|
|
179
|
-
const retrievedMessages = await storage.
|
|
178
|
+
// Retrieve messages with pagination and context
|
|
179
|
+
const retrievedMessages = await storage.listMessages({
|
|
180
180
|
threadId: '123e4567-e89b-12d3-a456-426614174010',
|
|
181
|
-
|
|
181
|
+
perPage: 10,
|
|
182
|
+
page: 0,
|
|
183
|
+
include: [
|
|
182
184
|
{
|
|
183
185
|
id: 'msg-001',
|
|
184
186
|
withPreviousMessages: 5, // Include up to 5 messages before this one
|
|
@@ -193,7 +195,7 @@ const retrievedMessages = await storage.getMessages({
|
|
|
193
195
|
Mastra's workflow system uses LanceDB to persist workflow state for continuity across runs:
|
|
194
196
|
|
|
195
197
|
```typescript
|
|
196
|
-
import type { WorkflowRunState } from '@mastra/core';
|
|
198
|
+
import type { WorkflowRunState } from '@mastra/core/storage';
|
|
197
199
|
|
|
198
200
|
// Persist a workflow snapshot
|
|
199
201
|
await storage.persistWorkflowSnapshot({
|
|
@@ -261,3 +263,58 @@ await storage.clearTable({ tableName: TABLE_MESSAGES });
|
|
|
261
263
|
// Get table schema
|
|
262
264
|
const schema = await storage.getTableSchema(TABLE_MESSAGES);
|
|
263
265
|
```
|
|
266
|
+
|
|
267
|
+
## Storage Methods
|
|
268
|
+
|
|
269
|
+
### Thread Operations
|
|
270
|
+
|
|
271
|
+
- `saveThread({ thread })`: Create or update a thread
|
|
272
|
+
- `getThreadById({ threadId })`: Get a thread by ID
|
|
273
|
+
- `listThreadsByResourceId({ resourceId, offset, limit, orderBy? })`: List paginated threads for a resource
|
|
274
|
+
- `updateThread({ id, title, metadata })`: Update thread title and/or metadata
|
|
275
|
+
- `deleteThread({ threadId })`: Delete a thread and its messages
|
|
276
|
+
|
|
277
|
+
### Message Operations
|
|
278
|
+
|
|
279
|
+
- `saveMessages({ messages })`: Save multiple messages in a transaction
|
|
280
|
+
- `listMessages({ threadId, resourceId?, perPage?, page?, orderBy?, filter?, include? })`: Get messages for a thread with pagination and optional context inclusion
|
|
281
|
+
- `listMessagesById({ messageIds })`: Get specific messages by their IDs
|
|
282
|
+
- `updateMessages({ messages })`: Update existing messages
|
|
283
|
+
|
|
284
|
+
### Resource Operations
|
|
285
|
+
|
|
286
|
+
- `getResourceById({ resourceId })`: Get a resource by ID
|
|
287
|
+
- `saveResource({ resource })`: Create or save a resource
|
|
288
|
+
- `updateResource({ resourceId, workingMemory })`: Update resource working memory
|
|
289
|
+
|
|
290
|
+
### Workflow Operations
|
|
291
|
+
|
|
292
|
+
- `persistWorkflowSnapshot({ workflowName, runId, snapshot })`: Save workflow state
|
|
293
|
+
- `loadWorkflowSnapshot({ workflowName, runId })`: Load workflow state
|
|
294
|
+
- `listWorkflowRuns({ workflowName?, pagination? })`: List workflow runs with pagination
|
|
295
|
+
- `getWorkflowRunById({ runId, workflowName? })`: Get a specific workflow run
|
|
296
|
+
- `updateWorkflowState({ workflowName, runId, state })`: Update workflow state
|
|
297
|
+
- `updateWorkflowResults({ workflowName, runId, results })`: Update workflow results
|
|
298
|
+
|
|
299
|
+
### Evaluation/Scoring Operations
|
|
300
|
+
|
|
301
|
+
- `getScoreById({ id })`: Get a score by ID
|
|
302
|
+
- `saveScore(score)`: Save an evaluation score
|
|
303
|
+
- `listScoresByScorerId({ scorerId, pagination })`: List scores by scorer with pagination
|
|
304
|
+
- `listScoresByRunId({ runId, pagination })`: List scores by run with pagination
|
|
305
|
+
- `listScoresByEntityId({ entityId, entityType, pagination })`: List scores by entity with pagination
|
|
306
|
+
- `listScoresBySpan({ traceId, spanId, pagination })`: List scores by span with pagination
|
|
307
|
+
|
|
308
|
+
### Low-Level Operations
|
|
309
|
+
|
|
310
|
+
- `createTable({ tableName, schema })`: Create a new table with schema
|
|
311
|
+
- `dropTable({ tableName })`: Drop a table
|
|
312
|
+
- `clearTable({ tableName })`: Clear all records from a table
|
|
313
|
+
- `insert({ tableName, record })`: Insert a single record
|
|
314
|
+
- `batchInsert({ tableName, records })`: Insert multiple records
|
|
315
|
+
- `load({ tableName, keys })`: Load a record by keys
|
|
316
|
+
|
|
317
|
+
### Operations Not Currently Supported
|
|
318
|
+
|
|
319
|
+
- `deleteMessages(messageIds)`: Message deletion is not currently supported
|
|
320
|
+
- AI Observability (traces/spans): Not currently supported
|