@absolutejs/absolute 0.19.0-beta.606 → 0.19.0-beta.607

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.
@@ -876,6 +876,13 @@ var buildGroundingReferenceEvidenceSummary = (reference) => [
876
876
  reference.contextLabel,
877
877
  reference.provenanceLabel
878
878
  ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
879
+ var buildGroundingSectionKey = (reference) => reference.contextLabel ?? reference.locatorLabel ?? reference.label ?? reference.source ?? reference.chunkId;
880
+ var buildGroundingSectionSummaryLine = (reference) => [
881
+ reference.source ?? reference.title ?? reference.chunkId,
882
+ reference.locatorLabel,
883
+ reference.contextLabel,
884
+ reference.provenanceLabel
885
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
879
886
  var buildGroundedAnswerCitationDetail = (reference) => ({
880
887
  contextLabel: reference.contextLabel,
881
888
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -966,9 +973,61 @@ var buildRAGGroundedAnswer = (content, sources) => {
966
973
  hasCitations,
967
974
  parts,
968
975
  references,
976
+ sectionSummaries: buildRAGGroundedAnswerSectionSummaries(references),
969
977
  ungroundedReferenceNumbers: [...ungroundedReferenceNumbers].sort((left, right) => left - right)
970
978
  };
971
979
  };
980
+ var buildRAGGroundedAnswerSectionSummaries = (references) => {
981
+ const groups = new Map;
982
+ for (const reference of references) {
983
+ const key = buildGroundingSectionKey(reference);
984
+ const existing = groups.get(key);
985
+ if (!existing) {
986
+ groups.set(key, {
987
+ chunkIds: [reference.chunkId],
988
+ contextLabel: reference.contextLabel,
989
+ count: 1,
990
+ key,
991
+ label: key,
992
+ locatorLabel: reference.locatorLabel,
993
+ provenanceLabel: reference.provenanceLabel,
994
+ referenceNumbers: [reference.number],
995
+ references: [reference],
996
+ summary: buildGroundingSectionSummaryLine(reference) || reference.label || reference.chunkId
997
+ });
998
+ continue;
999
+ }
1000
+ existing.count += 1;
1001
+ if (!existing.chunkIds.includes(reference.chunkId)) {
1002
+ existing.chunkIds.push(reference.chunkId);
1003
+ }
1004
+ if (!existing.referenceNumbers.includes(reference.number)) {
1005
+ existing.referenceNumbers.push(reference.number);
1006
+ }
1007
+ existing.references.push(reference);
1008
+ if (!existing.contextLabel && reference.contextLabel) {
1009
+ existing.contextLabel = reference.contextLabel;
1010
+ }
1011
+ if (!existing.locatorLabel && reference.locatorLabel) {
1012
+ existing.locatorLabel = reference.locatorLabel;
1013
+ }
1014
+ if (!existing.provenanceLabel && reference.provenanceLabel) {
1015
+ existing.provenanceLabel = reference.provenanceLabel;
1016
+ }
1017
+ }
1018
+ return [...groups.values()].map((group) => ({
1019
+ ...group,
1020
+ referenceNumbers: [...group.referenceNumbers].sort((left, right) => left - right),
1021
+ references: group.references.slice().sort((left, right) => left.number - right.number)
1022
+ })).sort((left, right) => {
1023
+ const leftFirst = left.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
1024
+ const rightFirst = right.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
1025
+ if (leftFirst !== rightFirst) {
1026
+ return leftFirst - rightFirst;
1027
+ }
1028
+ return left.label.localeCompare(right.label);
1029
+ });
1030
+ };
972
1031
  var buildRAGGroundingReferences = (sources) => {
973
1032
  const citations = buildRAGCitations(sources);
974
1033
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
@@ -836,6 +836,13 @@ var buildGroundingReferenceEvidenceSummary = (reference) => [
836
836
  reference.contextLabel,
837
837
  reference.provenanceLabel
838
838
  ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
839
+ var buildGroundingSectionKey = (reference) => reference.contextLabel ?? reference.locatorLabel ?? reference.label ?? reference.source ?? reference.chunkId;
840
+ var buildGroundingSectionSummaryLine = (reference) => [
841
+ reference.source ?? reference.title ?? reference.chunkId,
842
+ reference.locatorLabel,
843
+ reference.contextLabel,
844
+ reference.provenanceLabel
845
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
839
846
  var buildGroundedAnswerCitationDetail = (reference) => ({
840
847
  contextLabel: reference.contextLabel,
841
848
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -926,9 +933,61 @@ var buildRAGGroundedAnswer = (content, sources) => {
926
933
  hasCitations,
927
934
  parts,
928
935
  references,
936
+ sectionSummaries: buildRAGGroundedAnswerSectionSummaries(references),
929
937
  ungroundedReferenceNumbers: [...ungroundedReferenceNumbers].sort((left, right) => left - right)
930
938
  };
931
939
  };
940
+ var buildRAGGroundedAnswerSectionSummaries = (references) => {
941
+ const groups = new Map;
942
+ for (const reference of references) {
943
+ const key = buildGroundingSectionKey(reference);
944
+ const existing = groups.get(key);
945
+ if (!existing) {
946
+ groups.set(key, {
947
+ chunkIds: [reference.chunkId],
948
+ contextLabel: reference.contextLabel,
949
+ count: 1,
950
+ key,
951
+ label: key,
952
+ locatorLabel: reference.locatorLabel,
953
+ provenanceLabel: reference.provenanceLabel,
954
+ referenceNumbers: [reference.number],
955
+ references: [reference],
956
+ summary: buildGroundingSectionSummaryLine(reference) || reference.label || reference.chunkId
957
+ });
958
+ continue;
959
+ }
960
+ existing.count += 1;
961
+ if (!existing.chunkIds.includes(reference.chunkId)) {
962
+ existing.chunkIds.push(reference.chunkId);
963
+ }
964
+ if (!existing.referenceNumbers.includes(reference.number)) {
965
+ existing.referenceNumbers.push(reference.number);
966
+ }
967
+ existing.references.push(reference);
968
+ if (!existing.contextLabel && reference.contextLabel) {
969
+ existing.contextLabel = reference.contextLabel;
970
+ }
971
+ if (!existing.locatorLabel && reference.locatorLabel) {
972
+ existing.locatorLabel = reference.locatorLabel;
973
+ }
974
+ if (!existing.provenanceLabel && reference.provenanceLabel) {
975
+ existing.provenanceLabel = reference.provenanceLabel;
976
+ }
977
+ }
978
+ return [...groups.values()].map((group) => ({
979
+ ...group,
980
+ referenceNumbers: [...group.referenceNumbers].sort((left, right) => left - right),
981
+ references: group.references.slice().sort((left, right) => left.number - right.number)
982
+ })).sort((left, right) => {
983
+ const leftFirst = left.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
984
+ const rightFirst = right.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
985
+ if (leftFirst !== rightFirst) {
986
+ return leftFirst - rightFirst;
987
+ }
988
+ return left.label.localeCompare(right.label);
989
+ });
990
+ };
932
991
  var buildRAGGroundingReferences = (sources) => {
933
992
  const citations = buildRAGCitations(sources);
934
993
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
@@ -1879,6 +1879,13 @@ var buildGroundingReferenceEvidenceSummary = (reference) => [
1879
1879
  reference.contextLabel,
1880
1880
  reference.provenanceLabel
1881
1881
  ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
1882
+ var buildGroundingSectionKey = (reference) => reference.contextLabel ?? reference.locatorLabel ?? reference.label ?? reference.source ?? reference.chunkId;
1883
+ var buildGroundingSectionSummaryLine = (reference) => [
1884
+ reference.source ?? reference.title ?? reference.chunkId,
1885
+ reference.locatorLabel,
1886
+ reference.contextLabel,
1887
+ reference.provenanceLabel
1888
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" · ");
1882
1889
  var buildGroundedAnswerCitationDetail = (reference) => ({
1883
1890
  contextLabel: reference.contextLabel,
1884
1891
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -1969,9 +1976,61 @@ var buildRAGGroundedAnswer = (content, sources) => {
1969
1976
  hasCitations,
1970
1977
  parts,
1971
1978
  references,
1979
+ sectionSummaries: buildRAGGroundedAnswerSectionSummaries(references),
1972
1980
  ungroundedReferenceNumbers: [...ungroundedReferenceNumbers].sort((left, right) => left - right)
1973
1981
  };
1974
1982
  };
1983
+ var buildRAGGroundedAnswerSectionSummaries = (references) => {
1984
+ const groups = new Map;
1985
+ for (const reference of references) {
1986
+ const key = buildGroundingSectionKey(reference);
1987
+ const existing = groups.get(key);
1988
+ if (!existing) {
1989
+ groups.set(key, {
1990
+ chunkIds: [reference.chunkId],
1991
+ contextLabel: reference.contextLabel,
1992
+ count: 1,
1993
+ key,
1994
+ label: key,
1995
+ locatorLabel: reference.locatorLabel,
1996
+ provenanceLabel: reference.provenanceLabel,
1997
+ referenceNumbers: [reference.number],
1998
+ references: [reference],
1999
+ summary: buildGroundingSectionSummaryLine(reference) || reference.label || reference.chunkId
2000
+ });
2001
+ continue;
2002
+ }
2003
+ existing.count += 1;
2004
+ if (!existing.chunkIds.includes(reference.chunkId)) {
2005
+ existing.chunkIds.push(reference.chunkId);
2006
+ }
2007
+ if (!existing.referenceNumbers.includes(reference.number)) {
2008
+ existing.referenceNumbers.push(reference.number);
2009
+ }
2010
+ existing.references.push(reference);
2011
+ if (!existing.contextLabel && reference.contextLabel) {
2012
+ existing.contextLabel = reference.contextLabel;
2013
+ }
2014
+ if (!existing.locatorLabel && reference.locatorLabel) {
2015
+ existing.locatorLabel = reference.locatorLabel;
2016
+ }
2017
+ if (!existing.provenanceLabel && reference.provenanceLabel) {
2018
+ existing.provenanceLabel = reference.provenanceLabel;
2019
+ }
2020
+ }
2021
+ return [...groups.values()].map((group) => ({
2022
+ ...group,
2023
+ referenceNumbers: [...group.referenceNumbers].sort((left, right) => left - right),
2024
+ references: group.references.slice().sort((left, right) => left.number - right.number)
2025
+ })).sort((left, right) => {
2026
+ const leftFirst = left.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
2027
+ const rightFirst = right.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
2028
+ if (leftFirst !== rightFirst) {
2029
+ return leftFirst - rightFirst;
2030
+ }
2031
+ return left.label.localeCompare(right.label);
2032
+ });
2033
+ };
1975
2034
  var buildRAGGroundingReferences = (sources) => {
1976
2035
  const citations = buildRAGCitations(sources);
1977
2036
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
@@ -1021,6 +1021,13 @@ var buildGroundingReferenceEvidenceSummary = (reference) => [
1021
1021
  reference.contextLabel,
1022
1022
  reference.provenanceLabel
1023
1023
  ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
1024
+ var buildGroundingSectionKey = (reference) => reference.contextLabel ?? reference.locatorLabel ?? reference.label ?? reference.source ?? reference.chunkId;
1025
+ var buildGroundingSectionSummaryLine = (reference) => [
1026
+ reference.source ?? reference.title ?? reference.chunkId,
1027
+ reference.locatorLabel,
1028
+ reference.contextLabel,
1029
+ reference.provenanceLabel
1030
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
1024
1031
  var buildGroundedAnswerCitationDetail = (reference) => ({
1025
1032
  contextLabel: reference.contextLabel,
1026
1033
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -1111,9 +1118,61 @@ var buildRAGGroundedAnswer = (content, sources) => {
1111
1118
  hasCitations,
1112
1119
  parts,
1113
1120
  references,
1121
+ sectionSummaries: buildRAGGroundedAnswerSectionSummaries(references),
1114
1122
  ungroundedReferenceNumbers: [...ungroundedReferenceNumbers].sort((left, right) => left - right)
1115
1123
  };
1116
1124
  };
1125
+ var buildRAGGroundedAnswerSectionSummaries = (references) => {
1126
+ const groups = new Map;
1127
+ for (const reference of references) {
1128
+ const key = buildGroundingSectionKey(reference);
1129
+ const existing = groups.get(key);
1130
+ if (!existing) {
1131
+ groups.set(key, {
1132
+ chunkIds: [reference.chunkId],
1133
+ contextLabel: reference.contextLabel,
1134
+ count: 1,
1135
+ key,
1136
+ label: key,
1137
+ locatorLabel: reference.locatorLabel,
1138
+ provenanceLabel: reference.provenanceLabel,
1139
+ referenceNumbers: [reference.number],
1140
+ references: [reference],
1141
+ summary: buildGroundingSectionSummaryLine(reference) || reference.label || reference.chunkId
1142
+ });
1143
+ continue;
1144
+ }
1145
+ existing.count += 1;
1146
+ if (!existing.chunkIds.includes(reference.chunkId)) {
1147
+ existing.chunkIds.push(reference.chunkId);
1148
+ }
1149
+ if (!existing.referenceNumbers.includes(reference.number)) {
1150
+ existing.referenceNumbers.push(reference.number);
1151
+ }
1152
+ existing.references.push(reference);
1153
+ if (!existing.contextLabel && reference.contextLabel) {
1154
+ existing.contextLabel = reference.contextLabel;
1155
+ }
1156
+ if (!existing.locatorLabel && reference.locatorLabel) {
1157
+ existing.locatorLabel = reference.locatorLabel;
1158
+ }
1159
+ if (!existing.provenanceLabel && reference.provenanceLabel) {
1160
+ existing.provenanceLabel = reference.provenanceLabel;
1161
+ }
1162
+ }
1163
+ return [...groups.values()].map((group) => ({
1164
+ ...group,
1165
+ referenceNumbers: [...group.referenceNumbers].sort((left, right) => left - right),
1166
+ references: group.references.slice().sort((left, right) => left.number - right.number)
1167
+ })).sort((left, right) => {
1168
+ const leftFirst = left.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
1169
+ const rightFirst = right.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
1170
+ if (leftFirst !== rightFirst) {
1171
+ return leftFirst - rightFirst;
1172
+ }
1173
+ return left.label.localeCompare(right.label);
1174
+ });
1175
+ };
1117
1176
  var buildRAGGroundingReferences = (sources) => {
1118
1177
  const citations = buildRAGCitations(sources);
1119
1178
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
@@ -4134,5 +4193,5 @@ export {
4134
4193
  AIStreamService
4135
4194
  };
4136
4195
 
4137
- //# debugId=6BA4A5140094B73664756E2164756E21
4196
+ //# debugId=2C3A632BB772C68C64756E2164756E21
4138
4197
  //# sourceMappingURL=index.js.map