@absolutejs/absolute 0.19.0-beta.607 → 0.19.0-beta.609
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 +142 -18
- package/dist/ai/client/index.js.map +4 -4
- package/dist/ai/client/ui.js +143 -18
- package/dist/ai/client/ui.js.map +4 -4
- package/dist/ai/index.js +371 -28
- package/dist/ai/index.js.map +7 -7
- package/dist/ai/rag/quality.js +92 -16
- package/dist/ai/rag/quality.js.map +3 -3
- package/dist/ai/rag/ui.js +143 -18
- package/dist/ai/rag/ui.js.map +4 -4
- package/dist/ai-client/angular/ai/index.js +141 -17
- package/dist/ai-client/react/ai/index.js +141 -17
- package/dist/ai-client/vue/ai/index.js +141 -17
- package/dist/angular/ai/index.js +142 -18
- package/dist/angular/ai/index.js.map +4 -4
- package/dist/angular/index.js +2 -2
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/server.js +2 -2
- package/dist/angular/server.js.map +1 -1
- package/dist/build.js +2 -2
- package/dist/build.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react/ai/index.js +142 -18
- package/dist/react/ai/index.js.map +6 -6
- package/dist/src/ai/client/ui.d.ts +1 -1
- package/dist/src/ai/rag/index.d.ts +1 -1
- package/dist/src/ai/rag/presentation.d.ts +4 -1
- package/dist/src/ai/rag/ui.d.ts +1 -1
- package/dist/src/vue/ai/useRAG.d.ts +14 -4
- package/dist/src/vue/ai/useRAGChunkPreview.d.ts +12 -2
- package/dist/src/vue/ai/useRAGSearch.d.ts +2 -2
- package/dist/svelte/ai/index.js +142 -18
- package/dist/svelte/ai/index.js.map +6 -6
- package/dist/types/ai.d.ts +15 -2
- package/dist/vue/ai/index.js +142 -18
- package/dist/vue/ai/index.js.map +5 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { buildRAGAnswerWorkflowState, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGStreamProgress, getLatestAssistantMessage, resolveRAGStreamStage } from '../rag/workflowState';
|
|
2
2
|
export { buildRAGStreamProgress as getRAGStreamProgress } from '../rag/workflowState';
|
|
3
|
-
export { buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkGraph, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences } from '../rag/presentation';
|
|
3
|
+
export { buildRAGCitationReferenceMap, buildRAGChunkExcerpts, buildRAGChunkGraphNavigation, buildRAGChunkGraph, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences } from '../rag/presentation';
|
|
4
4
|
export type { RAGStreamProgress, RAGStreamProgressState } from '../rag/workflowState';
|
|
5
5
|
export type { RAGAnswerWorkflowState } from '../../../types/ai';
|
|
@@ -10,7 +10,7 @@ export { createRAGGmailEmailSyncClient, createRAGGraphEmailSyncClient, createRAG
|
|
|
10
10
|
export { buildRAGUpsertInputFromDirectory, buildRAGUpsertInputFromDocuments, buildRAGUpsertInputFromUploads, createBuiltinArchiveExpander, createEmailExtractor, createEPUBExtractor, createLegacyDocumentExtractor, createRAGPDFOCRExtractor, createRAGArchiveExpander, createRAGArchiveFileExtractor, createOfficeDocumentExtractor, createPDFFileExtractor, createRAGFileExtractor, createRAGImageOCRExtractor, createRAGMediaFileExtractor, createRAGMediaTranscriber, createRAGOCRProvider, createTextFileExtractor, loadRAGDocumentFromURL, loadRAGDocumentUpload, loadRAGDocumentsFromUploads, buildRAGUpsertInputFromURLs, loadRAGDocumentFile, loadRAGDocumentsFromDirectory, loadRAGDocumentsFromURLs, prepareRAGDirectoryDocuments, prepareRAGDocument, prepareRAGDocumentFile, prepareRAGDocuments } from './ingestion';
|
|
11
11
|
export { buildRAGContext } from './types';
|
|
12
12
|
export { buildRAGEvaluationLeaderboard, buildRAGEvaluationResponse, compareRAGRetrievalStrategies, compareRAGRerankers, buildRAGAnswerGroundingCaseDifficultyLeaderboard, buildRAGAnswerGroundingCaseDifficultyRunDiff, buildRAGAnswerGroundingEvaluationLeaderboard, buildRAGAnswerGroundingEvaluationResponse, buildRAGAnswerGroundingEvaluationRunDiff, buildRAGRetrievalComparisonDecisionSummary, buildRAGRetrievalReleaseVerdict, createRAGFileAnswerGroundingCaseDifficultyHistoryStore, createRAGFileAnswerGroundingEvaluationHistoryStore, createRAGFileEvaluationHistoryStore, createRAGFileRetrievalBaselineStore, createRAGFileRetrievalComparisonHistoryStore, createRAGFileRetrievalLaneHandoffDecisionStore, createRAGFileRetrievalLaneHandoffIncidentStore, createRAGFileRetrievalLaneHandoffIncidentHistoryStore, createRAGFileRetrievalIncidentRemediationDecisionStore, createRAGFileRetrievalIncidentRemediationExecutionHistoryStore, createRAGFileRetrievalLaneHandoffAutoCompletePolicyHistoryStore, createRAGFileRetrievalReleaseLanePolicyHistoryStore, createRAGFileRetrievalBaselineGatePolicyHistoryStore, createRAGFileRetrievalReleaseLaneEscalationPolicyHistoryStore, createRAGFileRetrievalReleaseDecisionStore, createRAGFileRetrievalReleaseIncidentStore, createRAGFileSearchTraceStore, createRAGFileSearchTracePruneHistoryStore, createRAGSQLiteSearchTraceStore, createRAGEvaluationSuite, evaluateRAGAnswerGrounding, evaluateRAGAnswerGroundingCase, evaluateRAGCollection, executeDryRunRAGEvaluation, loadRAGAnswerGroundingCaseDifficultyHistory, loadRAGAnswerGroundingEvaluationHistory, loadRAGEvaluationHistory, loadRAGRetrievalBaselines, loadRAGRetrievalComparisonHistory, loadRAGRetrievalLaneHandoffDecisions, loadRAGRetrievalLaneHandoffIncidents, loadRAGRetrievalLaneHandoffIncidentHistory, loadRAGRetrievalIncidentRemediationDecisions, loadRAGRetrievalIncidentRemediationExecutionHistory, loadRAGRetrievalLaneHandoffAutoCompletePolicyHistory, loadRAGRetrievalReleaseLanePolicyHistory, loadRAGRetrievalBaselineGatePolicyHistory, loadRAGRetrievalReleaseLaneEscalationPolicyHistory, loadRAGRetrievalReleaseDecisions, loadRAGRetrievalReleaseIncidents, loadRAGSearchTraceGroupHistory, loadRAGSearchTraceHistory, loadRAGSearchTracePruneHistory, previewRAGSearchTraceStorePrune, persistRAGRetrievalBaseline, persistRAGRetrievalComparisonRun, persistRAGRetrievalLaneHandoffDecision, persistRAGRetrievalLaneHandoffIncident, persistRAGRetrievalLaneHandoffIncidentHistory, persistRAGRetrievalIncidentRemediationDecision, persistRAGRetrievalIncidentRemediationExecutionHistory, persistRAGRetrievalLaneHandoffAutoCompletePolicyHistory, persistRAGRetrievalReleaseLanePolicyHistory, persistRAGRetrievalBaselineGatePolicyHistory, persistRAGRetrievalReleaseLaneEscalationPolicyHistory, persistRAGRetrievalReleaseDecision, persistRAGRetrievalReleaseIncident, persistRAGSearchTracePruneRun, pruneRAGSearchTraceStore, summarizeRAGSearchTraceStore, buildRAGRetrievalTraceHistoryTrend, persistRAGAnswerGroundingCaseDifficultyRun, persistRAGAnswerGroundingEvaluationRun, persistRAGEvaluationSuiteRun, persistRAGSearchTraceRecord, runRAGEvaluationSuite, summarizeRAGEvaluationCase, summarizeRAGRerankerComparison, compareRAGRetrievalTraceSummaries, summarizeRAGRetrievalTraces, buildRAGEvaluationRunDiff, buildRAGSearchTraceDiff, buildRAGSearchTraceRecord } from './quality';
|
|
13
|
-
export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGCorpusHealthPresentation, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGGroundingReferences, buildRAGQualityOverviewPresentation, buildRAGReadinessPresentation, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGRerankerOverviewPresentation, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalTracePresentation, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './ui';
|
|
13
|
+
export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkExcerpts, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGCorpusHealthPresentation, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGGroundingReferences, buildRAGQualityOverviewPresentation, buildRAGReadinessPresentation, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGRerankerOverviewPresentation, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalTracePresentation, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './ui';
|
|
14
14
|
export { createRAGBunS3SyncClient, createRAGDirectorySyncSource, createRAGEmailSyncSource, createRAGFileSyncStateStore, createRAGStaticEmailSyncClient, createRAGStorageSyncSource, createRAGSyncManager, createRAGSyncScheduler, createRAGUrlSyncSource } from './sync';
|
|
15
15
|
export { createRAGCollection, ingestDocuments, ingestRAGDocuments, searchDocuments } from './collection';
|
|
16
16
|
export { createInMemoryRAGStore } from './adapters/inMemory';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RAGAdminActionPresentation, RAGAdminActionRecord, RAGAdminJobPresentation, RAGAdminJobRecord, AIMessage, RAGAnswerGroundingCaseSnapshotPresentation, RAGAnswerGroundingEvaluationHistory, RAGAnswerGroundingEvaluationResponse, RAGCorpusHealth, RAGCorpusHealthPresentation, RAGExtractorReadiness, RAGReadinessPresentation, RAGGroundingOverviewPresentation, RAGGroundingProviderCaseComparisonPresentation, RAGGroundingProviderOverviewPresentation, RAGGroundingProviderPresentation, RAGComparisonOverviewPresentation, RAGComparisonPresentation, RAGChunkGraph, RAGChunkGraphNavigation, RAGChunkStructure, RAGDocumentChunkPreview, RAGLabelValueRow, RAGRerankerComparisonEntry, RAGRetrievalComparison, RAGRetrievalComparisonEntry, RAGRetrievalTrace, RAGQualityOverviewPresentation, RAGEvaluationCaseTracePresentation, RAGEvaluationHistory, RAGAnswerGroundingHistoryPresentation, RAGEvaluationHistoryPresentation, RAGRerankerComparison, RAGAnswerWorkflowState, RAGRetrievalTracePresentation, RAGSource, RAGSourceLabels, RAGSourceGroup, RAGSourceSummary, RAGStreamStage, RAGSyncOverviewPresentation, RAGSyncSourcePresentation, RAGSyncSourceRecord } from '../../../types/ai';
|
|
1
|
+
import type { RAGAdminActionPresentation, RAGAdminActionRecord, RAGAdminJobPresentation, RAGAdminJobRecord, AIMessage, RAGAnswerGroundingCaseSnapshotPresentation, RAGAnswerGroundingEvaluationHistory, RAGAnswerGroundingEvaluationResponse, RAGCorpusHealth, RAGCorpusHealthPresentation, RAGExtractorReadiness, RAGReadinessPresentation, RAGGroundingOverviewPresentation, RAGGroundingProviderCaseComparisonPresentation, RAGGroundingProviderOverviewPresentation, RAGGroundingProviderPresentation, RAGComparisonOverviewPresentation, RAGComparisonPresentation, RAGChunkGraph, RAGChunkExcerpts, RAGChunkGraphNavigation, RAGChunkStructure, RAGDocumentChunkPreview, RAGLabelValueRow, RAGRerankerComparisonEntry, RAGRetrievalComparison, RAGRetrievalComparisonEntry, RAGRetrievalTrace, RAGQualityOverviewPresentation, RAGEvaluationCaseTracePresentation, RAGEvaluationHistory, RAGAnswerGroundingHistoryPresentation, RAGEvaluationHistoryPresentation, RAGRerankerComparison, RAGAnswerWorkflowState, RAGRetrievalTracePresentation, RAGSource, RAGSourceLabels, RAGSourceGroup, RAGSourceSummary, RAGStreamStage, RAGSyncOverviewPresentation, RAGSyncSourcePresentation, RAGSyncSourceRecord } from '../../../types/ai';
|
|
2
2
|
import { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences } from './grounding';
|
|
3
3
|
export { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences };
|
|
4
4
|
export declare const buildRAGRetrievalTracePresentation: (trace?: RAGRetrievalTrace) => RAGRetrievalTracePresentation;
|
|
@@ -17,6 +17,9 @@ export declare const buildRAGSourceLabels: ({ metadata, source, title }: {
|
|
|
17
17
|
title?: string;
|
|
18
18
|
}) => RAGSourceLabels | undefined;
|
|
19
19
|
export declare const buildRAGChunkStructure: (metadata?: Record<string, unknown>) => RAGChunkStructure | undefined;
|
|
20
|
+
type ExcerptChunkInput = Pick<RAGSource, 'chunkId' | 'metadata' | 'structure' | 'text'>;
|
|
21
|
+
export declare const buildRAGChunkExcerpts: (chunks: ExcerptChunkInput[], activeChunkId?: string) => RAGChunkExcerpts | undefined;
|
|
22
|
+
export declare const buildRAGPreferredExcerpt: (excerpts?: RAGChunkExcerpts, structure?: RAGChunkStructure) => string;
|
|
20
23
|
type GraphChunkInput = Pick<RAGSource, 'chunkId' | 'metadata' | 'source' | 'title' | 'labels' | 'structure'> & Partial<Pick<RAGSource, 'score'>>;
|
|
21
24
|
export declare const buildRAGChunkGraph: (chunks: GraphChunkInput[]) => RAGChunkGraph;
|
|
22
25
|
export declare const buildRAGChunkPreviewGraph: (preview: Pick<RAGDocumentChunkPreview, "chunks" | "document">) => RAGChunkGraph;
|
package/dist/src/ai/rag/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGCorpusHealthPresentation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences, buildRAGReadinessPresentation, buildRAGRetrievalTracePresentation, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './presentation';
|
|
1
|
+
export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkExcerpts, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGCorpusHealthPresentation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences, buildRAGReadinessPresentation, buildRAGRetrievalTracePresentation, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './presentation';
|
|
2
2
|
export { buildRAGAnswerWorkflowState, buildRAGRetrievedState, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGStreamProgress, getLatestAssistantMessage, getLatestRAGSources, resolveRAGStreamStage } from './workflowState';
|
|
3
3
|
export { buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGQualityOverviewPresentation, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows } from './presentation';
|
|
4
4
|
export type { RAGStreamProgress, RAGStreamProgressState } from './workflowState';
|
|
@@ -47,7 +47,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
47
47
|
title?: string | undefined;
|
|
48
48
|
path?: string[] | undefined;
|
|
49
49
|
depth?: number | undefined;
|
|
50
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
50
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
51
51
|
} | undefined;
|
|
52
52
|
sequence?: {
|
|
53
53
|
sectionChunkId?: string | undefined;
|
|
@@ -62,6 +62,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
62
62
|
locatorLabel?: string | undefined;
|
|
63
63
|
provenanceLabel?: string | undefined;
|
|
64
64
|
} | undefined;
|
|
65
|
+
excerpts?: {
|
|
66
|
+
chunkExcerpt: string;
|
|
67
|
+
windowExcerpt: string;
|
|
68
|
+
sectionExcerpt: string;
|
|
69
|
+
} | undefined;
|
|
65
70
|
}[];
|
|
66
71
|
} | null, import("../..").RAGDocumentChunkPreview | {
|
|
67
72
|
document: {
|
|
@@ -95,7 +100,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
95
100
|
title?: string | undefined;
|
|
96
101
|
path?: string[] | undefined;
|
|
97
102
|
depth?: number | undefined;
|
|
98
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
103
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
99
104
|
} | undefined;
|
|
100
105
|
sequence?: {
|
|
101
106
|
sectionChunkId?: string | undefined;
|
|
@@ -110,6 +115,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
110
115
|
locatorLabel?: string | undefined;
|
|
111
116
|
provenanceLabel?: string | undefined;
|
|
112
117
|
} | undefined;
|
|
118
|
+
excerpts?: {
|
|
119
|
+
chunkExcerpt: string;
|
|
120
|
+
windowExcerpt: string;
|
|
121
|
+
sectionExcerpt: string;
|
|
122
|
+
} | undefined;
|
|
113
123
|
}[];
|
|
114
124
|
} | null>;
|
|
115
125
|
selectChildSection: (sectionId: string) => void;
|
|
@@ -1360,7 +1370,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
1360
1370
|
title?: string | undefined;
|
|
1361
1371
|
path?: string[] | undefined;
|
|
1362
1372
|
depth?: number | undefined;
|
|
1363
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
1373
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
1364
1374
|
} | undefined;
|
|
1365
1375
|
sequence?: {
|
|
1366
1376
|
sectionChunkId?: string | undefined;
|
|
@@ -1387,7 +1397,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
1387
1397
|
title?: string | undefined;
|
|
1388
1398
|
path?: string[] | undefined;
|
|
1389
1399
|
depth?: number | undefined;
|
|
1390
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
1400
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
1391
1401
|
} | undefined;
|
|
1392
1402
|
sequence?: {
|
|
1393
1403
|
sectionChunkId?: string | undefined;
|
|
@@ -41,7 +41,7 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
41
41
|
title?: string | undefined;
|
|
42
42
|
path?: string[] | undefined;
|
|
43
43
|
depth?: number | undefined;
|
|
44
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
44
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
45
45
|
} | undefined;
|
|
46
46
|
sequence?: {
|
|
47
47
|
sectionChunkId?: string | undefined;
|
|
@@ -56,6 +56,11 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
56
56
|
locatorLabel?: string | undefined;
|
|
57
57
|
provenanceLabel?: string | undefined;
|
|
58
58
|
} | undefined;
|
|
59
|
+
excerpts?: {
|
|
60
|
+
chunkExcerpt: string;
|
|
61
|
+
windowExcerpt: string;
|
|
62
|
+
sectionExcerpt: string;
|
|
63
|
+
} | undefined;
|
|
59
64
|
}[];
|
|
60
65
|
} | null, RAGDocumentChunkPreview | {
|
|
61
66
|
document: {
|
|
@@ -89,7 +94,7 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
89
94
|
title?: string | undefined;
|
|
90
95
|
path?: string[] | undefined;
|
|
91
96
|
depth?: number | undefined;
|
|
92
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
97
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
93
98
|
} | undefined;
|
|
94
99
|
sequence?: {
|
|
95
100
|
sectionChunkId?: string | undefined;
|
|
@@ -104,6 +109,11 @@ export declare const useRAGChunkPreview: (path: string) => {
|
|
|
104
109
|
locatorLabel?: string | undefined;
|
|
105
110
|
provenanceLabel?: string | undefined;
|
|
106
111
|
} | undefined;
|
|
112
|
+
excerpts?: {
|
|
113
|
+
chunkExcerpt: string;
|
|
114
|
+
windowExcerpt: string;
|
|
115
|
+
sectionExcerpt: string;
|
|
116
|
+
} | undefined;
|
|
107
117
|
}[];
|
|
108
118
|
} | null>;
|
|
109
119
|
selectChildSection: (sectionId: string) => void;
|
|
@@ -80,7 +80,7 @@ export declare const useRAGSearch: (path: string) => {
|
|
|
80
80
|
title?: string | undefined;
|
|
81
81
|
path?: string[] | undefined;
|
|
82
82
|
depth?: number | undefined;
|
|
83
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
83
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
84
84
|
} | undefined;
|
|
85
85
|
sequence?: {
|
|
86
86
|
sectionChunkId?: string | undefined;
|
|
@@ -107,7 +107,7 @@ export declare const useRAGSearch: (path: string) => {
|
|
|
107
107
|
title?: string | undefined;
|
|
108
108
|
path?: string[] | undefined;
|
|
109
109
|
depth?: number | undefined;
|
|
110
|
-
kind?: "markdown_heading" | "html_heading" | undefined;
|
|
110
|
+
kind?: "markdown_heading" | "html_heading" | "office_heading" | "spreadsheet_rows" | "presentation_slide" | undefined;
|
|
111
111
|
} | undefined;
|
|
112
112
|
sequence?: {
|
|
113
113
|
sectionChunkId?: string | undefined;
|
package/dist/svelte/ai/index.js
CHANGED
|
@@ -347,6 +347,60 @@ var buildExcerpt = (text, maxLength = 160) => {
|
|
|
347
347
|
}
|
|
348
348
|
return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}\u2026`;
|
|
349
349
|
};
|
|
350
|
+
var selectPreferredExcerpt = (excerpts, sectionChunkCount) => {
|
|
351
|
+
if (!excerpts) {
|
|
352
|
+
return "";
|
|
353
|
+
}
|
|
354
|
+
const chunkExcerpt = excerpts.chunkExcerpt?.trim() ?? "";
|
|
355
|
+
const windowExcerpt = excerpts.windowExcerpt?.trim() ?? "";
|
|
356
|
+
const sectionExcerpt = excerpts.sectionExcerpt?.trim() ?? "";
|
|
357
|
+
if (sectionChunkCount && sectionChunkCount > 1 && chunkExcerpt.length > 0 && chunkExcerpt.length < 72) {
|
|
358
|
+
if (sectionChunkCount <= 3 && sectionExcerpt) {
|
|
359
|
+
return sectionExcerpt;
|
|
360
|
+
}
|
|
361
|
+
if (windowExcerpt) {
|
|
362
|
+
return windowExcerpt;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return chunkExcerpt || windowExcerpt || sectionExcerpt;
|
|
366
|
+
};
|
|
367
|
+
var buildGroundingChunkExcerpts = (sources, activeChunkId) => {
|
|
368
|
+
if (sources.length === 0) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const activeSource = (activeChunkId ? sources.find((source) => source.chunkId === activeChunkId) : undefined) ?? sources[0];
|
|
372
|
+
if (!activeSource) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const chunkMap = new Map(sources.map((source) => [source.chunkId, source]));
|
|
376
|
+
const activeMetadata = activeSource.metadata ?? {};
|
|
377
|
+
const previousChunkId = getContextString(activeMetadata.previousChunkId);
|
|
378
|
+
const nextChunkId = getContextString(activeMetadata.nextChunkId);
|
|
379
|
+
const sectionChunkId = getContextString(activeMetadata.sectionChunkId);
|
|
380
|
+
const sectionSources = sectionChunkId ? sources.filter((source) => getContextString(source.metadata?.sectionChunkId) === sectionChunkId).sort((left, right) => {
|
|
381
|
+
const leftIndex = getContextNumber(left.metadata?.sectionChunkIndex) ?? Number.MAX_SAFE_INTEGER;
|
|
382
|
+
const rightIndex = getContextNumber(right.metadata?.sectionChunkIndex) ?? Number.MAX_SAFE_INTEGER;
|
|
383
|
+
if (leftIndex !== rightIndex) {
|
|
384
|
+
return leftIndex - rightIndex;
|
|
385
|
+
}
|
|
386
|
+
return left.chunkId.localeCompare(right.chunkId);
|
|
387
|
+
}) : [activeSource];
|
|
388
|
+
const collectText = (chunkIds) => chunkIds.map((chunkId) => chunkMap.get(chunkId)?.text).filter((text) => typeof text === "string").join(`
|
|
389
|
+
|
|
390
|
+
`);
|
|
391
|
+
const orderedWindowIds = [
|
|
392
|
+
previousChunkId,
|
|
393
|
+
activeSource.chunkId,
|
|
394
|
+
nextChunkId
|
|
395
|
+
].filter((chunkId, index, values) => Boolean(chunkId) && values.indexOf(chunkId) === index);
|
|
396
|
+
return {
|
|
397
|
+
chunkExcerpt: buildExcerpt(activeSource.text, 160),
|
|
398
|
+
sectionExcerpt: buildExcerpt(sectionSources.map((source) => source.text).join(`
|
|
399
|
+
|
|
400
|
+
`), 320),
|
|
401
|
+
windowExcerpt: buildExcerpt(collectText(orderedWindowIds), 240)
|
|
402
|
+
};
|
|
403
|
+
};
|
|
350
404
|
var buildGroundingReferenceEvidenceLabel = (reference) => [reference.label, reference.locatorLabel, reference.contextLabel].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
|
|
351
405
|
var buildGroundingReferenceEvidenceSummary = (reference) => [
|
|
352
406
|
reference.source ?? reference.title ?? reference.chunkId,
|
|
@@ -365,7 +419,8 @@ var buildGroundedAnswerCitationDetail = (reference) => ({
|
|
|
365
419
|
contextLabel: reference.contextLabel,
|
|
366
420
|
evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
|
|
367
421
|
evidenceSummary: buildGroundingReferenceEvidenceSummary(reference),
|
|
368
|
-
excerpt: reference.excerpt,
|
|
422
|
+
excerpt: selectPreferredExcerpt(reference.excerpts, getContextNumber(reference.metadata?.sectionChunkCount)) || reference.excerpt,
|
|
423
|
+
excerpts: reference.excerpts,
|
|
369
424
|
label: reference.label,
|
|
370
425
|
locatorLabel: reference.locatorLabel,
|
|
371
426
|
number: reference.number,
|
|
@@ -385,6 +440,8 @@ var buildRAGCitations = (sources) => {
|
|
|
385
440
|
unique.set(key, {
|
|
386
441
|
chunkId: source.chunkId,
|
|
387
442
|
contextLabel: source.labels?.contextLabel ?? buildContextLabel(source.metadata),
|
|
443
|
+
excerpt: selectPreferredExcerpt(buildGroundingChunkExcerpts(sources, source.chunkId), getContextNumber(source.metadata?.sectionChunkCount)) || buildExcerpt(source.text),
|
|
444
|
+
excerpts: buildGroundingChunkExcerpts(sources, source.chunkId),
|
|
388
445
|
key,
|
|
389
446
|
label: buildSourceLabel(source),
|
|
390
447
|
locatorLabel: source.labels?.locatorLabel ?? buildLocatorLabel(source.metadata, source.source, source.title),
|
|
@@ -461,10 +518,17 @@ var buildRAGGroundedAnswerSectionSummaries = (references) => {
|
|
|
461
518
|
const key = buildGroundingSectionKey(reference);
|
|
462
519
|
const existing = groups.get(key);
|
|
463
520
|
if (!existing) {
|
|
521
|
+
const excerpts = reference.excerpts ? {
|
|
522
|
+
chunkExcerpt: reference.excerpts.chunkExcerpt,
|
|
523
|
+
sectionExcerpt: reference.excerpts.sectionExcerpt,
|
|
524
|
+
windowExcerpt: reference.excerpts.windowExcerpt
|
|
525
|
+
} : undefined;
|
|
464
526
|
groups.set(key, {
|
|
465
527
|
chunkIds: [reference.chunkId],
|
|
466
528
|
contextLabel: reference.contextLabel,
|
|
467
529
|
count: 1,
|
|
530
|
+
excerpt: selectPreferredExcerpt(excerpts, getContextNumber(reference.metadata?.sectionChunkCount)) || excerpts?.sectionExcerpt || reference.excerpt,
|
|
531
|
+
excerpts,
|
|
468
532
|
key,
|
|
469
533
|
label: key,
|
|
470
534
|
locatorLabel: reference.locatorLabel,
|
|
@@ -492,6 +556,14 @@ var buildRAGGroundedAnswerSectionSummaries = (references) => {
|
|
|
492
556
|
if (!existing.provenanceLabel && reference.provenanceLabel) {
|
|
493
557
|
existing.provenanceLabel = reference.provenanceLabel;
|
|
494
558
|
}
|
|
559
|
+
if (!existing.excerpts && reference.excerpts) {
|
|
560
|
+
existing.excerpts = {
|
|
561
|
+
chunkExcerpt: reference.excerpts.chunkExcerpt,
|
|
562
|
+
sectionExcerpt: reference.excerpts.sectionExcerpt,
|
|
563
|
+
windowExcerpt: reference.excerpts.windowExcerpt
|
|
564
|
+
};
|
|
565
|
+
existing.excerpt = reference.excerpts.sectionExcerpt;
|
|
566
|
+
}
|
|
495
567
|
}
|
|
496
568
|
return [...groups.values()].map((group) => ({
|
|
497
569
|
...group,
|
|
@@ -509,20 +581,24 @@ var buildRAGGroundedAnswerSectionSummaries = (references) => {
|
|
|
509
581
|
var buildRAGGroundingReferences = (sources) => {
|
|
510
582
|
const citations = buildRAGCitations(sources);
|
|
511
583
|
const citationReferenceMap = buildRAGCitationReferenceMap(citations);
|
|
512
|
-
return citations.map((citation) =>
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
584
|
+
return citations.map((citation) => {
|
|
585
|
+
const excerpts = buildGroundingChunkExcerpts(sources, citation.chunkId);
|
|
586
|
+
return {
|
|
587
|
+
chunkId: citation.chunkId,
|
|
588
|
+
contextLabel: citation.contextLabel ?? buildContextLabel(citation.metadata),
|
|
589
|
+
excerpt: selectPreferredExcerpt(excerpts, getContextNumber(citation.metadata?.sectionChunkCount)) || excerpts?.chunkExcerpt || buildExcerpt(citation.text),
|
|
590
|
+
excerpts,
|
|
591
|
+
label: citation.label,
|
|
592
|
+
locatorLabel: citation.locatorLabel ?? buildLocatorLabel(citation.metadata, citation.source, citation.title),
|
|
593
|
+
metadata: citation.metadata,
|
|
594
|
+
number: citationReferenceMap[citation.chunkId] ?? 0,
|
|
595
|
+
provenanceLabel: citation.provenanceLabel ?? buildProvenanceLabel(citation.metadata),
|
|
596
|
+
score: citation.score,
|
|
597
|
+
source: citation.source,
|
|
598
|
+
text: citation.text,
|
|
599
|
+
title: citation.title
|
|
600
|
+
};
|
|
601
|
+
});
|
|
526
602
|
};
|
|
527
603
|
|
|
528
604
|
// src/ai/rag/quality.ts
|
|
@@ -4182,7 +4258,7 @@ var buildRAGChunkStructure = (metadata) => {
|
|
|
4182
4258
|
return;
|
|
4183
4259
|
}
|
|
4184
4260
|
const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.filter((value) => typeof value === "string" && value.trim().length > 0) : undefined;
|
|
4185
|
-
const sectionKind = metadata.sectionKind === "markdown_heading" || metadata.sectionKind === "html_heading" ? metadata.sectionKind : undefined;
|
|
4261
|
+
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;
|
|
4186
4262
|
const section = {
|
|
4187
4263
|
depth: getContextNumber2(metadata.sectionDepth),
|
|
4188
4264
|
kind: sectionKind,
|
|
@@ -4211,6 +4287,52 @@ var buildExcerpt2 = (text, maxLength = 160) => {
|
|
|
4211
4287
|
}
|
|
4212
4288
|
return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}\u2026`;
|
|
4213
4289
|
};
|
|
4290
|
+
var buildRAGChunkExcerpts = (chunks, activeChunkId) => {
|
|
4291
|
+
if (chunks.length === 0) {
|
|
4292
|
+
return;
|
|
4293
|
+
}
|
|
4294
|
+
const graph = buildRAGChunkGraph(chunks.map((chunk) => ({
|
|
4295
|
+
chunkId: chunk.chunkId,
|
|
4296
|
+
metadata: chunk.metadata,
|
|
4297
|
+
structure: chunk.structure
|
|
4298
|
+
})));
|
|
4299
|
+
const navigation = buildRAGChunkGraphNavigation(graph, activeChunkId);
|
|
4300
|
+
const activeChunk = chunks.find((chunk) => chunk.chunkId === navigation.activeChunkId) ?? chunks[0];
|
|
4301
|
+
if (!activeChunk) {
|
|
4302
|
+
return;
|
|
4303
|
+
}
|
|
4304
|
+
const chunkMap = new Map(chunks.map((chunk) => [chunk.chunkId, chunk]));
|
|
4305
|
+
const orderedWindowIds = [
|
|
4306
|
+
navigation.previousNode?.chunkId,
|
|
4307
|
+
activeChunk.chunkId,
|
|
4308
|
+
navigation.nextNode?.chunkId
|
|
4309
|
+
].filter((chunkId, index, ids) => Boolean(chunkId) && ids.indexOf(chunkId) === index);
|
|
4310
|
+
const orderedSectionIds = navigation.sectionNodes.length > 0 ? navigation.sectionNodes.map((node) => node.chunkId) : [activeChunk.chunkId];
|
|
4311
|
+
const collectText = (chunkIds) => chunkIds.map((chunkId) => chunkMap.get(chunkId)?.text).filter((text) => typeof text === "string").join(`
|
|
4312
|
+
|
|
4313
|
+
`);
|
|
4314
|
+
return {
|
|
4315
|
+
chunkExcerpt: buildExcerpt2(activeChunk.text, 160),
|
|
4316
|
+
sectionExcerpt: buildExcerpt2(collectText(orderedSectionIds), 320),
|
|
4317
|
+
windowExcerpt: buildExcerpt2(collectText(orderedWindowIds), 240)
|
|
4318
|
+
};
|
|
4319
|
+
};
|
|
4320
|
+
var buildRAGPreferredExcerpt = (excerpts, structure) => {
|
|
4321
|
+
if (!excerpts) {
|
|
4322
|
+
return "";
|
|
4323
|
+
}
|
|
4324
|
+
const chunkLength = excerpts.chunkExcerpt.trim().length;
|
|
4325
|
+
const sectionChunkCount = structure?.sequence?.sectionChunkCount ?? 1;
|
|
4326
|
+
if (sectionChunkCount > 1 && chunkLength > 0 && chunkLength < 72) {
|
|
4327
|
+
if (sectionChunkCount <= 3 && excerpts.sectionExcerpt.trim().length > 0) {
|
|
4328
|
+
return excerpts.sectionExcerpt;
|
|
4329
|
+
}
|
|
4330
|
+
if (excerpts.windowExcerpt.trim().length > 0) {
|
|
4331
|
+
return excerpts.windowExcerpt;
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
return excerpts.chunkExcerpt;
|
|
4335
|
+
};
|
|
4214
4336
|
var buildRAGChunkGraph = (chunks) => {
|
|
4215
4337
|
const nodes = [];
|
|
4216
4338
|
const edges = [];
|
|
@@ -4422,6 +4544,7 @@ var buildRAGSourceSummaries = (sources) => {
|
|
|
4422
4544
|
return sourceGroups.map((group) => {
|
|
4423
4545
|
const groupCitations = citations.filter((citation) => group.chunks.some((chunk) => chunk.chunkId === citation.chunkId));
|
|
4424
4546
|
const leadChunk = group.chunks.slice().sort((left, right) => right.score - left.score)[0];
|
|
4547
|
+
const excerpts = leadChunk ? buildRAGChunkExcerpts(group.chunks, leadChunk.chunkId) : undefined;
|
|
4425
4548
|
return {
|
|
4426
4549
|
bestScore: group.bestScore,
|
|
4427
4550
|
citationNumbers: groupCitations.map((citation) => citationReferenceMap[citation.chunkId] ?? 0),
|
|
@@ -4429,7 +4552,8 @@ var buildRAGSourceSummaries = (sources) => {
|
|
|
4429
4552
|
chunkIds: group.chunks.map((chunk) => chunk.chunkId),
|
|
4430
4553
|
contextLabel: leadChunk?.labels?.contextLabel ?? buildContextLabel2(leadChunk?.metadata),
|
|
4431
4554
|
count: group.count,
|
|
4432
|
-
excerpt: buildExcerpt2(leadChunk?.text ?? ""),
|
|
4555
|
+
excerpt: buildRAGPreferredExcerpt(excerpts, leadChunk?.structure ?? buildRAGChunkStructure(leadChunk?.metadata)) || buildExcerpt2(leadChunk?.text ?? ""),
|
|
4556
|
+
excerpts,
|
|
4433
4557
|
key: group.key,
|
|
4434
4558
|
label: group.label,
|
|
4435
4559
|
locatorLabel: leadChunk?.labels?.locatorLabel ?? buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
|
|
@@ -7724,5 +7848,5 @@ export {
|
|
|
7724
7848
|
createAIStream
|
|
7725
7849
|
};
|
|
7726
7850
|
|
|
7727
|
-
//# debugId=
|
|
7851
|
+
//# debugId=8E3536F71E27F44564756E2164756E21
|
|
7728
7852
|
//# sourceMappingURL=index.js.map
|