@absolutejs/absolute 0.19.0-beta.617 → 0.19.0-beta.619
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/client/index.js +100 -23
- package/dist/ai/client/index.js.map +4 -4
- package/dist/ai/client/ui.js +96 -22
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +502 -84
- package/dist/ai/index.js.map +9 -9
- package/dist/ai/rag/quality.js +5 -2
- package/dist/ai/rag/quality.js.map +3 -3
- package/dist/ai/rag/ui.js +96 -22
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +95 -21
- package/dist/ai-client/react/ai/index.js +95 -21
- package/dist/ai-client/vue/ai/index.js +95 -21
- package/dist/angular/ai/index.js +96 -22
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +100 -23
- package/dist/react/ai/index.js.map +4 -4
- package/dist/src/ai/rag/quality.d.ts +2 -1
- package/dist/src/vue/ai/useRAG.d.ts +4 -4
- package/dist/src/vue/ai/useRAGChunkPreview.d.ts +2 -2
- package/dist/src/vue/ai/useRAGSearch.d.ts +2 -2
- package/dist/svelte/ai/index.js +100 -23
- package/dist/svelte/ai/index.js.map +4 -4
- package/dist/types/ai.d.ts +3 -2
- package/dist/vue/ai/index.js +100 -23
- package/dist/vue/ai/index.js.map +4 -4
- package/package.json +7 -7
package/dist/ai/client/index.js
CHANGED
|
@@ -2054,6 +2054,7 @@ var createRAGFileRetrievalLaneHandoffDecisionStore = (path) => ({
|
|
|
2054
2054
|
});
|
|
2055
2055
|
var createRAGFileRetrievalReleaseIncidentStore = (path) => ({
|
|
2056
2056
|
listIncidents: async ({
|
|
2057
|
+
corpusGroupKey,
|
|
2057
2058
|
groupKey,
|
|
2058
2059
|
limit,
|
|
2059
2060
|
severity,
|
|
@@ -2070,7 +2071,7 @@ var createRAGFileRetrievalReleaseIncidentStore = (path) => ({
|
|
|
2070
2071
|
throw error;
|
|
2071
2072
|
}
|
|
2072
2073
|
}
|
|
2073
|
-
const filtered = parsed.filter((entry) => (!groupKey || entry.groupKey === groupKey) && (!targetRolloutLabel || entry.targetRolloutLabel === targetRolloutLabel) && (!severity || entry.severity === severity) && (!status || entry.status === status));
|
|
2074
|
+
const filtered = parsed.filter((entry) => (!corpusGroupKey || entry.corpusGroupKey === corpusGroupKey) && (!groupKey || entry.groupKey === groupKey) && (!targetRolloutLabel || entry.targetRolloutLabel === targetRolloutLabel) && (!severity || entry.severity === severity) && (!status || entry.status === status));
|
|
2074
2075
|
const sorted = normalizeRetrievalReleaseIncidentRecords(filtered);
|
|
2075
2076
|
return typeof limit === "number" ? sorted.slice(0, limit) : sorted;
|
|
2076
2077
|
},
|
|
@@ -3053,12 +3054,14 @@ var loadRAGRetrievalLaneHandoffDecisions = async ({
|
|
|
3053
3054
|
})));
|
|
3054
3055
|
var loadRAGRetrievalReleaseIncidents = async ({
|
|
3055
3056
|
store,
|
|
3057
|
+
corpusGroupKey,
|
|
3056
3058
|
groupKey,
|
|
3057
3059
|
limit,
|
|
3058
3060
|
targetRolloutLabel,
|
|
3059
3061
|
status,
|
|
3060
3062
|
severity
|
|
3061
3063
|
}) => normalizeRetrievalReleaseIncidentRecords(await Promise.resolve(store.listIncidents({
|
|
3064
|
+
corpusGroupKey,
|
|
3062
3065
|
groupKey,
|
|
3063
3066
|
limit,
|
|
3064
3067
|
severity,
|
|
@@ -4831,6 +4834,25 @@ var buildContextLabel2 = (metadata) => {
|
|
|
4831
4834
|
if (!metadata) {
|
|
4832
4835
|
return;
|
|
4833
4836
|
}
|
|
4837
|
+
const pdfTextKind = getContextString2(metadata.pdfTextKind);
|
|
4838
|
+
const officeBlockKind = getContextString2(metadata.officeBlockKind);
|
|
4839
|
+
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
|
|
4840
|
+
const sectionTitle = getContextString2(metadata.sectionTitle) ?? sectionPath.at(-1);
|
|
4841
|
+
if (pdfTextKind === "table_like" && sectionTitle) {
|
|
4842
|
+
return `PDF table block ${sectionTitle}`;
|
|
4843
|
+
}
|
|
4844
|
+
if (pdfTextKind === "paragraph" && sectionTitle) {
|
|
4845
|
+
return `PDF text block ${sectionTitle}`;
|
|
4846
|
+
}
|
|
4847
|
+
if (officeBlockKind === "table" && sectionTitle) {
|
|
4848
|
+
return `Office table block ${sectionTitle}`;
|
|
4849
|
+
}
|
|
4850
|
+
if (officeBlockKind === "list" && sectionTitle) {
|
|
4851
|
+
return `Office list block ${sectionTitle}`;
|
|
4852
|
+
}
|
|
4853
|
+
if (officeBlockKind === "paragraph" && sectionTitle) {
|
|
4854
|
+
return `Office paragraph block ${sectionTitle}`;
|
|
4855
|
+
}
|
|
4834
4856
|
const emailKind = getContextString2(metadata.emailKind);
|
|
4835
4857
|
if (emailKind === "attachment") {
|
|
4836
4858
|
return "Attachment evidence";
|
|
@@ -4867,8 +4889,6 @@ var buildContextLabel2 = (metadata) => {
|
|
|
4867
4889
|
if (speaker) {
|
|
4868
4890
|
return `Speaker ${speaker}`;
|
|
4869
4891
|
}
|
|
4870
|
-
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
|
|
4871
|
-
const sectionTitle = getContextString2(metadata.sectionTitle) ?? sectionPath.at(-1);
|
|
4872
4892
|
if (sectionTitle) {
|
|
4873
4893
|
return `Section ${sectionTitle}`;
|
|
4874
4894
|
}
|
|
@@ -4878,11 +4898,21 @@ var buildLocatorLabel2 = (metadata, source, title) => {
|
|
|
4878
4898
|
if (!metadata) {
|
|
4879
4899
|
return;
|
|
4880
4900
|
}
|
|
4901
|
+
const pdfTextKind = getContextString2(metadata.pdfTextKind);
|
|
4902
|
+
const officeBlockKind = getContextString2(metadata.officeBlockKind);
|
|
4903
|
+
const pdfBlockNumber = getContextNumber2(metadata.pdfBlockNumber);
|
|
4904
|
+
const officeBlockNumber = getContextNumber2(metadata.officeBlockNumber);
|
|
4881
4905
|
const page = getContextNumber2(metadata.page) ?? getContextNumber2(metadata.pageNumber) ?? (typeof metadata.pageIndex === "number" ? metadata.pageIndex + 1 : undefined);
|
|
4882
4906
|
const region = getContextNumber2(metadata.regionNumber) ?? (typeof metadata.regionIndex === "number" ? metadata.regionIndex + 1 : undefined);
|
|
4883
4907
|
if (page && region) {
|
|
4884
4908
|
return `Page ${page} \xB7 Region ${region}`;
|
|
4885
4909
|
}
|
|
4910
|
+
if (page && pdfBlockNumber && pdfTextKind === "table_like") {
|
|
4911
|
+
return `Page ${page} \xB7 Table Block ${pdfBlockNumber}`;
|
|
4912
|
+
}
|
|
4913
|
+
if (page && pdfBlockNumber) {
|
|
4914
|
+
return `Page ${page} \xB7 Text Block ${pdfBlockNumber}`;
|
|
4915
|
+
}
|
|
4886
4916
|
if (page) {
|
|
4887
4917
|
return `Page ${page}`;
|
|
4888
4918
|
}
|
|
@@ -4911,6 +4941,15 @@ var buildLocatorLabel2 = (metadata, source, title) => {
|
|
|
4911
4941
|
if (mediaStart) {
|
|
4912
4942
|
return `Timestamp ${mediaStart}`;
|
|
4913
4943
|
}
|
|
4944
|
+
if (officeBlockNumber && officeBlockKind === "table") {
|
|
4945
|
+
return `Office table block ${officeBlockNumber}`;
|
|
4946
|
+
}
|
|
4947
|
+
if (officeBlockNumber && officeBlockKind === "list") {
|
|
4948
|
+
return `Office list block ${officeBlockNumber}`;
|
|
4949
|
+
}
|
|
4950
|
+
if (officeBlockNumber && officeBlockKind === "paragraph") {
|
|
4951
|
+
return `Office paragraph block ${officeBlockNumber}`;
|
|
4952
|
+
}
|
|
4914
4953
|
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
|
|
4915
4954
|
if (sectionPath.length > 0) {
|
|
4916
4955
|
return `Section ${sectionPath.join(" > ")}`;
|
|
@@ -4928,12 +4967,16 @@ var buildProvenanceLabel2 = (metadata) => {
|
|
|
4928
4967
|
const mediaKind = getContextString2(metadata.mediaKind);
|
|
4929
4968
|
const transcriptSource = getContextString2(metadata.transcriptSource);
|
|
4930
4969
|
const pdfTextMode = getContextString2(metadata.pdfTextMode);
|
|
4970
|
+
const pdfTextKind = getContextString2(metadata.pdfTextKind);
|
|
4971
|
+
const officeBlockKind = getContextString2(metadata.officeBlockKind);
|
|
4931
4972
|
const ocrEngine = getContextString2(metadata.ocrEngine);
|
|
4932
4973
|
const extractorRegistryMatch = getContextString2(metadata.extractorRegistryMatch);
|
|
4933
4974
|
const chunkingProfile = getContextString2(metadata.chunkingProfile);
|
|
4934
4975
|
const ocrConfidence = getContextNumber2(metadata.ocrRegionConfidence) ?? getContextNumber2(metadata.ocrConfidence);
|
|
4935
4976
|
const labels = [
|
|
4936
4977
|
pdfTextMode ? `PDF ${pdfTextMode}` : "",
|
|
4978
|
+
pdfTextKind === "table_like" ? "PDF table block" : pdfTextKind === "paragraph" ? "PDF text block" : "",
|
|
4979
|
+
officeBlockKind ? `Office ${officeBlockKind}` : "",
|
|
4937
4980
|
ocrEngine ? `OCR ${ocrEngine}` : "",
|
|
4938
4981
|
extractorRegistryMatch ? `Extractor ${extractorRegistryMatch}` : "",
|
|
4939
4982
|
chunkingProfile ? `Chunking ${chunkingProfile}` : "",
|
|
@@ -4969,7 +5012,7 @@ var buildRAGChunkStructure = (metadata) => {
|
|
|
4969
5012
|
return;
|
|
4970
5013
|
}
|
|
4971
5014
|
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.filter((value) => typeof value === "string" && value.trim().length > 0) : undefined;
|
|
4972
|
-
const sectionKind = metadata.sectionKind === "markdown_heading" || metadata.sectionKind === "html_heading" || metadata.sectionKind === "office_heading" || metadata.sectionKind === "spreadsheet_rows" || metadata.sectionKind === "presentation_slide" ? metadata.sectionKind : undefined;
|
|
5015
|
+
const sectionKind = metadata.sectionKind === "markdown_heading" || metadata.sectionKind === "html_heading" || metadata.sectionKind === "office_heading" || metadata.sectionKind === "office_block" || metadata.sectionKind === "pdf_block" || metadata.sectionKind === "spreadsheet_rows" || metadata.sectionKind === "presentation_slide" ? metadata.sectionKind : undefined;
|
|
4973
5016
|
const section = {
|
|
4974
5017
|
depth: getContextNumber2(metadata.sectionDepth),
|
|
4975
5018
|
kind: sectionKind,
|
|
@@ -5289,7 +5332,7 @@ var buildRAGSourceSummaries = (sources) => {
|
|
|
5289
5332
|
const citationReferenceMap = buildRAGCitationReferenceMap(citations);
|
|
5290
5333
|
return sourceGroups.map((group) => {
|
|
5291
5334
|
const groupCitations = citations.filter((citation) => group.chunks.some((chunk) => chunk.chunkId === citation.chunkId));
|
|
5292
|
-
const leadChunk = group.chunks
|
|
5335
|
+
const leadChunk = getPreferredSourceLeadChunk(group.chunks);
|
|
5293
5336
|
const excerpts = leadChunk ? buildRAGChunkExcerpts(group.chunks, leadChunk.chunkId) : undefined;
|
|
5294
5337
|
const structure = leadChunk?.structure ?? buildRAGChunkStructure(leadChunk?.metadata);
|
|
5295
5338
|
const excerptSelection = buildRAGExcerptSelection(excerpts, structure);
|
|
@@ -5317,13 +5360,45 @@ var getSectionPathFromSource = (source) => {
|
|
|
5317
5360
|
const path = source.structure?.section?.path ?? (Array.isArray(source.metadata?.sectionPath) ? source.metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : []);
|
|
5318
5361
|
return path.length > 0 ? path : undefined;
|
|
5319
5362
|
};
|
|
5363
|
+
var isBlockAwareContextLabel = (value) => typeof value === "string" && (value.startsWith("PDF ") || value.startsWith("Office "));
|
|
5364
|
+
var getStructuredSectionScoreWeight = (metadata) => {
|
|
5365
|
+
if (!metadata) {
|
|
5366
|
+
return 1;
|
|
5367
|
+
}
|
|
5368
|
+
const pdfTextKind = getContextString2(metadata.pdfTextKind);
|
|
5369
|
+
const officeBlockKind = getContextString2(metadata.officeBlockKind);
|
|
5370
|
+
const sectionKind = getContextString2(metadata.sectionKind);
|
|
5371
|
+
if (pdfTextKind === "table_like") {
|
|
5372
|
+
return 1.28;
|
|
5373
|
+
}
|
|
5374
|
+
if (officeBlockKind === "table" || officeBlockKind === "list") {
|
|
5375
|
+
return 1.24;
|
|
5376
|
+
}
|
|
5377
|
+
if (sectionKind === "pdf_block" || sectionKind === "office_block" || officeBlockKind === "paragraph" || pdfTextKind === "paragraph") {
|
|
5378
|
+
return 1.12;
|
|
5379
|
+
}
|
|
5380
|
+
return 1;
|
|
5381
|
+
};
|
|
5382
|
+
var getStructuredSourceLeadScore = (source) => source.score * getStructuredSectionScoreWeight(source.metadata);
|
|
5383
|
+
var getPreferredSourceLeadChunk = (chunks) => chunks.slice().sort((left, right) => {
|
|
5384
|
+
const leftWeightedScore = getStructuredSourceLeadScore(left);
|
|
5385
|
+
const rightWeightedScore = getStructuredSourceLeadScore(right);
|
|
5386
|
+
if (rightWeightedScore !== leftWeightedScore) {
|
|
5387
|
+
return rightWeightedScore - leftWeightedScore;
|
|
5388
|
+
}
|
|
5389
|
+
if (right.score !== left.score) {
|
|
5390
|
+
return right.score - left.score;
|
|
5391
|
+
}
|
|
5392
|
+
return left.chunkId.localeCompare(right.chunkId);
|
|
5393
|
+
})[0];
|
|
5320
5394
|
var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
5321
|
-
const totalScore = sources.reduce((sum, source) => sum + source.score, 0);
|
|
5395
|
+
const totalScore = sources.reduce((sum, source) => sum + source.score * getStructuredSectionScoreWeight(source.metadata), 0);
|
|
5322
5396
|
if (sources.length === 0 || totalScore <= 0) {
|
|
5323
5397
|
return [];
|
|
5324
5398
|
}
|
|
5325
5399
|
const sections = new Map;
|
|
5326
5400
|
for (const source of sources) {
|
|
5401
|
+
const structuredScore = source.score * getStructuredSectionScoreWeight(source.metadata);
|
|
5327
5402
|
const path = getSectionPathFromSource(source);
|
|
5328
5403
|
if (!path) {
|
|
5329
5404
|
continue;
|
|
@@ -5355,7 +5430,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5355
5430
|
sourceSet: new Set(source.source ? [source.source] : []),
|
|
5356
5431
|
topChunkId: source.chunkId,
|
|
5357
5432
|
topSource: source.source,
|
|
5358
|
-
totalScore:
|
|
5433
|
+
totalScore: structuredScore,
|
|
5359
5434
|
transformedHits,
|
|
5360
5435
|
variantHits,
|
|
5361
5436
|
vectorHits
|
|
@@ -5363,7 +5438,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5363
5438
|
continue;
|
|
5364
5439
|
}
|
|
5365
5440
|
existing.count += 1;
|
|
5366
|
-
existing.totalScore +=
|
|
5441
|
+
existing.totalScore += structuredScore;
|
|
5367
5442
|
if (source.source) {
|
|
5368
5443
|
existing.sourceSet.add(source.source);
|
|
5369
5444
|
}
|
|
@@ -5391,6 +5466,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5391
5466
|
const parentTotal = siblingPool.reduce((sum, entry) => sum + entry.totalScore, 0);
|
|
5392
5467
|
const scoreShare = section.totalScore / totalScore;
|
|
5393
5468
|
const parentShare = parentTotal > 0 ? section.totalScore / parentTotal : undefined;
|
|
5469
|
+
const topChunk = sources.find((source) => source.chunkId === section.topChunkId);
|
|
5470
|
+
const topContextLabel = topChunk?.labels?.contextLabel ?? buildContextLabel2(topChunk?.metadata);
|
|
5394
5471
|
const parentDistribution = parentTotal > 0 ? siblingPool.map((entry) => ({
|
|
5395
5472
|
count: entry.count,
|
|
5396
5473
|
isActive: entry.key === section.key,
|
|
@@ -5516,6 +5593,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
5516
5593
|
reasons.push("concentrated_evidence");
|
|
5517
5594
|
}
|
|
5518
5595
|
const summaryParts = [
|
|
5596
|
+
isBlockAwareContextLabel(topContextLabel) ? topContextLabel : "",
|
|
5519
5597
|
`${section.count} hit${section.count === 1 ? "" : "s"}`,
|
|
5520
5598
|
`${(scoreShare * 100).toFixed(0)}% score share`,
|
|
5521
5599
|
`vector ${section.vectorHits} \xB7 lexical ${section.lexicalHits} \xB7 hybrid ${section.hybridHits}`,
|
|
@@ -5727,22 +5805,21 @@ var updateSourceGroup = (groups, source) => {
|
|
|
5727
5805
|
groups.set(key, buildSourceGroup(source, key));
|
|
5728
5806
|
return;
|
|
5729
5807
|
}
|
|
5730
|
-
|
|
5731
|
-
existing.bestScore = source.score;
|
|
5732
|
-
existing.label = buildSourceLabel2(source);
|
|
5733
|
-
existing.labels = source.labels ?? buildRAGSourceLabels({
|
|
5734
|
-
metadata: source.metadata,
|
|
5735
|
-
source: source.source,
|
|
5736
|
-
title: source.title
|
|
5737
|
-
});
|
|
5738
|
-
existing.structure = source.structure ?? buildRAGChunkStructure(source.metadata);
|
|
5739
|
-
existing.source = source.source;
|
|
5740
|
-
existing.title = source.title;
|
|
5741
|
-
} else {
|
|
5742
|
-
existing.bestScore = Math.max(existing.bestScore, source.score);
|
|
5743
|
-
}
|
|
5808
|
+
existing.bestScore = Math.max(existing.bestScore, source.score);
|
|
5744
5809
|
existing.count += 1;
|
|
5745
5810
|
existing.chunks.push(source);
|
|
5811
|
+
const leadChunk = getPreferredSourceLeadChunk(existing.chunks);
|
|
5812
|
+
if (leadChunk) {
|
|
5813
|
+
existing.label = buildSourceLabel2(leadChunk);
|
|
5814
|
+
existing.labels = leadChunk.labels ?? buildRAGSourceLabels({
|
|
5815
|
+
metadata: leadChunk.metadata,
|
|
5816
|
+
source: leadChunk.source,
|
|
5817
|
+
title: leadChunk.title
|
|
5818
|
+
});
|
|
5819
|
+
existing.structure = leadChunk.structure ?? buildRAGChunkStructure(leadChunk.metadata);
|
|
5820
|
+
existing.source = leadChunk.source;
|
|
5821
|
+
existing.title = leadChunk.title;
|
|
5822
|
+
}
|
|
5746
5823
|
};
|
|
5747
5824
|
var getLatestAssistantMessage = (messages) => {
|
|
5748
5825
|
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
@@ -7515,5 +7592,5 @@ export {
|
|
|
7515
7592
|
buildRAGEvaluationLeaderboard
|
|
7516
7593
|
};
|
|
7517
7594
|
|
|
7518
|
-
//# debugId=
|
|
7595
|
+
//# debugId=EFA1619967730BA064756E2164756E21
|
|
7519
7596
|
//# sourceMappingURL=index.js.map
|