@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.
@@ -15496,7 +15496,8 @@ ${workingMemory}`;
15496
15496
  messages: dbMessages
15497
15497
  });
15498
15498
  if (this.vector && config.semanticRecall) {
15499
- let indexName;
15499
+ const embeddingData = [];
15500
+ let dimension;
15500
15501
  await Promise.all(
15501
15502
  updatedMessages.map(async (message) => {
15502
15503
  let textForEmbedding = null;
@@ -15507,19 +15508,11 @@ ${workingMemory}`;
15507
15508
  if (joined) textForEmbedding = joined;
15508
15509
  }
15509
15510
  if (!textForEmbedding) return;
15510
- const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
15511
- if (typeof indexName === `undefined`) {
15512
- indexName = this.createEmbeddingIndex(dimension, config).then((result2) => result2.indexName);
15513
- }
15514
- if (typeof this.vector === `undefined`) {
15515
- throw new Error(
15516
- `Tried to upsert embeddings to index ${indexName} but this Memory instance doesn't have an attached vector db.`
15517
- );
15518
- }
15519
- await this.vector.upsert({
15520
- indexName: await indexName,
15521
- vectors: embeddings,
15522
- metadata: chunks.map(() => ({
15511
+ const result2 = await this.embedMessageContent(textForEmbedding);
15512
+ dimension = result2.dimension;
15513
+ embeddingData.push({
15514
+ embeddings: result2.embeddings,
15515
+ metadata: result2.chunks.map(() => ({
15523
15516
  message_id: message.id,
15524
15517
  thread_id: message.threadId,
15525
15518
  resource_id: message.resourceId
@@ -15527,6 +15520,23 @@ ${workingMemory}`;
15527
15520
  });
15528
15521
  })
15529
15522
  );
15523
+ if (embeddingData.length > 0 && dimension !== void 0) {
15524
+ if (typeof this.vector === `undefined`) {
15525
+ throw new Error(`Tried to upsert embeddings but this Memory instance doesn't have an attached vector db.`);
15526
+ }
15527
+ const { indexName } = await this.createEmbeddingIndex(dimension, config);
15528
+ const allVectors = [];
15529
+ const allMetadata = [];
15530
+ for (const data of embeddingData) {
15531
+ allVectors.push(...data.embeddings);
15532
+ allMetadata.push(...data.metadata);
15533
+ }
15534
+ await this.vector.upsert({
15535
+ indexName,
15536
+ vectors: allVectors,
15537
+ metadata: allMetadata
15538
+ });
15539
+ }
15530
15540
  }
15531
15541
  return result;
15532
15542
  }
@@ -17995,7 +18005,7 @@ var PackageMergeResultSchema = z.object({
17995
18005
  error: z.string().optional()
17996
18006
  });
17997
18007
  var InstallInputSchema = z.object({
17998
- targetPath: z.string().describe("Path to the project to install packages in")
18008
+ targetPath: z.string().optional().describe("Path to the project to install packages in")
17999
18009
  });
18000
18010
  var InstallResultSchema = z.object({
18001
18011
  success: z.boolean(),
@@ -24484,5 +24494,5 @@ var OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({
24484
24494
  });
24485
24495
 
24486
24496
  export { CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_EXECUTION_RESULT_ROUTE, LIST_AGENT_BUILDER_ACTIONS_ROUTE, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE, RESUME_AGENT_BUILDER_ACTION_ROUTE, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE, START_AGENT_BUILDER_ACTION_RUN_ROUTE, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE, STREAM_AGENT_BUILDER_ACTION_ROUTE, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, STREAM_VNEXT_AGENT_BUILDER_ACTION_ROUTE, agent_builder_exports };
24487
- //# sourceMappingURL=chunk-OL6U27XK.js.map
24488
- //# sourceMappingURL=chunk-OL6U27XK.js.map
24497
+ //# sourceMappingURL=chunk-M55XXZ35.js.map
24498
+ //# sourceMappingURL=chunk-M55XXZ35.js.map