@absolutejs/rag 0.6.1 → 0.6.2

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
@@ -36126,6 +36126,10 @@ var planRAGCorpus = async (store, owner, desired) => {
36126
36126
  unchanged
36127
36127
  };
36128
36128
  };
36129
+ var filterToWritten = (planned, written) => {
36130
+ const ids = new Set(written);
36131
+ return planned.filter((doc) => ids.has(doc.chunkId));
36132
+ };
36129
36133
  var reconcileRAGCorpus = async (store, owner, desired, apply) => {
36130
36134
  const plan = await planRAGCorpus(store, owner, desired);
36131
36135
  if (plan.remove.length > 0) {
@@ -36135,7 +36139,7 @@ var reconcileRAGCorpus = async (store, owner, desired, apply) => {
36135
36139
  let embedded = 0;
36136
36140
  if (plan.embed.length > 0) {
36137
36141
  const outcome = await apply.embed(plan.embed, owner);
36138
- const written = typeof outcome === "number" ? plan.embed.slice(0, Math.max(0, Math.min(outcome, plan.embed.length))) : plan.embed.filter((doc) => new Set(outcome).has(doc.chunkId));
36142
+ const written = typeof outcome === "number" ? plan.embed.slice(0, Math.max(0, Math.min(outcome, plan.embed.length))) : filterToWritten(plan.embed, outcome);
36139
36143
  embedded = written.length;
36140
36144
  if (written.length > 0) {
36141
36145
  await store.remember(owner, await Promise.all(written.map(async (doc) => ({
@@ -36446,5 +36450,5 @@ export {
36446
36450
  addRAGEvaluationSuiteCase
36447
36451
  };
36448
36452
 
36449
- //# debugId=6D0F2872DF78972C64756E2164756E21
36453
+ //# debugId=9A8B228F28FF5ED164756E2164756E21
36450
36454
  //# sourceMappingURL=index.js.map