@absolutejs/absolute 0.19.0-beta.613 → 0.19.0-beta.614

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/ai/index.js CHANGED
@@ -4668,10 +4668,10 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
4668
4668
  const vectorHits = channels.includes("vector") ? 1 : 0;
4669
4669
  const lexicalHits = channels.includes("lexical") ? 1 : 0;
4670
4670
  const hybridHits = isHybrid ? 1 : 0;
4671
- const queryOrigin = source.metadata?.retrievalQueryOrigin;
4672
- const primaryHits = queryOrigin === "primary" ? 1 : 0;
4673
- const transformedHits = queryOrigin === "transformed" ? 1 : 0;
4674
- const variantHits = queryOrigin === "variant" ? 1 : 0;
4671
+ const queryOrigins = Array.isArray(source.metadata?.retrievalQueryOrigins) ? source.metadata.retrievalQueryOrigins.filter((value) => value === "primary" || value === "transformed" || value === "variant") : source.metadata?.retrievalQueryOrigin === "primary" || source.metadata?.retrievalQueryOrigin === "transformed" || source.metadata?.retrievalQueryOrigin === "variant" ? [source.metadata.retrievalQueryOrigin] : [];
4672
+ const primaryHits = queryOrigins.includes("primary") ? 1 : 0;
4673
+ const transformedHits = queryOrigins.includes("transformed") ? 1 : 0;
4674
+ const variantHits = queryOrigins.includes("variant") ? 1 : 0;
4675
4675
  if (!existing) {
4676
4676
  sections.set(key, {
4677
4677
  bestScore: source.score,
@@ -10538,9 +10538,17 @@ var mergeQueryResults = (results) => {
10538
10538
  const merged = new Map;
10539
10539
  for (const result of results) {
10540
10540
  const existing = merged.get(result.chunkId);
10541
- if (!existing || result.score > existing.score) {
10542
- merged.set(result.chunkId, result);
10543
- }
10541
+ const existingOrigins = Array.isArray(existing?.metadata?.retrievalQueryOrigins) ? existing.metadata.retrievalQueryOrigins.filter((value) => typeof value === "string") : typeof existing?.metadata?.retrievalQueryOrigin === "string" ? [existing.metadata.retrievalQueryOrigin] : [];
10542
+ const resultOrigins = Array.isArray(result.metadata?.retrievalQueryOrigins) ? result.metadata.retrievalQueryOrigins.filter((value) => typeof value === "string") : typeof result.metadata?.retrievalQueryOrigin === "string" ? [result.metadata.retrievalQueryOrigin] : [];
10543
+ const mergedOrigins = Array.from(new Set([...existingOrigins, ...resultOrigins]));
10544
+ const preferred = !existing || result.score > existing.score ? result : existing;
10545
+ merged.set(result.chunkId, {
10546
+ ...preferred,
10547
+ metadata: {
10548
+ ...preferred.metadata ?? {},
10549
+ retrievalQueryOrigins: mergedOrigins
10550
+ }
10551
+ });
10544
10552
  }
10545
10553
  return [...merged.values()].sort((left, right) => {
10546
10554
  if (right.score !== left.score) {
@@ -22432,5 +22440,5 @@ export {
22432
22440
  aiChat
22433
22441
  };
22434
22442
 
22435
- //# debugId=13C12436C949ED5964756E2164756E21
22443
+ //# debugId=593D26DEF70C96A364756E2164756E21
22436
22444
  //# sourceMappingURL=index.js.map