@mastra/memory 1.0.0-beta.11 → 1.0.0-beta.12
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 +8 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/agents/02-networks.md +56 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`08766f1`](https://github.com/mastra-ai/mastra/commit/08766f15e13ac0692fde2a8bd366c2e16e4321df), [`ae8baf7`](https://github.com/mastra-ai/mastra/commit/ae8baf7d8adcb0ff9dac11880400452bc49b33ff), [`cfabdd4`](https://github.com/mastra-ai/mastra/commit/cfabdd4aae7a726b706942d6836eeca110fb6267), [`3bf08bf`](https://github.com/mastra-ai/mastra/commit/3bf08bf9c7c73818ac937b5a69d90e205653115f), [`a0e437f`](https://github.com/mastra-ai/mastra/commit/a0e437fac561b28ee719e0302d72b2f9b4c138f0), [`bec5efd`](https://github.com/mastra-ai/mastra/commit/bec5efde96653ccae6604e68c696d1bc6c1a0bf5), [`9eedf7d`](https://github.com/mastra-ai/mastra/commit/9eedf7de1d6e0022a2f4e5e9e6fe1ec468f9b43c)]:
|
|
8
|
+
- @mastra/core@1.0.0-beta.21
|
|
9
|
+
- @mastra/schema-compat@1.0.0-beta.6
|
|
10
|
+
|
|
3
11
|
## 1.0.0-beta.11
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -228,6 +228,62 @@ tool-execution-end
|
|
|
228
228
|
network-execution-event-step-finish
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
+
## Structured output
|
|
232
|
+
|
|
233
|
+
When you need typed, validated results from a network, use the `structuredOutput` option. After the network completes its task, it generates a structured response matching your schema.
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { z } from "zod";
|
|
237
|
+
|
|
238
|
+
const resultSchema = z.object({
|
|
239
|
+
summary: z.string().describe("A brief summary of the findings"),
|
|
240
|
+
recommendations: z.array(z.string()).describe("List of recommendations"),
|
|
241
|
+
confidence: z.number().min(0).max(1).describe("Confidence score"),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const stream = await routingAgent.network("Research AI trends", {
|
|
245
|
+
structuredOutput: {
|
|
246
|
+
schema: resultSchema,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// Consume the stream
|
|
251
|
+
for await (const chunk of stream) {
|
|
252
|
+
if (chunk.type === "network-object") {
|
|
253
|
+
// Partial object during generation
|
|
254
|
+
console.log("Partial:", chunk.payload.object);
|
|
255
|
+
}
|
|
256
|
+
if (chunk.type === "network-object-result") {
|
|
257
|
+
// Final structured object
|
|
258
|
+
console.log("Final:", chunk.payload.object);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Get the typed result
|
|
263
|
+
const result = await stream.object;
|
|
264
|
+
console.log(result?.summary);
|
|
265
|
+
console.log(result?.recommendations);
|
|
266
|
+
console.log(result?.confidence);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Streaming partial objects
|
|
270
|
+
|
|
271
|
+
For real-time updates during structured output generation, use `objectStream`:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const stream = await routingAgent.network("Analyze market data", {
|
|
275
|
+
structuredOutput: { schema: resultSchema },
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Stream partial objects as they're generated
|
|
279
|
+
for await (const partial of stream.objectStream) {
|
|
280
|
+
console.log("Building result:", partial);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Get the final typed result
|
|
284
|
+
const final = await stream.object;
|
|
285
|
+
```
|
|
286
|
+
|
|
231
287
|
## Related
|
|
232
288
|
|
|
233
289
|
- [Agent Memory](./agent-memory)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"json-schema": "^0.4.0",
|
|
32
32
|
"lru-cache": "^11.2.2",
|
|
33
33
|
"xxhash-wasm": "^1.1.0",
|
|
34
|
-
"@mastra/schema-compat": "1.0.0-beta.
|
|
34
|
+
"@mastra/schema-compat": "1.0.0-beta.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@ai-sdk/openai": "^1.3.24",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"typescript-eslint": "^8.51.0",
|
|
48
48
|
"vitest": "4.0.16",
|
|
49
49
|
"@internal/ai-sdk-v4": "0.0.0",
|
|
50
|
+
"@internal/ai-sdk-v5": "0.0.0",
|
|
50
51
|
"@internal/ai-v6": "0.0.0",
|
|
51
|
-
"@internal/types-builder": "0.0.28",
|
|
52
52
|
"@internal/lint": "0.0.53",
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
53
|
+
"@mastra/core": "1.0.0-beta.21",
|
|
54
|
+
"@internal/types-builder": "0.0.28"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0",
|