@mastra/server 1.0.0-beta.7 → 1.0.0-beta.8

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.0.0-beta.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
8
+ - @mastra/core@1.0.0-beta.8
9
+
3
10
  ## 1.0.0-beta.7
4
11
 
5
12
  ### Patch Changes
@@ -15520,7 +15520,8 @@ ${workingMemory}`;
15520
15520
  messages: dbMessages
15521
15521
  });
15522
15522
  if (this.vector && config.semanticRecall) {
15523
- let indexName;
15523
+ const embeddingData = [];
15524
+ let dimension;
15524
15525
  await Promise.all(
15525
15526
  updatedMessages.map(async (message) => {
15526
15527
  let textForEmbedding = null;
@@ -15531,19 +15532,11 @@ ${workingMemory}`;
15531
15532
  if (joined) textForEmbedding = joined;
15532
15533
  }
15533
15534
  if (!textForEmbedding) return;
15534
- const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
15535
- if (typeof indexName === `undefined`) {
15536
- indexName = this.createEmbeddingIndex(dimension, config).then((result2) => result2.indexName);
15537
- }
15538
- if (typeof this.vector === `undefined`) {
15539
- throw new Error(
15540
- `Tried to upsert embeddings to index ${indexName} but this Memory instance doesn't have an attached vector db.`
15541
- );
15542
- }
15543
- await this.vector.upsert({
15544
- indexName: await indexName,
15545
- vectors: embeddings,
15546
- metadata: chunks.map(() => ({
15535
+ const result2 = await this.embedMessageContent(textForEmbedding);
15536
+ dimension = result2.dimension;
15537
+ embeddingData.push({
15538
+ embeddings: result2.embeddings,
15539
+ metadata: result2.chunks.map(() => ({
15547
15540
  message_id: message.id,
15548
15541
  thread_id: message.threadId,
15549
15542
  resource_id: message.resourceId
@@ -15551,6 +15544,23 @@ ${workingMemory}`;
15551
15544
  });
15552
15545
  })
15553
15546
  );
15547
+ if (embeddingData.length > 0 && dimension !== void 0) {
15548
+ if (typeof this.vector === `undefined`) {
15549
+ throw new Error(`Tried to upsert embeddings but this Memory instance doesn't have an attached vector db.`);
15550
+ }
15551
+ const { indexName } = await this.createEmbeddingIndex(dimension, config);
15552
+ const allVectors = [];
15553
+ const allMetadata = [];
15554
+ for (const data of embeddingData) {
15555
+ allVectors.push(...data.embeddings);
15556
+ allMetadata.push(...data.metadata);
15557
+ }
15558
+ await this.vector.upsert({
15559
+ indexName,
15560
+ vectors: allVectors,
15561
+ metadata: allMetadata
15562
+ });
15563
+ }
15554
15564
  }
15555
15565
  return result;
15556
15566
  }
@@ -18019,7 +18029,7 @@ var PackageMergeResultSchema = z19.z.object({
18019
18029
  error: z19.z.string().optional()
18020
18030
  });
18021
18031
  var InstallInputSchema = z19.z.object({
18022
- targetPath: z19.z.string().describe("Path to the project to install packages in")
18032
+ targetPath: z19.z.string().optional().describe("Path to the project to install packages in")
18023
18033
  });
18024
18034
  var InstallResultSchema = z19.z.object({
18025
18035
  success: z19.z.boolean(),
@@ -24526,5 +24536,5 @@ exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
24526
24536
  exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
24527
24537
  exports.STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE = STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE;
24528
24538
  exports.agent_builder_exports = agent_builder_exports;
24529
- //# sourceMappingURL=chunk-TWZCZKUD.cjs.map
24530
- //# sourceMappingURL=chunk-TWZCZKUD.cjs.map
24539
+ //# sourceMappingURL=chunk-25K5B3GJ.cjs.map
24540
+ //# sourceMappingURL=chunk-25K5B3GJ.cjs.map