@mastra/rag 2.6.3-alpha.0 → 2.6.4-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/dist/index.js CHANGED
@@ -642,7 +642,7 @@ let customAlphabet = (alphabet, defaultSize = 21) => {
642
642
  };
643
643
  };
644
644
  //#endregion
645
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/provider-utils/2.2.8/0289608026c229870c5c6167dc772feaac06745c9b590063cf43d9a3bb49f1b9/node_modules/@ai-sdk/provider-utils/dist/index.mjs
645
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/provider-utils/2.2.8/00e91c4c4a204e1e18581415116768196248d2b5a2175669bb516cc6c65e4736/node_modules/@ai-sdk/provider-utils/dist/index.mjs
646
646
  var import_secure_json_parse = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
647
647
  const hasBuffer = typeof Buffer !== "undefined";
648
648
  const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
@@ -1185,7 +1185,7 @@ function withoutTrailingSlash(url) {
1185
1185
  return url == null ? void 0 : url.replace(/\/$/, "");
1186
1186
  }
1187
1187
  //#endregion
1188
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/openai/1.3.24/887477b4d3117e23f9a8ca29caf585fd2cfcc31c305bdf0af7c3f23b8afb4486/node_modules/@ai-sdk/openai/dist/index.mjs
1188
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/openai/1.3.24/85bd36f6aaf1b0f39b269d3609a1d8870f2a0f53f97d76903ae38f44b38e6937/node_modules/@ai-sdk/openai/dist/index.mjs
1189
1189
  function convertToOpenAIChatMessages({ prompt, useLegacyFunctionCalling = false, systemMessageMode = "system" }) {
1190
1190
  const messages = [];
1191
1191
  const warnings = [];
@@ -3980,6 +3980,11 @@ var TextTransformer = class {
3980
3980
  overlapContent.unshift(piece);
3981
3981
  overlapSize += pieceLen + (overlapContent.length > 1 ? separatorLen : 0);
3982
3982
  }
3983
+ while (overlapContent.length > 0 && overlapSize + len + separatorLen > this.maxSize) {
3984
+ const removed = overlapContent.shift();
3985
+ const removedLen = this.lengthFunction(removed);
3986
+ overlapSize -= removedLen + (overlapContent.length > 0 ? separatorLen : 0);
3987
+ }
3983
3988
  currentDoc = overlapContent;
3984
3989
  total = overlapSize;
3985
3990
  } else {
@@ -5673,8 +5678,7 @@ var TokenTransformer = class TokenTransformer extends TextTransformer {
5673
5678
  allowedSpecial: options.allowedSpecial,
5674
5679
  disallowedSpecial: options.disallowedSpecial,
5675
5680
  options: {
5676
- maxSize: options.maxSize,
5677
- overlap: options.overlap,
5681
+ ...options,
5678
5682
  lengthFunction: tikTokenEncoder
5679
5683
  }
5680
5684
  });