@absolutejs/voice 0.0.1
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/README.md +150 -0
- package/dist/absolutejs/src/angular/angularDeps.d.ts +2 -0
- package/dist/absolutejs/src/angular/angularPatch.d.ts +1 -0
- package/dist/absolutejs/src/angular/injectorPatch.d.ts +1 -0
- package/dist/absolutejs/src/angular/islands.d.ts +3 -0
- package/dist/absolutejs/src/angular/lowerDeferSyntax.d.ts +18 -0
- package/dist/absolutejs/src/angular/lowerServerIslands.d.ts +1 -0
- package/dist/absolutejs/src/angular/pageHandler.d.ts +26 -0
- package/dist/absolutejs/src/angular/resolveAngularPackage.d.ts +7 -0
- package/dist/absolutejs/src/angular/ssrRender.d.ts +16 -0
- package/dist/absolutejs/src/angular/ssrSanitizer.d.ts +3 -0
- package/dist/absolutejs/src/build/angularLinkerPlugin.d.ts +11 -0
- package/dist/absolutejs/src/build/buildAngularVendor.d.ts +4 -0
- package/dist/absolutejs/src/build/buildDepVendor.d.ts +2 -0
- package/dist/absolutejs/src/build/buildReactVendor.d.ts +8 -0
- package/dist/absolutejs/src/build/buildSvelteVendor.d.ts +6 -0
- package/dist/absolutejs/src/build/buildVueVendor.d.ts +6 -0
- package/dist/absolutejs/src/build/compileAngular.d.ts +29 -0
- package/dist/absolutejs/src/build/compileSvelte.d.ts +13 -0
- package/dist/absolutejs/src/build/compileVue.d.ts +19 -0
- package/dist/absolutejs/src/build/generateManifest.d.ts +2 -0
- package/dist/absolutejs/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/absolutejs/src/build/htmlScriptHMRPlugin.d.ts +13 -0
- package/dist/absolutejs/src/build/islandEntries.d.ts +32 -0
- package/dist/absolutejs/src/build/nativeRewrite.d.ts +5 -0
- package/dist/absolutejs/src/build/optimizeHtmlImages.d.ts +2 -0
- package/dist/absolutejs/src/build/outputLogs.d.ts +1 -0
- package/dist/absolutejs/src/build/resolvePackageImport.d.ts +9 -0
- package/dist/absolutejs/src/build/rewriteImports.d.ts +7 -0
- package/dist/absolutejs/src/build/rewriteReactImports.d.ts +7 -0
- package/dist/absolutejs/src/build/scanConventions.d.ts +5 -0
- package/dist/absolutejs/src/build/scanCssEntryPoints.d.ts +1 -0
- package/dist/absolutejs/src/build/scanEntryPoints.d.ts +1 -0
- package/dist/absolutejs/src/build/staticIslandPages.d.ts +9 -0
- package/dist/absolutejs/src/build/updateAssetPaths.d.ts +1 -0
- package/dist/absolutejs/src/build/wrapHTMLScript.d.ts +17 -0
- package/dist/absolutejs/src/cli/scripts/telemetry.d.ts +5 -0
- package/dist/absolutejs/src/cli/telemetryEvent.d.ts +1 -0
- package/dist/absolutejs/src/client/islandStore.d.ts +22 -0
- package/dist/absolutejs/src/client/streamSwap.d.ts +11 -0
- package/dist/absolutejs/src/constants.d.ts +60 -0
- package/dist/absolutejs/src/core/build.d.ts +9 -0
- package/dist/absolutejs/src/core/currentIslandRegistry.d.ts +7 -0
- package/dist/absolutejs/src/core/devBuild.d.ts +6 -0
- package/dist/absolutejs/src/core/devRouteRegistrationCallsite.d.ts +2 -0
- package/dist/absolutejs/src/core/devVendorPaths.d.ts +13 -0
- package/dist/absolutejs/src/core/index.d.ts +7 -0
- package/dist/absolutejs/src/core/islandManifest.d.ts +3 -0
- package/dist/absolutejs/src/core/islandMarkupAttributes.d.ts +12 -0
- package/dist/absolutejs/src/core/islandPageContext.d.ts +12 -0
- package/dist/absolutejs/src/core/islandSsr.d.ts +6 -0
- package/dist/absolutejs/src/core/islands.d.ts +16 -0
- package/dist/absolutejs/src/core/loadIslandRegistry.d.ts +1 -0
- package/dist/absolutejs/src/core/lookup.d.ts +1 -0
- package/dist/absolutejs/src/core/pageHandlers.d.ts +6 -0
- package/dist/absolutejs/src/core/prepare.d.ts +274 -0
- package/dist/absolutejs/src/core/prerender.d.ts +31 -0
- package/dist/absolutejs/src/core/renderIslandMarkup.d.ts +13 -0
- package/dist/absolutejs/src/core/responseEnhancers.d.ts +10 -0
- package/dist/absolutejs/src/core/staticStreaming.d.ts +25 -0
- package/dist/absolutejs/src/core/streamingSlotRegistrar.d.ts +16 -0
- package/dist/absolutejs/src/core/streamingSlotRegistry.d.ts +2 -0
- package/dist/absolutejs/src/core/streamingSlotWarningScope.d.ts +4 -0
- package/dist/absolutejs/src/core/svelteServerModule.d.ts +1 -0
- package/dist/absolutejs/src/core/wrapPageHandlerWithStreamingSlots.d.ts +2 -0
- package/dist/absolutejs/src/dev/assetStore.d.ts +8 -0
- package/dist/absolutejs/src/dev/buildHMRClient.d.ts +1 -0
- package/dist/absolutejs/src/dev/clientManager.d.ts +31 -0
- package/dist/absolutejs/src/dev/configResolver.d.ts +14 -0
- package/dist/absolutejs/src/dev/dependencyGraph.d.ts +10 -0
- package/dist/absolutejs/src/dev/devCert.d.ts +11 -0
- package/dist/absolutejs/src/dev/fileHashTracker.d.ts +2 -0
- package/dist/absolutejs/src/dev/fileWatcher.d.ts +4 -0
- package/dist/absolutejs/src/dev/moduleMapper.d.ts +27 -0
- package/dist/absolutejs/src/dev/moduleServer.d.ts +21 -0
- package/dist/absolutejs/src/dev/moduleVersionTracker.d.ts +7 -0
- package/dist/absolutejs/src/dev/pathUtils.d.ts +5 -0
- package/dist/absolutejs/src/dev/reactComponentClassifier.d.ts +2 -0
- package/dist/absolutejs/src/dev/rebuildTrigger.d.ts +10 -0
- package/dist/absolutejs/src/dev/simpleHTMLHMR.d.ts +4 -0
- package/dist/absolutejs/src/dev/simpleHTMXHMR.d.ts +4 -0
- package/dist/absolutejs/src/dev/transformCache.d.ts +6 -0
- package/dist/absolutejs/src/dev/webSocket.d.ts +9 -0
- package/dist/absolutejs/src/index.d.ts +5 -0
- package/dist/absolutejs/src/islands/pageMetadata.d.ts +13 -0
- package/dist/absolutejs/src/islands/sourceMetadata.d.ts +10 -0
- package/dist/absolutejs/src/plugins/devtoolsJson.d.ts +58 -0
- package/dist/absolutejs/src/plugins/hmr.d.ts +138 -0
- package/dist/absolutejs/src/plugins/imageOptimizer.d.ts +67 -0
- package/dist/absolutejs/src/plugins/index.d.ts +3 -0
- package/dist/absolutejs/src/plugins/networking.d.ts +2 -0
- package/dist/absolutejs/src/plugins/pageRouter.d.ts +1 -0
- package/dist/absolutejs/src/react/Island.d.ts +2 -0
- package/dist/absolutejs/src/react/bridgeInternals.d.ts +1 -0
- package/dist/absolutejs/src/react/createIsland.d.ts +2 -0
- package/dist/absolutejs/src/react/hooks/useIslandStore.d.ts +3 -0
- package/dist/absolutejs/src/react/index.d.ts +4 -0
- package/dist/absolutejs/src/react/pageHandler.d.ts +21 -0
- package/dist/absolutejs/src/svelte/lowerAwaitSlotSyntax.d.ts +4 -0
- package/dist/absolutejs/src/svelte/lowerIslandSyntax.d.ts +4 -0
- package/dist/absolutejs/src/svelte/pageHandler.d.ts +23 -0
- package/dist/absolutejs/src/svelte/renderToReadableStream.d.ts +14 -0
- package/dist/absolutejs/src/utils/cleanStaleOutputs.d.ts +1 -0
- package/dist/absolutejs/src/utils/cleanup.d.ts +8 -0
- package/dist/absolutejs/src/utils/commonAncestor.d.ts +1 -0
- package/dist/absolutejs/src/utils/defineConfig.d.ts +2 -0
- package/dist/absolutejs/src/utils/defineEnv.d.ts +10 -0
- package/dist/absolutejs/src/utils/escapeScriptContent.d.ts +1 -0
- package/dist/absolutejs/src/utils/generateHeadElement.d.ts +4 -0
- package/dist/absolutejs/src/utils/generateSitemap.d.ts +6 -0
- package/dist/absolutejs/src/utils/getDurationString.d.ts +1 -0
- package/dist/absolutejs/src/utils/getEnv.d.ts +1 -0
- package/dist/absolutejs/src/utils/imageProcessing.d.ts +33 -0
- package/dist/absolutejs/src/utils/index.d.ts +9 -0
- package/dist/absolutejs/src/utils/jsonLd.d.ts +2 -0
- package/dist/absolutejs/src/utils/loadConfig.d.ts +1 -0
- package/dist/absolutejs/src/utils/logger.d.ts +55 -0
- package/dist/absolutejs/src/utils/networking.d.ts +2 -0
- package/dist/absolutejs/src/utils/normalizePath.d.ts +9 -0
- package/dist/absolutejs/src/utils/registerClientScript.d.ts +36 -0
- package/dist/absolutejs/src/utils/resolveConvention.d.ts +9 -0
- package/dist/absolutejs/src/utils/ssrErrorPage.d.ts +1 -0
- package/dist/absolutejs/src/utils/startupBanner.d.ts +9 -0
- package/dist/absolutejs/src/utils/streamingSlotMetricSink.d.ts +18 -0
- package/dist/absolutejs/src/utils/streamingSlots.d.ts +76 -0
- package/dist/absolutejs/src/utils/stringModifiers.d.ts +3 -0
- package/dist/absolutejs/src/utils/validateSafePath.d.ts +1 -0
- package/dist/absolutejs/src/vue/pageHandler.d.ts +29 -0
- package/dist/absolutejs/types/ai.d.ts +4631 -0
- package/dist/absolutejs/types/angular.d.ts +29 -0
- package/dist/absolutejs/types/build.d.ts +67 -0
- package/dist/absolutejs/types/cli.d.ts +19 -0
- package/dist/absolutejs/types/client.d.ts +65 -0
- package/dist/absolutejs/types/conventions.d.ts +20 -0
- package/dist/absolutejs/types/env.d.ts +2 -0
- package/dist/absolutejs/types/image.d.ts +77 -0
- package/dist/absolutejs/types/index.d.ts +19 -0
- package/dist/absolutejs/types/island.d.ts +48 -0
- package/dist/absolutejs/types/jsonLd.d.ts +271 -0
- package/dist/absolutejs/types/messages.d.ts +144 -0
- package/dist/absolutejs/types/metadata.d.ts +49 -0
- package/dist/absolutejs/types/react.d.ts +2 -0
- package/dist/absolutejs/types/session.d.ts +16 -0
- package/dist/absolutejs/types/sitemap.d.ts +14 -0
- package/dist/absolutejs/types/svelte.d.ts +2 -0
- package/dist/absolutejs/types/telemetry.d.ts +15 -0
- package/dist/absolutejs/types/tool.d.ts +11 -0
- package/dist/absolutejs/types/typeGuards.d.ts +5 -0
- package/dist/absolutejs/types/vue.d.ts +14 -0
- package/dist/absolutejs/types/websocket.d.ts +6 -0
- package/dist/angular/index.js +505 -0
- package/dist/client/index.js +521 -0
- package/dist/index.js +693 -0
- package/dist/react/index.js +489 -0
- package/dist/svelte/index.js +456 -0
- package/dist/voice/src/angular/index.d.ts +1 -0
- package/dist/voice/src/angular/voice-stream.service.d.ts +15 -0
- package/dist/voice/src/client/actions.d.ts +58 -0
- package/dist/voice/src/client/connection.d.ts +12 -0
- package/dist/voice/src/client/createVoiceStream.d.ts +14 -0
- package/dist/voice/src/client/index.d.ts +3 -0
- package/dist/voice/src/client/microphone.d.ts +11 -0
- package/dist/voice/src/client/store.d.ts +7 -0
- package/dist/voice/src/index.d.ts +5 -0
- package/dist/voice/src/logger.d.ts +8 -0
- package/dist/voice/src/memoryStore.d.ts +2 -0
- package/dist/voice/src/plugin.d.ts +40 -0
- package/dist/voice/src/react/index.d.ts +1 -0
- package/dist/voice/src/react/useVoiceStream.d.ts +13 -0
- package/dist/voice/src/session.d.ts +2 -0
- package/dist/voice/src/store.d.ts +6 -0
- package/dist/voice/src/svelte/createVoiceStream.d.ts +14 -0
- package/dist/voice/src/svelte/index.d.ts +1 -0
- package/dist/voice/src/turnDetection.d.ts +3 -0
- package/dist/voice/src/types.d.ts +318 -0
- package/dist/voice/src/vue/index.d.ts +1 -0
- package/dist/voice/src/vue/useVoiceStream.d.ts +13 -0
- package/dist/vue/index.js +496 -0
- package/package.json +100 -0
|
@@ -0,0 +1,4631 @@
|
|
|
1
|
+
import type { SessionStore } from './session';
|
|
2
|
+
export type AIUsage = {
|
|
3
|
+
inputTokens: number;
|
|
4
|
+
outputTokens: number;
|
|
5
|
+
};
|
|
6
|
+
export type RAGExcerptMode = 'chunk' | 'window' | 'section';
|
|
7
|
+
export type RAGExcerptPromotionReason = 'single_chunk' | 'chunk_too_narrow' | 'section_small_enough' | 'section_too_large_use_window';
|
|
8
|
+
export type RAGExcerptSelection = {
|
|
9
|
+
mode: RAGExcerptMode;
|
|
10
|
+
reason: RAGExcerptPromotionReason;
|
|
11
|
+
};
|
|
12
|
+
export type RAGExcerptModeCounts = Record<RAGExcerptMode, number>;
|
|
13
|
+
export type RAGSource = {
|
|
14
|
+
chunkId: string;
|
|
15
|
+
corpusKey?: string;
|
|
16
|
+
score: number;
|
|
17
|
+
text: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
source?: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
labels?: RAGSourceLabels;
|
|
22
|
+
structure?: RAGChunkStructure;
|
|
23
|
+
};
|
|
24
|
+
export type RAGSourceGroup = {
|
|
25
|
+
key: string;
|
|
26
|
+
label: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
bestScore: number;
|
|
30
|
+
count: number;
|
|
31
|
+
chunks: RAGSource[];
|
|
32
|
+
labels?: RAGSourceLabels;
|
|
33
|
+
structure?: RAGChunkStructure;
|
|
34
|
+
};
|
|
35
|
+
export type RAGCitation = {
|
|
36
|
+
key: string;
|
|
37
|
+
label: string;
|
|
38
|
+
chunkId: string;
|
|
39
|
+
score: number;
|
|
40
|
+
text: string;
|
|
41
|
+
excerpt?: string;
|
|
42
|
+
excerpts?: RAGChunkExcerpts;
|
|
43
|
+
excerptSelection?: RAGExcerptSelection;
|
|
44
|
+
source?: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
contextLabel?: string;
|
|
47
|
+
provenanceLabel?: string;
|
|
48
|
+
locatorLabel?: string;
|
|
49
|
+
metadata?: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
export type RAGCitationReferenceMap = Record<string, number>;
|
|
52
|
+
export type RAGSourceSummary = {
|
|
53
|
+
key: string;
|
|
54
|
+
label: string;
|
|
55
|
+
source?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
bestScore: number;
|
|
58
|
+
count: number;
|
|
59
|
+
excerpt: string;
|
|
60
|
+
excerpts?: RAGChunkExcerpts;
|
|
61
|
+
excerptSelection?: RAGExcerptSelection;
|
|
62
|
+
chunkIds: string[];
|
|
63
|
+
citationNumbers: number[];
|
|
64
|
+
citations: RAGCitation[];
|
|
65
|
+
contextLabel?: string;
|
|
66
|
+
locatorLabel?: string;
|
|
67
|
+
provenanceLabel?: string;
|
|
68
|
+
structure?: RAGChunkStructure;
|
|
69
|
+
};
|
|
70
|
+
export type RAGSectionRetrievalReason = 'best_hit' | 'multi_hit_section' | 'dominant_within_parent' | 'only_section_in_parent' | 'concentrated_evidence';
|
|
71
|
+
export type RAGSectionTraceWeightReason = 'rerank_preserved_lead' | 'final_stage_concentration' | 'final_stage_dominant_within_parent' | 'stage_runner_up_pressure' | 'stage_expanded' | 'stage_held' | 'stage_narrowed';
|
|
72
|
+
export type RAGSectionQueryAttributionReason = 'base_query_only' | 'transformed_query_only' | 'variant_only' | 'transform_introduced' | 'variant_supported' | 'mixed_query_sources';
|
|
73
|
+
export type RAGSectionRetrievalDiagnostic = {
|
|
74
|
+
key: string;
|
|
75
|
+
label: string;
|
|
76
|
+
path?: string[];
|
|
77
|
+
parentLabel?: string;
|
|
78
|
+
count: number;
|
|
79
|
+
sourceCount: number;
|
|
80
|
+
bestScore: number;
|
|
81
|
+
averageScore: number;
|
|
82
|
+
totalScore: number;
|
|
83
|
+
scoreShare: number;
|
|
84
|
+
parentShare?: number;
|
|
85
|
+
parentShareGap?: number;
|
|
86
|
+
siblingCount: number;
|
|
87
|
+
strongestSiblingLabel?: string;
|
|
88
|
+
strongestSiblingScore?: number;
|
|
89
|
+
siblingScoreGap?: number;
|
|
90
|
+
topChunkId?: string;
|
|
91
|
+
topSource?: string;
|
|
92
|
+
topContextLabel?: string;
|
|
93
|
+
topLocatorLabel?: string;
|
|
94
|
+
sourceAwareChunkReasonLabel?: string;
|
|
95
|
+
sourceAwareUnitScopeLabel?: string;
|
|
96
|
+
vectorHits: number;
|
|
97
|
+
lexicalHits: number;
|
|
98
|
+
hybridHits: number;
|
|
99
|
+
stageCounts: Array<{
|
|
100
|
+
stage: RAGRetrievalTraceStage;
|
|
101
|
+
count: number;
|
|
102
|
+
}>;
|
|
103
|
+
stageWeights: Array<{
|
|
104
|
+
stage: RAGRetrievalTraceStage;
|
|
105
|
+
count: number;
|
|
106
|
+
previousStage?: RAGRetrievalTraceStage;
|
|
107
|
+
previousCount?: number;
|
|
108
|
+
countDelta?: number;
|
|
109
|
+
retentionRate?: number;
|
|
110
|
+
totalScore?: number;
|
|
111
|
+
stageScoreShare?: number;
|
|
112
|
+
parentStageScoreShare?: number;
|
|
113
|
+
stageScoreShareGap?: number;
|
|
114
|
+
parentStageScoreShareGap?: number;
|
|
115
|
+
stageShare: number;
|
|
116
|
+
parentStageShare?: number;
|
|
117
|
+
stageShareGap?: number;
|
|
118
|
+
parentStageShareGap?: number;
|
|
119
|
+
strongestSiblingLabel?: string;
|
|
120
|
+
strongestSiblingCount?: number;
|
|
121
|
+
reasons: RAGSectionTraceWeightReason[];
|
|
122
|
+
}>;
|
|
123
|
+
firstSeenStage?: RAGRetrievalTraceStage;
|
|
124
|
+
lastSeenStage?: RAGRetrievalTraceStage;
|
|
125
|
+
peakStage?: RAGRetrievalTraceStage;
|
|
126
|
+
peakCount: number;
|
|
127
|
+
finalCount?: number;
|
|
128
|
+
finalRetentionRate?: number;
|
|
129
|
+
dropFromPeak?: number;
|
|
130
|
+
queryAttribution: {
|
|
131
|
+
primaryHits: number;
|
|
132
|
+
transformedHits: number;
|
|
133
|
+
variantHits: number;
|
|
134
|
+
mode: 'primary' | 'transformed' | 'variant' | 'mixed';
|
|
135
|
+
reasons: RAGSectionQueryAttributionReason[];
|
|
136
|
+
};
|
|
137
|
+
requestedMode?: RAGHybridRetrievalMode;
|
|
138
|
+
retrievalMode?: RAGHybridRetrievalMode;
|
|
139
|
+
routingProvider?: string;
|
|
140
|
+
routingLabel?: string;
|
|
141
|
+
routingReason?: string;
|
|
142
|
+
queryTransformProvider?: string;
|
|
143
|
+
queryTransformLabel?: string;
|
|
144
|
+
queryTransformReason?: string;
|
|
145
|
+
evidenceReconcileApplied?: boolean;
|
|
146
|
+
rerankApplied?: boolean;
|
|
147
|
+
sourceBalanceApplied?: boolean;
|
|
148
|
+
scoreThresholdApplied?: boolean;
|
|
149
|
+
parentDistribution: Array<{
|
|
150
|
+
key: string;
|
|
151
|
+
label: string;
|
|
152
|
+
count: number;
|
|
153
|
+
totalScore: number;
|
|
154
|
+
parentShare: number;
|
|
155
|
+
isActive: boolean;
|
|
156
|
+
}>;
|
|
157
|
+
reasons: RAGSectionRetrievalReason[];
|
|
158
|
+
summary: string;
|
|
159
|
+
};
|
|
160
|
+
export type RAGGroundingReference = {
|
|
161
|
+
number: number;
|
|
162
|
+
chunkId: string;
|
|
163
|
+
label: string;
|
|
164
|
+
source?: string;
|
|
165
|
+
title?: string;
|
|
166
|
+
score: number;
|
|
167
|
+
text: string;
|
|
168
|
+
excerpt: string;
|
|
169
|
+
excerpts?: RAGChunkExcerpts;
|
|
170
|
+
excerptSelection?: RAGExcerptSelection;
|
|
171
|
+
contextLabel?: string;
|
|
172
|
+
provenanceLabel?: string;
|
|
173
|
+
locatorLabel?: string;
|
|
174
|
+
metadata?: Record<string, unknown>;
|
|
175
|
+
};
|
|
176
|
+
export type RAGGroundedAnswerCitationDetail = {
|
|
177
|
+
number: number;
|
|
178
|
+
label: string;
|
|
179
|
+
source?: string;
|
|
180
|
+
title?: string;
|
|
181
|
+
excerpt: string;
|
|
182
|
+
excerpts?: RAGChunkExcerpts;
|
|
183
|
+
excerptSelection?: RAGExcerptSelection;
|
|
184
|
+
contextLabel?: string;
|
|
185
|
+
provenanceLabel?: string;
|
|
186
|
+
locatorLabel?: string;
|
|
187
|
+
evidenceLabel: string;
|
|
188
|
+
evidenceSummary: string;
|
|
189
|
+
};
|
|
190
|
+
export type RAGGroundedAnswerSectionSummary = {
|
|
191
|
+
key: string;
|
|
192
|
+
label: string;
|
|
193
|
+
summary: string;
|
|
194
|
+
count: number;
|
|
195
|
+
excerpt?: string;
|
|
196
|
+
excerpts?: RAGChunkExcerpts;
|
|
197
|
+
excerptSelection?: RAGExcerptSelection;
|
|
198
|
+
chunkIds: string[];
|
|
199
|
+
referenceNumbers: number[];
|
|
200
|
+
references: RAGGroundingReference[];
|
|
201
|
+
contextLabel?: string;
|
|
202
|
+
locatorLabel?: string;
|
|
203
|
+
provenanceLabel?: string;
|
|
204
|
+
};
|
|
205
|
+
export type RAGGroundedAnswerPart = {
|
|
206
|
+
type: 'text';
|
|
207
|
+
text: string;
|
|
208
|
+
} | {
|
|
209
|
+
type: 'citation';
|
|
210
|
+
text: string;
|
|
211
|
+
referenceNumbers: number[];
|
|
212
|
+
references: RAGGroundingReference[];
|
|
213
|
+
referenceDetails: RAGGroundedAnswerCitationDetail[];
|
|
214
|
+
unresolvedReferenceNumbers: number[];
|
|
215
|
+
};
|
|
216
|
+
export type RAGGroundedAnswer = {
|
|
217
|
+
content: string;
|
|
218
|
+
hasCitations: boolean;
|
|
219
|
+
coverage: 'grounded' | 'partial' | 'ungrounded';
|
|
220
|
+
parts: RAGGroundedAnswerPart[];
|
|
221
|
+
references: RAGGroundingReference[];
|
|
222
|
+
sectionSummaries: RAGGroundedAnswerSectionSummary[];
|
|
223
|
+
excerptModeCounts: RAGExcerptModeCounts;
|
|
224
|
+
ungroundedReferenceNumbers: number[];
|
|
225
|
+
};
|
|
226
|
+
export type RAGRetrievedState = {
|
|
227
|
+
conversationId: string;
|
|
228
|
+
messageId: string;
|
|
229
|
+
retrievalStartedAt?: number;
|
|
230
|
+
retrievedAt?: number;
|
|
231
|
+
retrievalDurationMs?: number;
|
|
232
|
+
trace?: RAGRetrievalTrace;
|
|
233
|
+
sources: RAGSource[];
|
|
234
|
+
sourceGroups: RAGSourceGroup[];
|
|
235
|
+
sourceSummaries: RAGSourceSummary[];
|
|
236
|
+
sectionDiagnostics: RAGSectionRetrievalDiagnostic[];
|
|
237
|
+
citations: RAGCitation[];
|
|
238
|
+
citationReferenceMap: RAGCitationReferenceMap;
|
|
239
|
+
excerptModeCounts: RAGExcerptModeCounts;
|
|
240
|
+
groundedAnswer: RAGGroundedAnswer;
|
|
241
|
+
};
|
|
242
|
+
export type RAGAnswerWorkflowState = {
|
|
243
|
+
stage: RAGStreamStage;
|
|
244
|
+
error: string | null;
|
|
245
|
+
messages: AIMessage[];
|
|
246
|
+
latestAssistantMessage?: AIMessage;
|
|
247
|
+
retrieval: RAGRetrievedState | null;
|
|
248
|
+
sources: RAGSource[];
|
|
249
|
+
sourceGroups: RAGSourceGroup[];
|
|
250
|
+
sourceSummaries: RAGSourceSummary[];
|
|
251
|
+
sectionDiagnostics: RAGSectionRetrievalDiagnostic[];
|
|
252
|
+
citations: RAGCitation[];
|
|
253
|
+
citationReferenceMap: RAGCitationReferenceMap;
|
|
254
|
+
groundingReferences: RAGGroundingReference[];
|
|
255
|
+
groundedAnswer: RAGGroundedAnswer;
|
|
256
|
+
excerptModeCounts: RAGExcerptModeCounts;
|
|
257
|
+
isIdle: boolean;
|
|
258
|
+
isRunning: boolean;
|
|
259
|
+
isSubmitting: boolean;
|
|
260
|
+
isRetrieving: boolean;
|
|
261
|
+
isRetrieved: boolean;
|
|
262
|
+
isAnswerStreaming: boolean;
|
|
263
|
+
isComplete: boolean;
|
|
264
|
+
isError: boolean;
|
|
265
|
+
hasSources: boolean;
|
|
266
|
+
hasRetrieved: boolean;
|
|
267
|
+
hasGrounding: boolean;
|
|
268
|
+
hasCitations: boolean;
|
|
269
|
+
coverage: RAGGroundedAnswer['coverage'];
|
|
270
|
+
ungroundedReferenceNumbers: number[];
|
|
271
|
+
retrievalDurationMs?: number;
|
|
272
|
+
retrievalStartedAt?: number;
|
|
273
|
+
retrievedAt?: number;
|
|
274
|
+
};
|
|
275
|
+
export type RAGStreamStage = 'idle' | 'submitting' | 'retrieving' | 'retrieved' | 'streaming' | 'complete' | 'error';
|
|
276
|
+
export type RAGDocumentChunk = {
|
|
277
|
+
chunkId: string;
|
|
278
|
+
corpusKey?: string;
|
|
279
|
+
text: string;
|
|
280
|
+
title?: string;
|
|
281
|
+
source?: string;
|
|
282
|
+
metadata?: Record<string, unknown>;
|
|
283
|
+
embedding?: number[];
|
|
284
|
+
embeddingVariants?: RAGDocumentChunkEmbeddingVariant[];
|
|
285
|
+
structure?: RAGChunkStructure;
|
|
286
|
+
};
|
|
287
|
+
export type RAGDocumentChunkEmbeddingVariant = {
|
|
288
|
+
id: string;
|
|
289
|
+
label?: string;
|
|
290
|
+
text?: string;
|
|
291
|
+
metadata?: Record<string, unknown>;
|
|
292
|
+
embedding?: number[];
|
|
293
|
+
};
|
|
294
|
+
export type RAGEmbeddingInput = {
|
|
295
|
+
text: string;
|
|
296
|
+
model?: string;
|
|
297
|
+
signal?: AbortSignal;
|
|
298
|
+
};
|
|
299
|
+
export type RAGEmbeddingFunction = (input: RAGEmbeddingInput) => Promise<number[]>;
|
|
300
|
+
export type RAGEmbeddingProvider = {
|
|
301
|
+
embed: RAGEmbeddingFunction;
|
|
302
|
+
dimensions?: number;
|
|
303
|
+
defaultModel?: string;
|
|
304
|
+
};
|
|
305
|
+
export type RAGEmbeddingProviderLike = RAGEmbeddingFunction | RAGEmbeddingProvider;
|
|
306
|
+
export type RAGContentFormat = 'text' | 'markdown' | 'html' | 'jsonl' | 'tsv' | 'csv' | 'xml' | 'yaml';
|
|
307
|
+
export type RAGFileExtractionInput = {
|
|
308
|
+
data: Uint8Array;
|
|
309
|
+
path?: string;
|
|
310
|
+
name?: string;
|
|
311
|
+
source?: string;
|
|
312
|
+
title?: string;
|
|
313
|
+
format?: RAGContentFormat;
|
|
314
|
+
contentType?: string;
|
|
315
|
+
metadata?: Record<string, unknown>;
|
|
316
|
+
chunking?: RAGChunkingOptions;
|
|
317
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
318
|
+
};
|
|
319
|
+
export type RAGExtractedFileDocument = RAGIngestDocument & {
|
|
320
|
+
contentType?: string;
|
|
321
|
+
extractor?: string;
|
|
322
|
+
};
|
|
323
|
+
export type RAGFileExtractor = {
|
|
324
|
+
name: string;
|
|
325
|
+
supports: (input: RAGFileExtractionInput) => boolean | Promise<boolean>;
|
|
326
|
+
extract: (input: RAGFileExtractionInput) => RAGExtractedFileDocument | RAGExtractedFileDocument[] | Promise<RAGExtractedFileDocument | RAGExtractedFileDocument[]>;
|
|
327
|
+
};
|
|
328
|
+
export type RAGFileExtractorRegistryInput = RAGFileExtractionInput & {
|
|
329
|
+
inferredContentType?: string | null;
|
|
330
|
+
inferredExtension?: string | null;
|
|
331
|
+
inferredFormat?: RAGContentFormat;
|
|
332
|
+
};
|
|
333
|
+
export type RAGFileExtractorRegistration = {
|
|
334
|
+
extractor: RAGFileExtractor;
|
|
335
|
+
name?: string;
|
|
336
|
+
priority?: number;
|
|
337
|
+
contentTypes?: string[];
|
|
338
|
+
extensions?: string[];
|
|
339
|
+
formats?: RAGContentFormat[];
|
|
340
|
+
names?: string[];
|
|
341
|
+
match?: (input: RAGFileExtractorRegistryInput) => boolean | Promise<boolean>;
|
|
342
|
+
};
|
|
343
|
+
export type RAGFileExtractorRegistry = {
|
|
344
|
+
registrations: RAGFileExtractorRegistration[];
|
|
345
|
+
includeDefaults?: boolean;
|
|
346
|
+
defaultOrder?: 'registry_first' | 'defaults_first';
|
|
347
|
+
};
|
|
348
|
+
export type RAGFileExtractorRegistryLike = RAGFileExtractorRegistry | RAGFileExtractorRegistration[];
|
|
349
|
+
export type RAGMediaTranscriptSegment = {
|
|
350
|
+
text: string;
|
|
351
|
+
startMs?: number;
|
|
352
|
+
endMs?: number;
|
|
353
|
+
speaker?: string;
|
|
354
|
+
channel?: string;
|
|
355
|
+
};
|
|
356
|
+
export type RAGMediaTranscriptionResult = {
|
|
357
|
+
text: string;
|
|
358
|
+
title?: string;
|
|
359
|
+
metadata?: Record<string, unknown>;
|
|
360
|
+
segments?: RAGMediaTranscriptSegment[];
|
|
361
|
+
};
|
|
362
|
+
export type RAGMediaTranscriber = {
|
|
363
|
+
name: string;
|
|
364
|
+
transcribe: (input: RAGFileExtractionInput) => RAGMediaTranscriptionResult | Promise<RAGMediaTranscriptionResult>;
|
|
365
|
+
};
|
|
366
|
+
export type RAGOCRRegion = {
|
|
367
|
+
text: string;
|
|
368
|
+
confidence?: number;
|
|
369
|
+
page?: number;
|
|
370
|
+
x?: number;
|
|
371
|
+
y?: number;
|
|
372
|
+
width?: number;
|
|
373
|
+
height?: number;
|
|
374
|
+
};
|
|
375
|
+
export type RAGOCRResult = {
|
|
376
|
+
text: string;
|
|
377
|
+
title?: string;
|
|
378
|
+
metadata?: Record<string, unknown>;
|
|
379
|
+
confidence?: number;
|
|
380
|
+
regions?: RAGOCRRegion[];
|
|
381
|
+
};
|
|
382
|
+
export type RAGOCRProvider = {
|
|
383
|
+
name: string;
|
|
384
|
+
extractText: (input: RAGFileExtractionInput) => RAGOCRResult | Promise<RAGOCRResult>;
|
|
385
|
+
};
|
|
386
|
+
export type RAGPDFOCRExtractorOptions = {
|
|
387
|
+
provider: RAGOCRProvider;
|
|
388
|
+
alwaysOCR?: boolean;
|
|
389
|
+
minExtractedTextLength?: number;
|
|
390
|
+
};
|
|
391
|
+
export type RAGArchiveEntry = {
|
|
392
|
+
data: Uint8Array;
|
|
393
|
+
path: string;
|
|
394
|
+
contentType?: string;
|
|
395
|
+
format?: RAGContentFormat;
|
|
396
|
+
metadata?: Record<string, unknown>;
|
|
397
|
+
};
|
|
398
|
+
export type RAGArchiveExpansionResult = {
|
|
399
|
+
entries: RAGArchiveEntry[];
|
|
400
|
+
metadata?: Record<string, unknown>;
|
|
401
|
+
};
|
|
402
|
+
export type RAGArchiveExpander = {
|
|
403
|
+
name: string;
|
|
404
|
+
expand: (input: RAGFileExtractionInput) => RAGArchiveExpansionResult | Promise<RAGArchiveExpansionResult>;
|
|
405
|
+
};
|
|
406
|
+
export type RAGChunkingStrategy = 'paragraphs' | 'sentences' | 'fixed' | 'source_aware';
|
|
407
|
+
export type RAGChunkingOptions = {
|
|
408
|
+
maxChunkLength?: number;
|
|
409
|
+
chunkOverlap?: number;
|
|
410
|
+
minChunkLength?: number;
|
|
411
|
+
strategy?: RAGChunkingStrategy;
|
|
412
|
+
};
|
|
413
|
+
export type RAGChunkingProfileInput = {
|
|
414
|
+
document: RAGIngestDocument;
|
|
415
|
+
format: RAGContentFormat;
|
|
416
|
+
normalizedText: string;
|
|
417
|
+
metadata: Record<string, unknown>;
|
|
418
|
+
sourceNativeKind?: string;
|
|
419
|
+
defaults?: RAGChunkingOptions;
|
|
420
|
+
};
|
|
421
|
+
export type RAGChunkingProfile = {
|
|
422
|
+
name: string;
|
|
423
|
+
resolve: (input: RAGChunkingProfileInput) => Partial<RAGChunkingOptions> | undefined;
|
|
424
|
+
};
|
|
425
|
+
export type RAGChunkingProfileRegistration = {
|
|
426
|
+
name?: string;
|
|
427
|
+
documentIds?: string[];
|
|
428
|
+
formats?: RAGContentFormat[];
|
|
429
|
+
priority?: number;
|
|
430
|
+
profile: Partial<RAGChunkingOptions> | {
|
|
431
|
+
options?: Partial<RAGChunkingOptions>;
|
|
432
|
+
};
|
|
433
|
+
sourceNativeKinds?: string[];
|
|
434
|
+
sources?: string[];
|
|
435
|
+
};
|
|
436
|
+
export type RAGChunkingRegistry = {
|
|
437
|
+
profiles: Array<RAGChunkingProfile | RAGChunkingProfileRegistration>;
|
|
438
|
+
};
|
|
439
|
+
export type RAGChunkingRegistryLike = RAGChunkingRegistry | Array<RAGChunkingProfile | RAGChunkingProfileRegistration>;
|
|
440
|
+
export type RAGIngestDocument = {
|
|
441
|
+
text: string;
|
|
442
|
+
corpusKey?: string;
|
|
443
|
+
id?: string;
|
|
444
|
+
title?: string;
|
|
445
|
+
source?: string;
|
|
446
|
+
format?: RAGContentFormat;
|
|
447
|
+
metadata?: Record<string, unknown>;
|
|
448
|
+
chunking?: RAGChunkingOptions;
|
|
449
|
+
};
|
|
450
|
+
export type RAGDocumentUrlInput = {
|
|
451
|
+
url: string;
|
|
452
|
+
title?: string;
|
|
453
|
+
source?: string;
|
|
454
|
+
format?: RAGContentFormat;
|
|
455
|
+
contentType?: string;
|
|
456
|
+
metadata?: Record<string, unknown>;
|
|
457
|
+
chunking?: RAGChunkingOptions;
|
|
458
|
+
extractors?: RAGFileExtractor[];
|
|
459
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
460
|
+
};
|
|
461
|
+
export type RAGDocumentUrlIngestInput = {
|
|
462
|
+
baseMetadata?: Record<string, unknown>;
|
|
463
|
+
defaultChunking?: RAGChunkingOptions;
|
|
464
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
465
|
+
extractors?: RAGFileExtractor[];
|
|
466
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
467
|
+
urls: RAGDocumentUrlInput[];
|
|
468
|
+
};
|
|
469
|
+
export type RAGPreparedDocument = {
|
|
470
|
+
corpusKey?: string;
|
|
471
|
+
documentId: string;
|
|
472
|
+
title: string;
|
|
473
|
+
source: string;
|
|
474
|
+
format: RAGContentFormat;
|
|
475
|
+
metadata: Record<string, unknown>;
|
|
476
|
+
normalizedText: string;
|
|
477
|
+
chunks: RAGDocumentChunk[];
|
|
478
|
+
};
|
|
479
|
+
export type RAGDocumentFileInput = Omit<RAGIngestDocument, 'text'> & {
|
|
480
|
+
path: string;
|
|
481
|
+
contentType?: string;
|
|
482
|
+
extractors?: RAGFileExtractor[];
|
|
483
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
484
|
+
};
|
|
485
|
+
export type RAGDirectoryIngestInput = {
|
|
486
|
+
directory: string;
|
|
487
|
+
recursive?: boolean;
|
|
488
|
+
includeExtensions?: string[];
|
|
489
|
+
baseMetadata?: Record<string, unknown>;
|
|
490
|
+
defaultChunking?: RAGChunkingOptions;
|
|
491
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
492
|
+
extractors?: RAGFileExtractor[];
|
|
493
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
494
|
+
};
|
|
495
|
+
export type RAGQueryInput = {
|
|
496
|
+
queryVector: number[];
|
|
497
|
+
topK: number;
|
|
498
|
+
filter?: Record<string, unknown>;
|
|
499
|
+
plannerProfile?: RAGNativeQueryProfile;
|
|
500
|
+
queryMultiplier?: number;
|
|
501
|
+
candidateLimit?: number;
|
|
502
|
+
maxBackfills?: number;
|
|
503
|
+
minResults?: number;
|
|
504
|
+
fillPolicy?: 'strict_topk' | 'satisfy_min_results';
|
|
505
|
+
};
|
|
506
|
+
export type RAGLexicalQueryInput = {
|
|
507
|
+
query: string;
|
|
508
|
+
topK: number;
|
|
509
|
+
filter?: Record<string, unknown>;
|
|
510
|
+
};
|
|
511
|
+
export type RAGNativeQueryProfile = 'latency' | 'balanced' | 'recall';
|
|
512
|
+
export type RAGQueryTransformInput = {
|
|
513
|
+
query: string;
|
|
514
|
+
topK: number;
|
|
515
|
+
candidateTopK?: number;
|
|
516
|
+
filter?: Record<string, unknown>;
|
|
517
|
+
model?: string;
|
|
518
|
+
scoreThreshold?: number;
|
|
519
|
+
};
|
|
520
|
+
export type RAGQueryTransformResult = {
|
|
521
|
+
query: string;
|
|
522
|
+
variants?: string[];
|
|
523
|
+
label?: string;
|
|
524
|
+
reason?: string;
|
|
525
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
526
|
+
};
|
|
527
|
+
export type RAGQueryTransformer = (input: RAGQueryTransformInput) => Promise<RAGQueryTransformResult> | RAGQueryTransformResult;
|
|
528
|
+
export type RAGQueryTransformProvider = {
|
|
529
|
+
transform: RAGQueryTransformer;
|
|
530
|
+
defaultModel?: string;
|
|
531
|
+
providerName?: string;
|
|
532
|
+
};
|
|
533
|
+
export type RAGQueryTransformProviderLike = RAGQueryTransformer | RAGQueryTransformProvider;
|
|
534
|
+
export type RAGRetrievalStrategyDecision = {
|
|
535
|
+
mode?: RAGHybridRetrievalMode;
|
|
536
|
+
lexicalTopK?: number;
|
|
537
|
+
maxResultsPerSource?: number;
|
|
538
|
+
sourceBalanceStrategy?: RAGSourceBalanceStrategy;
|
|
539
|
+
diversityStrategy?: RAGDiversityStrategy;
|
|
540
|
+
mmrLambda?: number;
|
|
541
|
+
fusion?: RAGHybridFusionMode;
|
|
542
|
+
fusionConstant?: number;
|
|
543
|
+
lexicalWeight?: number;
|
|
544
|
+
vectorWeight?: number;
|
|
545
|
+
label?: string;
|
|
546
|
+
reason?: string;
|
|
547
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
548
|
+
};
|
|
549
|
+
export type RAGRetrievalStrategyInput = {
|
|
550
|
+
query: string;
|
|
551
|
+
transformedQuery: string;
|
|
552
|
+
variantQueries: string[];
|
|
553
|
+
topK: number;
|
|
554
|
+
candidateTopK: number;
|
|
555
|
+
filter?: Record<string, unknown>;
|
|
556
|
+
scoreThreshold?: number;
|
|
557
|
+
model?: string;
|
|
558
|
+
retrieval: RAGHybridSearchOptions;
|
|
559
|
+
};
|
|
560
|
+
export type RAGRetrievalStrategySelector = (input: RAGRetrievalStrategyInput) => Promise<RAGRetrievalStrategyDecision | undefined> | RAGRetrievalStrategyDecision | undefined;
|
|
561
|
+
export type RAGRetrievalStrategyProvider = {
|
|
562
|
+
select: RAGRetrievalStrategySelector;
|
|
563
|
+
providerName?: string;
|
|
564
|
+
defaultLabel?: string;
|
|
565
|
+
};
|
|
566
|
+
export type RAGRetrievalStrategyProviderLike = RAGRetrievalStrategySelector | RAGRetrievalStrategyProvider;
|
|
567
|
+
export type RAGRerankerInput = {
|
|
568
|
+
query: string;
|
|
569
|
+
queryVector: number[];
|
|
570
|
+
model?: string;
|
|
571
|
+
filter?: Record<string, unknown>;
|
|
572
|
+
topK: number;
|
|
573
|
+
candidateTopK?: number;
|
|
574
|
+
scoreThreshold?: number;
|
|
575
|
+
results: RAGQueryResult[];
|
|
576
|
+
};
|
|
577
|
+
export type RAGReranker = (input: RAGRerankerInput) => Promise<RAGQueryResult[]> | RAGQueryResult[];
|
|
578
|
+
export type RAGRerankerProvider = {
|
|
579
|
+
rerank: RAGReranker;
|
|
580
|
+
defaultModel?: string;
|
|
581
|
+
providerName?: string;
|
|
582
|
+
};
|
|
583
|
+
export type RAGRerankerProviderLike = RAGReranker | RAGRerankerProvider;
|
|
584
|
+
export type RAGQueryResult = {
|
|
585
|
+
chunkId: string;
|
|
586
|
+
score: number;
|
|
587
|
+
chunkText: string;
|
|
588
|
+
embedding?: number[];
|
|
589
|
+
title?: string;
|
|
590
|
+
source?: string;
|
|
591
|
+
metadata?: Record<string, unknown>;
|
|
592
|
+
};
|
|
593
|
+
export type RAGHybridRetrievalMode = 'vector' | 'lexical' | 'hybrid';
|
|
594
|
+
export type RAGHybridFusionMode = 'rrf' | 'max';
|
|
595
|
+
export type RAGSourceBalanceStrategy = 'cap' | 'round_robin';
|
|
596
|
+
export type RAGDiversityStrategy = 'none' | 'mmr';
|
|
597
|
+
export type RAGHybridSearchOptions = {
|
|
598
|
+
mode?: RAGHybridRetrievalMode;
|
|
599
|
+
lexicalTopK?: number;
|
|
600
|
+
maxResultsPerSource?: number;
|
|
601
|
+
sourceBalanceStrategy?: RAGSourceBalanceStrategy;
|
|
602
|
+
diversityStrategy?: RAGDiversityStrategy;
|
|
603
|
+
mmrLambda?: number;
|
|
604
|
+
fusion?: RAGHybridFusionMode;
|
|
605
|
+
fusionConstant?: number;
|
|
606
|
+
lexicalWeight?: number;
|
|
607
|
+
vectorWeight?: number;
|
|
608
|
+
nativeQueryProfile?: RAGNativeQueryProfile;
|
|
609
|
+
nativeCandidateLimit?: number;
|
|
610
|
+
nativeMaxBackfills?: number;
|
|
611
|
+
nativeMinResults?: number;
|
|
612
|
+
nativeFillPolicy?: 'strict_topk' | 'satisfy_min_results';
|
|
613
|
+
};
|
|
614
|
+
export type RAGUpsertInput = {
|
|
615
|
+
chunks: RAGDocumentChunk[];
|
|
616
|
+
};
|
|
617
|
+
export type RAGDocumentIngestInput = {
|
|
618
|
+
documents: RAGIngestDocument[];
|
|
619
|
+
defaultChunking?: RAGChunkingOptions;
|
|
620
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
621
|
+
};
|
|
622
|
+
export type RAGDocumentUploadInput = {
|
|
623
|
+
name: string;
|
|
624
|
+
content: string;
|
|
625
|
+
contentType?: string;
|
|
626
|
+
encoding?: 'base64' | 'utf8';
|
|
627
|
+
format?: RAGContentFormat;
|
|
628
|
+
source?: string;
|
|
629
|
+
title?: string;
|
|
630
|
+
chunking?: RAGChunkingOptions;
|
|
631
|
+
metadata?: Record<string, unknown>;
|
|
632
|
+
};
|
|
633
|
+
export type RAGDocumentUploadIngestInput = {
|
|
634
|
+
baseMetadata?: Record<string, unknown>;
|
|
635
|
+
defaultChunking?: RAGChunkingOptions;
|
|
636
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
637
|
+
extractors?: RAGFileExtractor[];
|
|
638
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
639
|
+
uploads: RAGDocumentUploadInput[];
|
|
640
|
+
};
|
|
641
|
+
export type RAGIndexedDocument = {
|
|
642
|
+
corpusKey?: string;
|
|
643
|
+
id: string;
|
|
644
|
+
title: string;
|
|
645
|
+
source: string;
|
|
646
|
+
text?: string;
|
|
647
|
+
kind?: string;
|
|
648
|
+
format?: RAGContentFormat;
|
|
649
|
+
chunkStrategy?: RAGChunkingStrategy;
|
|
650
|
+
chunkSize?: number;
|
|
651
|
+
chunkCount?: number;
|
|
652
|
+
createdAt?: number;
|
|
653
|
+
updatedAt?: number;
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
655
|
+
labels?: RAGSourceLabels;
|
|
656
|
+
};
|
|
657
|
+
export type RAGDocumentChunkPreview = {
|
|
658
|
+
document: Omit<RAGIndexedDocument, 'text' | 'metadata'> & {
|
|
659
|
+
metadata?: Record<string, unknown>;
|
|
660
|
+
labels?: RAGSourceLabels;
|
|
661
|
+
};
|
|
662
|
+
normalizedText: string;
|
|
663
|
+
chunks: Array<RAGDocumentChunk & {
|
|
664
|
+
labels?: RAGSourceLabels;
|
|
665
|
+
excerpts?: RAGChunkExcerpts;
|
|
666
|
+
excerptSelection?: RAGExcerptSelection;
|
|
667
|
+
structure?: RAGChunkStructure;
|
|
668
|
+
}>;
|
|
669
|
+
};
|
|
670
|
+
export type RAGChunkExcerpts = {
|
|
671
|
+
chunkExcerpt: string;
|
|
672
|
+
windowExcerpt: string;
|
|
673
|
+
sectionExcerpt: string;
|
|
674
|
+
};
|
|
675
|
+
export type RAGSourceLabels = {
|
|
676
|
+
contextLabel?: string;
|
|
677
|
+
locatorLabel?: string;
|
|
678
|
+
provenanceLabel?: string;
|
|
679
|
+
};
|
|
680
|
+
export type RAGChunkSection = {
|
|
681
|
+
title?: string;
|
|
682
|
+
path?: string[];
|
|
683
|
+
depth?: number;
|
|
684
|
+
kind?: 'markdown_heading' | 'html_heading' | 'office_heading' | 'office_block' | 'pdf_block' | 'spreadsheet_rows' | 'presentation_slide';
|
|
685
|
+
};
|
|
686
|
+
export type RAGChunkSequence = {
|
|
687
|
+
sectionChunkId?: string;
|
|
688
|
+
sectionChunkIndex?: number;
|
|
689
|
+
sectionChunkCount?: number;
|
|
690
|
+
previousChunkId?: string;
|
|
691
|
+
nextChunkId?: string;
|
|
692
|
+
};
|
|
693
|
+
export type RAGChunkStructure = {
|
|
694
|
+
section?: RAGChunkSection;
|
|
695
|
+
sequence?: RAGChunkSequence;
|
|
696
|
+
};
|
|
697
|
+
export type RAGChunkGraphNode = {
|
|
698
|
+
chunkId: string;
|
|
699
|
+
label: string;
|
|
700
|
+
source?: string;
|
|
701
|
+
title?: string;
|
|
702
|
+
score?: number;
|
|
703
|
+
contextLabel?: string;
|
|
704
|
+
locatorLabel?: string;
|
|
705
|
+
provenanceLabel?: string;
|
|
706
|
+
structure?: RAGChunkStructure;
|
|
707
|
+
};
|
|
708
|
+
export type RAGChunkGraphEdge = {
|
|
709
|
+
fromChunkId: string;
|
|
710
|
+
toChunkId: string;
|
|
711
|
+
relation: 'previous' | 'next' | 'section_parent' | 'section_child';
|
|
712
|
+
};
|
|
713
|
+
export type RAGChunkGraphSectionGroup = {
|
|
714
|
+
id: string;
|
|
715
|
+
title?: string;
|
|
716
|
+
path?: string[];
|
|
717
|
+
depth?: number;
|
|
718
|
+
kind?: 'markdown_heading' | 'html_heading' | 'office_heading' | 'office_block' | 'pdf_block' | 'spreadsheet_rows' | 'presentation_slide';
|
|
719
|
+
chunkIds: string[];
|
|
720
|
+
chunkCount: number;
|
|
721
|
+
leadChunkId?: string;
|
|
722
|
+
parentSectionId?: string;
|
|
723
|
+
childSectionIds: string[];
|
|
724
|
+
};
|
|
725
|
+
export type RAGChunkGraph = {
|
|
726
|
+
nodes: RAGChunkGraphNode[];
|
|
727
|
+
edges: RAGChunkGraphEdge[];
|
|
728
|
+
sections: RAGChunkGraphSectionGroup[];
|
|
729
|
+
};
|
|
730
|
+
export type RAGChunkGraphNavigation = {
|
|
731
|
+
activeChunkId?: string;
|
|
732
|
+
activeNode?: RAGChunkGraphNode;
|
|
733
|
+
previousNode?: RAGChunkGraphNode;
|
|
734
|
+
nextNode?: RAGChunkGraphNode;
|
|
735
|
+
section?: RAGChunkGraphSectionGroup;
|
|
736
|
+
parentSection?: RAGChunkGraphSectionGroup;
|
|
737
|
+
childSections: RAGChunkGraphSectionGroup[];
|
|
738
|
+
siblingSections: RAGChunkGraphSectionGroup[];
|
|
739
|
+
sectionNodes: RAGChunkGraphNode[];
|
|
740
|
+
};
|
|
741
|
+
export type RAGBackendDescriptor = {
|
|
742
|
+
id: string;
|
|
743
|
+
label: string;
|
|
744
|
+
path?: string;
|
|
745
|
+
available: boolean;
|
|
746
|
+
reason?: string;
|
|
747
|
+
lastSeedMs?: number;
|
|
748
|
+
status?: RAGVectorStoreStatus;
|
|
749
|
+
capabilities?: RAGBackendCapabilities;
|
|
750
|
+
};
|
|
751
|
+
export type RAGBackendsResponse = {
|
|
752
|
+
ok: true;
|
|
753
|
+
defaultMode?: string;
|
|
754
|
+
activeModeCookie?: string;
|
|
755
|
+
backends: RAGBackendDescriptor[];
|
|
756
|
+
};
|
|
757
|
+
export type SQLiteVecResolutionSource = 'absolute-package' | 'explicit' | 'env' | 'database';
|
|
758
|
+
export type SQLiteVecResolutionStatus = 'resolved' | 'not_configured' | 'unsupported_platform' | 'package_not_installed' | 'binary_missing' | 'package_invalid';
|
|
759
|
+
export type SQLiteVecResolution = {
|
|
760
|
+
status: SQLiteVecResolutionStatus;
|
|
761
|
+
source: SQLiteVecResolutionSource;
|
|
762
|
+
platformKey: string;
|
|
763
|
+
packageName?: string;
|
|
764
|
+
packageVersion?: string;
|
|
765
|
+
packageRoot?: string;
|
|
766
|
+
libraryFile?: string;
|
|
767
|
+
libraryPath?: string;
|
|
768
|
+
reason?: string;
|
|
769
|
+
};
|
|
770
|
+
export type RAGSQLiteNativeDiagnostics = {
|
|
771
|
+
requested: boolean;
|
|
772
|
+
available: boolean;
|
|
773
|
+
active: boolean;
|
|
774
|
+
mode?: 'vec0';
|
|
775
|
+
tableName?: string;
|
|
776
|
+
distanceMetric?: 'cosine' | 'l2';
|
|
777
|
+
rowCount?: number;
|
|
778
|
+
pageCount?: number;
|
|
779
|
+
freelistCount?: number;
|
|
780
|
+
databaseBytes?: number;
|
|
781
|
+
lastHealthCheckAt?: number;
|
|
782
|
+
lastAnalyzeAt?: number;
|
|
783
|
+
resolution?: SQLiteVecResolution;
|
|
784
|
+
fallbackReason?: string;
|
|
785
|
+
lastAnalyzeError?: string;
|
|
786
|
+
lastHealthError?: string;
|
|
787
|
+
lastLoadError?: string;
|
|
788
|
+
lastQueryError?: string;
|
|
789
|
+
lastUpsertError?: string;
|
|
790
|
+
lastQueryPlan?: {
|
|
791
|
+
pushdownMode: 'none' | 'partial' | 'full';
|
|
792
|
+
pushdownApplied: boolean;
|
|
793
|
+
pushdownClauseCount: number;
|
|
794
|
+
totalFilterClauseCount: number;
|
|
795
|
+
jsRemainderClauseCount: number;
|
|
796
|
+
plannerProfileUsed?: RAGNativeQueryProfile;
|
|
797
|
+
queryMultiplierUsed?: number;
|
|
798
|
+
candidateLimitUsed?: number;
|
|
799
|
+
maxBackfillsUsed?: number;
|
|
800
|
+
minResultsUsed?: number;
|
|
801
|
+
fillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
802
|
+
pushdownCoverageRatio?: number;
|
|
803
|
+
jsRemainderRatio?: number;
|
|
804
|
+
filteredCandidateCount?: number;
|
|
805
|
+
initialSearchK?: number;
|
|
806
|
+
finalSearchK?: number;
|
|
807
|
+
searchExpansionRatio?: number;
|
|
808
|
+
backfillCount?: number;
|
|
809
|
+
backfillLimitReached?: boolean;
|
|
810
|
+
minResultsSatisfied?: boolean;
|
|
811
|
+
returnedCount?: number;
|
|
812
|
+
candidateYieldRatio?: number;
|
|
813
|
+
topKFillRatio?: number;
|
|
814
|
+
underfilledTopK?: boolean;
|
|
815
|
+
candidateBudgetExhausted?: boolean;
|
|
816
|
+
candidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
817
|
+
queryMode: 'json_fallback' | 'native_vec0';
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
export type RAGPostgresNativeDiagnostics = {
|
|
821
|
+
requested: boolean;
|
|
822
|
+
available: boolean;
|
|
823
|
+
active: boolean;
|
|
824
|
+
mode?: 'pgvector';
|
|
825
|
+
extensionName?: string;
|
|
826
|
+
schemaName?: string;
|
|
827
|
+
tableName?: string;
|
|
828
|
+
distanceMetric?: 'cosine' | 'l2' | 'inner_product';
|
|
829
|
+
indexType?: 'none' | 'hnsw' | 'ivfflat';
|
|
830
|
+
indexName?: string;
|
|
831
|
+
indexPresent?: boolean;
|
|
832
|
+
estimatedRowCount?: number;
|
|
833
|
+
tableBytes?: number;
|
|
834
|
+
indexBytes?: number;
|
|
835
|
+
totalBytes?: number;
|
|
836
|
+
lastHealthCheckAt?: number;
|
|
837
|
+
lastAnalyzeAt?: number;
|
|
838
|
+
lastReindexAt?: number;
|
|
839
|
+
fallbackReason?: string;
|
|
840
|
+
lastAnalyzeError?: string;
|
|
841
|
+
lastInitError?: string;
|
|
842
|
+
lastQueryError?: string;
|
|
843
|
+
lastReindexError?: string;
|
|
844
|
+
lastUpsertError?: string;
|
|
845
|
+
lastMigrationError?: string;
|
|
846
|
+
lastHealthError?: string;
|
|
847
|
+
lastFilterDebug?: {
|
|
848
|
+
filter?: Record<string, unknown>;
|
|
849
|
+
pushdownFilter?: Record<string, unknown>;
|
|
850
|
+
countSql?: string;
|
|
851
|
+
countParams?: unknown[];
|
|
852
|
+
querySql?: string;
|
|
853
|
+
queryParams?: unknown[];
|
|
854
|
+
countResultRaw?: unknown;
|
|
855
|
+
queryRowCount?: number;
|
|
856
|
+
};
|
|
857
|
+
lastQueryPlan?: {
|
|
858
|
+
pushdownMode: 'none' | 'partial' | 'full';
|
|
859
|
+
pushdownApplied: boolean;
|
|
860
|
+
pushdownClauseCount: number;
|
|
861
|
+
totalFilterClauseCount: number;
|
|
862
|
+
jsRemainderClauseCount: number;
|
|
863
|
+
plannerProfileUsed?: RAGNativeQueryProfile;
|
|
864
|
+
queryMultiplierUsed?: number;
|
|
865
|
+
candidateLimitUsed?: number;
|
|
866
|
+
maxBackfillsUsed?: number;
|
|
867
|
+
minResultsUsed?: number;
|
|
868
|
+
fillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
869
|
+
pushdownCoverageRatio?: number;
|
|
870
|
+
jsRemainderRatio?: number;
|
|
871
|
+
filteredCandidateCount?: number;
|
|
872
|
+
initialSearchK?: number;
|
|
873
|
+
finalSearchK?: number;
|
|
874
|
+
searchExpansionRatio?: number;
|
|
875
|
+
backfillCount?: number;
|
|
876
|
+
backfillLimitReached?: boolean;
|
|
877
|
+
minResultsSatisfied?: boolean;
|
|
878
|
+
returnedCount?: number;
|
|
879
|
+
candidateYieldRatio?: number;
|
|
880
|
+
topKFillRatio?: number;
|
|
881
|
+
underfilledTopK?: boolean;
|
|
882
|
+
candidateBudgetExhausted?: boolean;
|
|
883
|
+
candidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
884
|
+
queryMode: 'native_pgvector';
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
export type RAGVectorStoreStatus = {
|
|
888
|
+
backend: 'in_memory' | 'sqlite' | 'postgres';
|
|
889
|
+
vectorMode: 'in_memory' | 'json_fallback' | 'native_vec0' | 'native_pgvector';
|
|
890
|
+
dimensions?: number;
|
|
891
|
+
native?: RAGSQLiteNativeDiagnostics | RAGPostgresNativeDiagnostics;
|
|
892
|
+
};
|
|
893
|
+
export type RAGVectorCountInput = {
|
|
894
|
+
filter?: Record<string, unknown>;
|
|
895
|
+
chunkIds?: string[];
|
|
896
|
+
};
|
|
897
|
+
export type RAGVectorDeleteInput = {
|
|
898
|
+
filter?: Record<string, unknown>;
|
|
899
|
+
chunkIds?: string[];
|
|
900
|
+
};
|
|
901
|
+
export type RAGBackendCapabilities = {
|
|
902
|
+
backend: 'in_memory' | 'sqlite' | 'postgres' | 'custom';
|
|
903
|
+
persistence: 'memory_only' | 'embedded' | 'external';
|
|
904
|
+
nativeVectorSearch: boolean;
|
|
905
|
+
serverSideFiltering: boolean;
|
|
906
|
+
streamingIngestStatus: boolean;
|
|
907
|
+
};
|
|
908
|
+
export type RAGVectorStore = {
|
|
909
|
+
embed: (input: RAGEmbeddingInput) => Promise<number[]>;
|
|
910
|
+
query: (input: RAGQueryInput) => Promise<RAGQueryResult[]>;
|
|
911
|
+
queryLexical?: (input: RAGLexicalQueryInput) => Promise<RAGQueryResult[]>;
|
|
912
|
+
count?: (input?: RAGVectorCountInput) => Promise<number>;
|
|
913
|
+
delete?: (input?: RAGVectorDeleteInput) => Promise<number>;
|
|
914
|
+
analyze?: () => Promise<void> | void;
|
|
915
|
+
rebuildNativeIndex?: () => Promise<void> | void;
|
|
916
|
+
upsert: (input: RAGUpsertInput) => Promise<void>;
|
|
917
|
+
clear?: () => Promise<void> | void;
|
|
918
|
+
close?: () => Promise<void> | void;
|
|
919
|
+
getStatus?: () => RAGVectorStoreStatus;
|
|
920
|
+
getCapabilities?: () => RAGBackendCapabilities;
|
|
921
|
+
};
|
|
922
|
+
export type RAGCollectionSearchParams = {
|
|
923
|
+
query: string;
|
|
924
|
+
topK?: number;
|
|
925
|
+
candidateTopK?: number;
|
|
926
|
+
nativeQueryProfile?: RAGNativeQueryProfile;
|
|
927
|
+
nativeQueryMultiplier?: number;
|
|
928
|
+
nativeCandidateLimit?: number;
|
|
929
|
+
nativeMaxBackfills?: number;
|
|
930
|
+
nativeMinResults?: number;
|
|
931
|
+
nativeFillPolicy?: 'strict_topk' | 'satisfy_min_results';
|
|
932
|
+
filter?: Record<string, unknown>;
|
|
933
|
+
scoreThreshold?: number;
|
|
934
|
+
queryTransform?: RAGQueryTransformProviderLike;
|
|
935
|
+
retrievalStrategy?: RAGRetrievalStrategyProviderLike;
|
|
936
|
+
rerank?: RAGRerankerProviderLike;
|
|
937
|
+
retrieval?: RAGHybridSearchOptions | RAGHybridRetrievalMode;
|
|
938
|
+
model?: string;
|
|
939
|
+
signal?: AbortSignal;
|
|
940
|
+
};
|
|
941
|
+
export type RAGRetrievalTraceStage = 'input' | 'query_transform' | 'routing' | 'embed' | 'vector_search' | 'lexical_search' | 'fusion' | 'rerank' | 'diversity' | 'source_balance' | 'evidence_reconcile' | 'score_filter' | 'finalize';
|
|
942
|
+
export type RAGRetrievalTraceStep = {
|
|
943
|
+
stage: RAGRetrievalTraceStage;
|
|
944
|
+
label: string;
|
|
945
|
+
durationMs?: number;
|
|
946
|
+
count?: number;
|
|
947
|
+
sectionCounts?: Array<{
|
|
948
|
+
key: string;
|
|
949
|
+
label: string;
|
|
950
|
+
count: number;
|
|
951
|
+
}>;
|
|
952
|
+
sectionScores?: Array<{
|
|
953
|
+
key: string;
|
|
954
|
+
label: string;
|
|
955
|
+
totalScore: number;
|
|
956
|
+
}>;
|
|
957
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
958
|
+
};
|
|
959
|
+
export type RAGRetrievalTrace = {
|
|
960
|
+
query: string;
|
|
961
|
+
transformedQuery: string;
|
|
962
|
+
variantQueries: string[];
|
|
963
|
+
queryTransformProvider?: string;
|
|
964
|
+
queryTransformLabel?: string;
|
|
965
|
+
queryTransformReason?: string;
|
|
966
|
+
topK: number;
|
|
967
|
+
candidateTopK: number;
|
|
968
|
+
lexicalTopK: number;
|
|
969
|
+
requestedMode?: RAGHybridRetrievalMode;
|
|
970
|
+
maxResultsPerSource?: number;
|
|
971
|
+
sourceBalanceStrategy?: RAGSourceBalanceStrategy;
|
|
972
|
+
diversityStrategy?: RAGDiversityStrategy;
|
|
973
|
+
mmrLambda?: number;
|
|
974
|
+
mode: RAGHybridRetrievalMode;
|
|
975
|
+
routingProvider?: string;
|
|
976
|
+
routingLabel?: string;
|
|
977
|
+
routingReason?: string;
|
|
978
|
+
runVector: boolean;
|
|
979
|
+
runLexical: boolean;
|
|
980
|
+
scoreThreshold?: number;
|
|
981
|
+
resultCounts: {
|
|
982
|
+
vector: number;
|
|
983
|
+
lexical: number;
|
|
984
|
+
fused: number;
|
|
985
|
+
reranked: number;
|
|
986
|
+
final: number;
|
|
987
|
+
};
|
|
988
|
+
multiVector?: {
|
|
989
|
+
configured: boolean;
|
|
990
|
+
vectorVariantHits: number;
|
|
991
|
+
lexicalVariantHits: number;
|
|
992
|
+
collapsedParents: number;
|
|
993
|
+
};
|
|
994
|
+
steps: RAGRetrievalTraceStep[];
|
|
995
|
+
};
|
|
996
|
+
export type RAGCollectionSearchResult = {
|
|
997
|
+
results: RAGQueryResult[];
|
|
998
|
+
trace: RAGRetrievalTrace;
|
|
999
|
+
};
|
|
1000
|
+
export type RAGSearchRequest = Omit<RAGCollectionSearchParams, 'signal' | 'rerank'> & {
|
|
1001
|
+
includeTrace?: boolean;
|
|
1002
|
+
persistTrace?: boolean;
|
|
1003
|
+
traceGroupKey?: string;
|
|
1004
|
+
traceTags?: string[];
|
|
1005
|
+
};
|
|
1006
|
+
export type RAGSearchResponse = {
|
|
1007
|
+
ok: boolean;
|
|
1008
|
+
results?: RAGSource[];
|
|
1009
|
+
trace?: RAGRetrievalTrace;
|
|
1010
|
+
error?: string;
|
|
1011
|
+
};
|
|
1012
|
+
export type RAGSearchTraceHistoryResponse = {
|
|
1013
|
+
ok: boolean;
|
|
1014
|
+
history?: RAGSearchTraceHistory;
|
|
1015
|
+
error?: string;
|
|
1016
|
+
};
|
|
1017
|
+
export type RAGSearchTraceGroupHistoryResponse = {
|
|
1018
|
+
ok: boolean;
|
|
1019
|
+
history?: RAGSearchTraceGroupHistory;
|
|
1020
|
+
error?: string;
|
|
1021
|
+
};
|
|
1022
|
+
export type RAGIngestResponse = {
|
|
1023
|
+
ok: boolean;
|
|
1024
|
+
count?: number;
|
|
1025
|
+
documentCount?: number;
|
|
1026
|
+
error?: string;
|
|
1027
|
+
};
|
|
1028
|
+
export type RAGDocumentSummary = {
|
|
1029
|
+
total: number;
|
|
1030
|
+
chunkCount: number;
|
|
1031
|
+
byKind: Record<string, number>;
|
|
1032
|
+
};
|
|
1033
|
+
export type RAGIngestJobStatus = 'running' | 'completed' | 'failed';
|
|
1034
|
+
export type RAGIngestJobRecord = {
|
|
1035
|
+
id: string;
|
|
1036
|
+
status: RAGIngestJobStatus;
|
|
1037
|
+
startedAt: number;
|
|
1038
|
+
finishedAt?: number;
|
|
1039
|
+
elapsedMs?: number;
|
|
1040
|
+
inputKind: 'chunks' | 'documents' | 'urls' | 'uploads';
|
|
1041
|
+
requestedCount: number;
|
|
1042
|
+
chunkCount?: number;
|
|
1043
|
+
documentCount?: number;
|
|
1044
|
+
error?: string;
|
|
1045
|
+
extractorNames?: string[];
|
|
1046
|
+
};
|
|
1047
|
+
export type RAGCorpusHealth = {
|
|
1048
|
+
emptyDocuments: number;
|
|
1049
|
+
emptyChunks: number;
|
|
1050
|
+
duplicateSources: string[];
|
|
1051
|
+
duplicateSourceGroups: Array<{
|
|
1052
|
+
source: string;
|
|
1053
|
+
count: number;
|
|
1054
|
+
}>;
|
|
1055
|
+
duplicateDocumentIds: string[];
|
|
1056
|
+
duplicateDocumentIdGroups: Array<{
|
|
1057
|
+
id: string;
|
|
1058
|
+
count: number;
|
|
1059
|
+
}>;
|
|
1060
|
+
documentsMissingSource: number;
|
|
1061
|
+
documentsMissingTitle: number;
|
|
1062
|
+
documentsMissingMetadata: number;
|
|
1063
|
+
documentsMissingCreatedAt: number;
|
|
1064
|
+
documentsMissingUpdatedAt: number;
|
|
1065
|
+
documentsWithoutChunkPreview: number;
|
|
1066
|
+
coverageByFormat: Record<string, number>;
|
|
1067
|
+
coverageByKind: Record<string, number>;
|
|
1068
|
+
failedAdminJobs: number;
|
|
1069
|
+
failedIngestJobs: number;
|
|
1070
|
+
failuresByAdminAction: Record<string, number>;
|
|
1071
|
+
failuresByExtractor: Record<string, number>;
|
|
1072
|
+
failuresByInputKind: Record<string, number>;
|
|
1073
|
+
inspectedChunks: number;
|
|
1074
|
+
inspectedDocuments: number;
|
|
1075
|
+
lowSignalChunks: number;
|
|
1076
|
+
oldestDocumentAgeMs?: number;
|
|
1077
|
+
newestDocumentAgeMs?: number;
|
|
1078
|
+
staleAfterMs: number;
|
|
1079
|
+
staleDocuments: string[];
|
|
1080
|
+
averageChunksPerDocument: number;
|
|
1081
|
+
inspection?: {
|
|
1082
|
+
corpusKeys: Record<string, number>;
|
|
1083
|
+
sourceNativeKinds: Record<string, number>;
|
|
1084
|
+
extractorRegistryMatches: Record<string, number>;
|
|
1085
|
+
chunkingProfiles: Record<string, number>;
|
|
1086
|
+
documentsWithSourceLabels: number;
|
|
1087
|
+
chunksWithSourceLabels: number;
|
|
1088
|
+
sampleDocuments: Array<{
|
|
1089
|
+
corpusKey?: string;
|
|
1090
|
+
id: string;
|
|
1091
|
+
title: string;
|
|
1092
|
+
source: string;
|
|
1093
|
+
sourceNativeKind?: string;
|
|
1094
|
+
extractorRegistryMatch?: string;
|
|
1095
|
+
chunkingProfile?: string;
|
|
1096
|
+
labels?: RAGSourceLabels;
|
|
1097
|
+
}>;
|
|
1098
|
+
sampleChunks: Array<{
|
|
1099
|
+
chunkId: string;
|
|
1100
|
+
corpusKey?: string;
|
|
1101
|
+
documentId?: string;
|
|
1102
|
+
source?: string;
|
|
1103
|
+
sourceNativeKind?: string;
|
|
1104
|
+
extractorRegistryMatch?: string;
|
|
1105
|
+
chunkingProfile?: string;
|
|
1106
|
+
labels?: RAGSourceLabels;
|
|
1107
|
+
}>;
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
export type RAGAdminActionRecord = {
|
|
1111
|
+
id: string;
|
|
1112
|
+
action: 'analyze_backend' | 'rebuild_native_index' | 'clear_index' | 'create_document' | 'delete_document' | 'promote_retrieval_baseline' | 'revert_retrieval_baseline' | 'prune_search_traces' | 'reindex_document' | 'reindex_source' | 'sync_all_sources' | 'sync_source' | 'reseed' | 'reset';
|
|
1113
|
+
status: 'completed' | 'failed';
|
|
1114
|
+
startedAt: number;
|
|
1115
|
+
finishedAt?: number;
|
|
1116
|
+
elapsedMs?: number;
|
|
1117
|
+
documentId?: string;
|
|
1118
|
+
target?: string;
|
|
1119
|
+
error?: string;
|
|
1120
|
+
};
|
|
1121
|
+
export type RAGAdminJobStatus = 'running' | 'completed' | 'failed';
|
|
1122
|
+
export type RAGAdminJobRecord = {
|
|
1123
|
+
id: string;
|
|
1124
|
+
action: 'analyze_backend' | 'rebuild_native_index' | 'clear_index' | 'create_document' | 'delete_document' | 'promote_retrieval_baseline' | 'revert_retrieval_baseline' | 'prune_search_traces' | 'reindex_document' | 'reindex_source' | 'sync_all_sources' | 'sync_source' | 'reseed' | 'reset';
|
|
1125
|
+
status: RAGAdminJobStatus;
|
|
1126
|
+
startedAt: number;
|
|
1127
|
+
finishedAt?: number;
|
|
1128
|
+
elapsedMs?: number;
|
|
1129
|
+
target?: string;
|
|
1130
|
+
error?: string;
|
|
1131
|
+
};
|
|
1132
|
+
export type RAGJobState = {
|
|
1133
|
+
adminActions: RAGAdminActionRecord[];
|
|
1134
|
+
ingestJobs: RAGIngestJobRecord[];
|
|
1135
|
+
adminJobs: RAGAdminJobRecord[];
|
|
1136
|
+
syncJobs: RAGAdminJobRecord[];
|
|
1137
|
+
};
|
|
1138
|
+
export type RAGJobStateStore = {
|
|
1139
|
+
load: () => Promise<Partial<RAGJobState> | undefined> | Partial<RAGJobState> | undefined;
|
|
1140
|
+
save: (state: RAGJobState) => Promise<void> | void;
|
|
1141
|
+
};
|
|
1142
|
+
export type RAGJobHistoryRetention = {
|
|
1143
|
+
maxAdminActions?: number;
|
|
1144
|
+
maxAdminJobs?: number;
|
|
1145
|
+
maxIngestJobs?: number;
|
|
1146
|
+
maxSyncJobs?: number;
|
|
1147
|
+
};
|
|
1148
|
+
export type RAGAdminCapabilities = {
|
|
1149
|
+
canAnalyzeBackend: boolean;
|
|
1150
|
+
canClearIndex: boolean;
|
|
1151
|
+
canCreateDocument: boolean;
|
|
1152
|
+
canDeleteDocument: boolean;
|
|
1153
|
+
canListSyncSources: boolean;
|
|
1154
|
+
canManageRetrievalBaselines: boolean;
|
|
1155
|
+
canPruneSearchTraces: boolean;
|
|
1156
|
+
canRebuildNativeIndex: boolean;
|
|
1157
|
+
canReindexDocument: boolean;
|
|
1158
|
+
canReindexSource: boolean;
|
|
1159
|
+
canReseed: boolean;
|
|
1160
|
+
canReset: boolean;
|
|
1161
|
+
canSyncAllSources: boolean;
|
|
1162
|
+
canSyncSource: boolean;
|
|
1163
|
+
};
|
|
1164
|
+
export type RAGBackendMaintenanceRecommendation = {
|
|
1165
|
+
code: 'backend_statistics_refresh_recommended' | 'native_backend_inactive' | 'native_backend_recent_errors' | 'native_index_missing' | 'native_index_rebuild_recommended' | 'sqlite_storage_optimization_recommended';
|
|
1166
|
+
message: string;
|
|
1167
|
+
severity: 'info' | 'warning' | 'error';
|
|
1168
|
+
action?: 'analyze_backend' | 'rebuild_native_index';
|
|
1169
|
+
};
|
|
1170
|
+
export type RAGBackendMaintenanceSummary = {
|
|
1171
|
+
backend: Exclude<RAGVectorStoreStatus['backend'], 'in_memory'>;
|
|
1172
|
+
activeJobs: Array<{
|
|
1173
|
+
action: 'analyze_backend' | 'rebuild_native_index';
|
|
1174
|
+
startedAt: number;
|
|
1175
|
+
target?: string;
|
|
1176
|
+
}>;
|
|
1177
|
+
recentActions: Array<{
|
|
1178
|
+
action: 'analyze_backend' | 'rebuild_native_index';
|
|
1179
|
+
status: RAGAdminActionRecord['status'];
|
|
1180
|
+
finishedAt?: number;
|
|
1181
|
+
target?: string;
|
|
1182
|
+
error?: string;
|
|
1183
|
+
}>;
|
|
1184
|
+
recommendations: RAGBackendMaintenanceRecommendation[];
|
|
1185
|
+
};
|
|
1186
|
+
export type RAGAuthorizedAction = 'analyze_backend' | 'rebuild_native_index' | 'clear_index' | 'create_document' | 'delete_document' | 'ingest' | 'list_sync_sources' | 'manage_retrieval_admin' | 'manage_retrieval_baselines' | 'prune_search_traces' | 'reindex_document' | 'reindex_source' | 'reseed' | 'reset' | 'sync_all_sources' | 'sync_source';
|
|
1187
|
+
export type RAGAuthorizationResource = {
|
|
1188
|
+
documentId?: string;
|
|
1189
|
+
path?: string;
|
|
1190
|
+
source?: string;
|
|
1191
|
+
sourceId?: string;
|
|
1192
|
+
};
|
|
1193
|
+
export type RAGAuthorizationDecision = boolean | {
|
|
1194
|
+
allowed: boolean;
|
|
1195
|
+
reason?: string;
|
|
1196
|
+
};
|
|
1197
|
+
export type RAGAuthorizationContext = {
|
|
1198
|
+
action: RAGAuthorizedAction;
|
|
1199
|
+
request: Request;
|
|
1200
|
+
resource?: RAGAuthorizationResource;
|
|
1201
|
+
};
|
|
1202
|
+
export type RAGAuthorizationProvider = (context: RAGAuthorizationContext) => Promise<RAGAuthorizationDecision> | RAGAuthorizationDecision;
|
|
1203
|
+
export type RAGAccessScope = {
|
|
1204
|
+
allowedComparisonGroupKeys?: string[];
|
|
1205
|
+
allowedCorpusGroupKeys?: string[];
|
|
1206
|
+
allowedCorpusKeys?: string[];
|
|
1207
|
+
allowedDocumentIds?: string[];
|
|
1208
|
+
allowedSourcePrefixes?: string[];
|
|
1209
|
+
allowedSources?: string[];
|
|
1210
|
+
allowedSyncSourceIds?: string[];
|
|
1211
|
+
requiredMetadata?: Record<string, unknown>;
|
|
1212
|
+
};
|
|
1213
|
+
export type RAGAccessScopeProvider = (request: Request) => Promise<RAGAccessScope | undefined> | RAGAccessScope | undefined;
|
|
1214
|
+
export type RAGAccessControlContextResolver<TContext = unknown> = (request: Request) => Promise<TContext | undefined> | TContext | undefined;
|
|
1215
|
+
export type RAGAccessControlAuthorizeResolver<TContext = unknown> = (input: RAGAuthorizationContext & {
|
|
1216
|
+
context: TContext | undefined;
|
|
1217
|
+
}) => Promise<RAGAuthorizationDecision> | RAGAuthorizationDecision;
|
|
1218
|
+
export type RAGAccessControlScopeResolver<TContext = unknown> = (input: {
|
|
1219
|
+
context: TContext | undefined;
|
|
1220
|
+
request: Request;
|
|
1221
|
+
}) => Promise<RAGAccessScope | undefined> | RAGAccessScope | undefined;
|
|
1222
|
+
export type CreateRAGAccessControlOptions<TContext = unknown> = {
|
|
1223
|
+
resolveContext: RAGAccessControlContextResolver<TContext>;
|
|
1224
|
+
authorize?: RAGAccessControlAuthorizeResolver<TContext>;
|
|
1225
|
+
resolveScope?: RAGAccessControlScopeResolver<TContext>;
|
|
1226
|
+
};
|
|
1227
|
+
export type RAGSyncSourceStatus = 'idle' | 'running' | 'completed' | 'failed' | 'disabled';
|
|
1228
|
+
export type RAGSyncSourceDiagnosticCode = 'sync_failed' | 'retry_scheduled' | 'storage_resume_pending' | 'email_resume_pending' | 'lineage_conflict_detected' | 'duplicate_sync_key_detected' | 'targeted_refresh_applied' | 'noop_sync' | 'extraction_failures_detected' | 'extractor_missing' | 'ocr_extractor_recommended' | 'canonical_dedupe_applied' | 'robots_blocked' | 'nofollow_skipped' | 'noindex_skipped';
|
|
1229
|
+
export type RAGSyncSourceDiagnosticEntry = {
|
|
1230
|
+
code: RAGSyncSourceDiagnosticCode;
|
|
1231
|
+
severity: 'info' | 'warning' | 'error';
|
|
1232
|
+
summary: string;
|
|
1233
|
+
};
|
|
1234
|
+
export type RAGSyncRetryGuidance = {
|
|
1235
|
+
action: 'wait_for_retry' | 'resume_sync' | 'resolve_conflicts' | 'rerun_sync' | 'inspect_source' | 'configure_extractor';
|
|
1236
|
+
reason: string;
|
|
1237
|
+
nextRetryAt?: number;
|
|
1238
|
+
resumeCursor?: string;
|
|
1239
|
+
syncKeys?: string[];
|
|
1240
|
+
};
|
|
1241
|
+
export type RAGSyncExtractionFailure = {
|
|
1242
|
+
itemLabel: string;
|
|
1243
|
+
itemKind: 'directory_file' | 'url' | 'storage_object' | 'email_attachment';
|
|
1244
|
+
reason: string;
|
|
1245
|
+
remediation: 'configure_extractor' | 'add_ocr_extractor' | 'inspect_file';
|
|
1246
|
+
};
|
|
1247
|
+
export type RAGSyncExtractionRecoveryAction = {
|
|
1248
|
+
remediation: RAGSyncExtractionFailure['remediation'];
|
|
1249
|
+
itemKinds: RAGSyncExtractionFailure['itemKind'][];
|
|
1250
|
+
itemLabels: string[];
|
|
1251
|
+
reasons: string[];
|
|
1252
|
+
count: number;
|
|
1253
|
+
summary: string;
|
|
1254
|
+
};
|
|
1255
|
+
export type RAGSyncExtractionRecoveryPreview = {
|
|
1256
|
+
actions: RAGSyncExtractionRecoveryAction[];
|
|
1257
|
+
recommendedAction?: RAGSyncExtractionRecoveryAction;
|
|
1258
|
+
unresolvedFailures: RAGSyncExtractionFailure[];
|
|
1259
|
+
summary?: string;
|
|
1260
|
+
};
|
|
1261
|
+
export type RAGSyncExtractionRecoveryHandler = (action: RAGSyncExtractionRecoveryAction) => Promise<boolean | void> | boolean | void;
|
|
1262
|
+
export type RAGSyncExtractionRecoveryHandlers = Partial<Record<RAGSyncExtractionFailure['remediation'], RAGSyncExtractionRecoveryHandler>>;
|
|
1263
|
+
export type RAGSyncExtractionRecoveryResult = RAGSyncExtractionRecoveryPreview & {
|
|
1264
|
+
completedActions: RAGSyncExtractionRecoveryAction[];
|
|
1265
|
+
failedActions: RAGSyncExtractionRecoveryAction[];
|
|
1266
|
+
skippedActions: RAGSyncExtractionRecoveryAction[];
|
|
1267
|
+
errorsByRemediation?: Partial<Record<RAGSyncExtractionFailure['remediation'], string>>;
|
|
1268
|
+
};
|
|
1269
|
+
export type RAGSyncSourceDiagnostics = {
|
|
1270
|
+
summary: string;
|
|
1271
|
+
entries: RAGSyncSourceDiagnosticEntry[];
|
|
1272
|
+
extractionFailures?: RAGSyncExtractionFailure[];
|
|
1273
|
+
retryGuidance?: RAGSyncRetryGuidance;
|
|
1274
|
+
};
|
|
1275
|
+
export type RAGSyncSourceRecord = {
|
|
1276
|
+
id: string;
|
|
1277
|
+
label: string;
|
|
1278
|
+
kind: 'directory' | 'url' | 'storage' | 'email' | 'custom';
|
|
1279
|
+
status: RAGSyncSourceStatus;
|
|
1280
|
+
description?: string;
|
|
1281
|
+
target?: string;
|
|
1282
|
+
lastStartedAt?: number;
|
|
1283
|
+
lastSyncedAt?: number;
|
|
1284
|
+
lastSyncDurationMs?: number;
|
|
1285
|
+
lastError?: string;
|
|
1286
|
+
lastSuccessfulSyncAt?: number;
|
|
1287
|
+
consecutiveFailures?: number;
|
|
1288
|
+
retryAttempts?: number;
|
|
1289
|
+
nextRetryAt?: number;
|
|
1290
|
+
documentCount?: number;
|
|
1291
|
+
chunkCount?: number;
|
|
1292
|
+
reconciliation?: RAGSyncSourceReconciliationSummary;
|
|
1293
|
+
diagnostics?: RAGSyncSourceDiagnostics;
|
|
1294
|
+
metadata?: Record<string, unknown>;
|
|
1295
|
+
};
|
|
1296
|
+
export type RAGSyncSourceReconciliationSummary = {
|
|
1297
|
+
refreshMode: 'noop' | 'targeted';
|
|
1298
|
+
staleDocumentIds: string[];
|
|
1299
|
+
staleSyncKeys: string[];
|
|
1300
|
+
refreshedDocumentIds: string[];
|
|
1301
|
+
refreshedSyncKeys: string[];
|
|
1302
|
+
unchangedDocumentIds: string[];
|
|
1303
|
+
unchangedSyncKeys: string[];
|
|
1304
|
+
targetedRefreshSyncKeys: string[];
|
|
1305
|
+
duplicateSyncKeyGroups: Array<{
|
|
1306
|
+
syncKey: string;
|
|
1307
|
+
count: number;
|
|
1308
|
+
documentIds: string[];
|
|
1309
|
+
}>;
|
|
1310
|
+
lineageConflicts: Array<{
|
|
1311
|
+
syncKey: string;
|
|
1312
|
+
lineageIds: string[];
|
|
1313
|
+
versionIds: string[];
|
|
1314
|
+
latestDocumentIds: string[];
|
|
1315
|
+
documentIds: string[];
|
|
1316
|
+
documents: Array<{
|
|
1317
|
+
documentId: string;
|
|
1318
|
+
lineageId?: string;
|
|
1319
|
+
versionId?: string;
|
|
1320
|
+
versionNumber?: number;
|
|
1321
|
+
isLatestVersion: boolean;
|
|
1322
|
+
}>;
|
|
1323
|
+
reasons: Array<'duplicate_sync_key' | 'multiple_lineages' | 'multiple_versions' | 'multiple_latest_versions'>;
|
|
1324
|
+
}>;
|
|
1325
|
+
};
|
|
1326
|
+
export type RAGSyncConflictResolutionStrategy = 'keep_latest' | 'keep_highest_version';
|
|
1327
|
+
export type RAGSyncConflictResolutionAction = {
|
|
1328
|
+
syncKey: string;
|
|
1329
|
+
keepDocumentId: string;
|
|
1330
|
+
deleteDocumentIds: string[];
|
|
1331
|
+
reasons: RAGSyncSourceReconciliationSummary['lineageConflicts'][number]['reasons'];
|
|
1332
|
+
};
|
|
1333
|
+
export type RAGSyncConflictResolutionAmbiguity = {
|
|
1334
|
+
syncKey: string;
|
|
1335
|
+
reasons: RAGSyncSourceReconciliationSummary['lineageConflicts'][number]['reasons'];
|
|
1336
|
+
candidateDocumentIds: string[];
|
|
1337
|
+
recommendedStrategy?: RAGSyncConflictResolutionStrategy;
|
|
1338
|
+
};
|
|
1339
|
+
export type RAGSyncConflictResolutionPreview = {
|
|
1340
|
+
strategy: RAGSyncConflictResolutionStrategy;
|
|
1341
|
+
actions: RAGSyncConflictResolutionAction[];
|
|
1342
|
+
unresolvedSyncKeys: string[];
|
|
1343
|
+
unresolvedConflicts: RAGSyncConflictResolutionAmbiguity[];
|
|
1344
|
+
};
|
|
1345
|
+
export type RAGSyncConflictResolutionResult = RAGSyncConflictResolutionPreview & {
|
|
1346
|
+
deletedDocumentIds: string[];
|
|
1347
|
+
failedDocumentIds: string[];
|
|
1348
|
+
errorsByDocumentId?: Record<string, string>;
|
|
1349
|
+
};
|
|
1350
|
+
export type RAGSyncSourceRunResult = {
|
|
1351
|
+
documentCount?: number;
|
|
1352
|
+
chunkCount?: number;
|
|
1353
|
+
reconciliation?: RAGSyncSourceReconciliationSummary;
|
|
1354
|
+
diagnostics?: RAGSyncSourceDiagnostics;
|
|
1355
|
+
metadata?: Record<string, unknown>;
|
|
1356
|
+
};
|
|
1357
|
+
export type RAGSyncSourceDefinition = {
|
|
1358
|
+
id: string;
|
|
1359
|
+
label: string;
|
|
1360
|
+
kind: RAGSyncSourceRecord['kind'];
|
|
1361
|
+
description?: string;
|
|
1362
|
+
target?: string;
|
|
1363
|
+
metadata?: Record<string, unknown>;
|
|
1364
|
+
retryAttempts?: number;
|
|
1365
|
+
retryDelayMs?: number;
|
|
1366
|
+
sync: (input: RAGSyncSourceContext) => Promise<RAGSyncSourceRunResult> | RAGSyncSourceRunResult;
|
|
1367
|
+
};
|
|
1368
|
+
export type RAGSyncSourceContext = {
|
|
1369
|
+
collection: RAGCollection;
|
|
1370
|
+
listDocuments?: () => Promise<RAGIndexedDocument[]> | RAGIndexedDocument[];
|
|
1371
|
+
deleteDocument?: (id: string) => Promise<boolean> | boolean;
|
|
1372
|
+
sourceRecord?: RAGSyncSourceRecord;
|
|
1373
|
+
signal?: AbortSignal;
|
|
1374
|
+
};
|
|
1375
|
+
export type RAGSQLiteStoreMigrationIssue = {
|
|
1376
|
+
tableName: string;
|
|
1377
|
+
columnName: string;
|
|
1378
|
+
definition: string;
|
|
1379
|
+
};
|
|
1380
|
+
export type RAGSQLiteStoreMigrationInspection = {
|
|
1381
|
+
issues: RAGSQLiteStoreMigrationIssue[];
|
|
1382
|
+
summary?: string;
|
|
1383
|
+
};
|
|
1384
|
+
export type RAGSQLiteStoreMigrationResult = RAGSQLiteStoreMigrationInspection & {
|
|
1385
|
+
applied: RAGSQLiteStoreMigrationIssue[];
|
|
1386
|
+
};
|
|
1387
|
+
export type RAGStorageSyncObject = {
|
|
1388
|
+
key: string;
|
|
1389
|
+
size?: number;
|
|
1390
|
+
etag?: string;
|
|
1391
|
+
lastModified?: number | string | Date;
|
|
1392
|
+
contentType?: string;
|
|
1393
|
+
metadata?: Record<string, unknown>;
|
|
1394
|
+
};
|
|
1395
|
+
export type RAGStorageSyncFile = {
|
|
1396
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
1397
|
+
text?: () => Promise<string>;
|
|
1398
|
+
exists?: () => Promise<boolean>;
|
|
1399
|
+
};
|
|
1400
|
+
export type RAGStorageSyncListInput = {
|
|
1401
|
+
prefix?: string;
|
|
1402
|
+
startAfter?: string;
|
|
1403
|
+
maxKeys?: number;
|
|
1404
|
+
};
|
|
1405
|
+
export type RAGStorageSyncListResult = {
|
|
1406
|
+
contents: RAGStorageSyncObject[];
|
|
1407
|
+
isTruncated?: boolean;
|
|
1408
|
+
nextContinuationToken?: string;
|
|
1409
|
+
};
|
|
1410
|
+
export type RAGStorageSyncClient = {
|
|
1411
|
+
file: (key: string) => RAGStorageSyncFile;
|
|
1412
|
+
list: (input?: RAGStorageSyncListInput) => Promise<RAGStorageSyncListResult> | RAGStorageSyncListResult;
|
|
1413
|
+
};
|
|
1414
|
+
export type RAGDirectorySyncSourceOptions = {
|
|
1415
|
+
id: string;
|
|
1416
|
+
label: string;
|
|
1417
|
+
directory: string;
|
|
1418
|
+
description?: string;
|
|
1419
|
+
baseMetadata?: Record<string, unknown>;
|
|
1420
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1421
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1422
|
+
extractors?: RAGFileExtractor[];
|
|
1423
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1424
|
+
includeExtensions?: string[];
|
|
1425
|
+
metadata?: Record<string, unknown>;
|
|
1426
|
+
recursive?: boolean;
|
|
1427
|
+
retryAttempts?: number;
|
|
1428
|
+
retryDelayMs?: number;
|
|
1429
|
+
};
|
|
1430
|
+
export type RAGUrlSyncSourceOptions = {
|
|
1431
|
+
id: string;
|
|
1432
|
+
label: string;
|
|
1433
|
+
urls: RAGDocumentUrlInput[];
|
|
1434
|
+
description?: string;
|
|
1435
|
+
baseMetadata?: Record<string, unknown>;
|
|
1436
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1437
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1438
|
+
extractors?: RAGFileExtractor[];
|
|
1439
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1440
|
+
metadata?: Record<string, unknown>;
|
|
1441
|
+
retryAttempts?: number;
|
|
1442
|
+
retryDelayMs?: number;
|
|
1443
|
+
};
|
|
1444
|
+
export type RAGFeedSyncInput = {
|
|
1445
|
+
url: string;
|
|
1446
|
+
title?: string;
|
|
1447
|
+
metadata?: Record<string, unknown>;
|
|
1448
|
+
};
|
|
1449
|
+
export type RAGFeedSyncSourceOptions = {
|
|
1450
|
+
id: string;
|
|
1451
|
+
label: string;
|
|
1452
|
+
feeds: RAGFeedSyncInput[];
|
|
1453
|
+
description?: string;
|
|
1454
|
+
autoDiscoverFromHTML?: boolean;
|
|
1455
|
+
maxEntriesPerFeed?: number;
|
|
1456
|
+
maxDiscoveredFeeds?: number;
|
|
1457
|
+
baseMetadata?: Record<string, unknown>;
|
|
1458
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1459
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1460
|
+
extractors?: RAGFileExtractor[];
|
|
1461
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1462
|
+
metadata?: Record<string, unknown>;
|
|
1463
|
+
retryAttempts?: number;
|
|
1464
|
+
retryDelayMs?: number;
|
|
1465
|
+
};
|
|
1466
|
+
export type RAGSitemapSyncInput = {
|
|
1467
|
+
url: string;
|
|
1468
|
+
title?: string;
|
|
1469
|
+
metadata?: Record<string, unknown>;
|
|
1470
|
+
};
|
|
1471
|
+
export type RAGSitemapSyncSourceOptions = {
|
|
1472
|
+
id: string;
|
|
1473
|
+
label: string;
|
|
1474
|
+
sitemaps: RAGSitemapSyncInput[];
|
|
1475
|
+
description?: string;
|
|
1476
|
+
maxUrlsPerSitemap?: number;
|
|
1477
|
+
autoDiscoverFromRobots?: boolean;
|
|
1478
|
+
maxNestedSitemaps?: number;
|
|
1479
|
+
baseMetadata?: Record<string, unknown>;
|
|
1480
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1481
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1482
|
+
extractors?: RAGFileExtractor[];
|
|
1483
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1484
|
+
metadata?: Record<string, unknown>;
|
|
1485
|
+
retryAttempts?: number;
|
|
1486
|
+
retryDelayMs?: number;
|
|
1487
|
+
};
|
|
1488
|
+
export type RAGSiteDiscoveryInput = {
|
|
1489
|
+
url: string;
|
|
1490
|
+
title?: string;
|
|
1491
|
+
metadata?: Record<string, unknown>;
|
|
1492
|
+
};
|
|
1493
|
+
export type RAGSiteDiscoverySyncSourceOptions = {
|
|
1494
|
+
id: string;
|
|
1495
|
+
label: string;
|
|
1496
|
+
sites: RAGSiteDiscoveryInput[];
|
|
1497
|
+
description?: string;
|
|
1498
|
+
autoDiscoverFeeds?: boolean;
|
|
1499
|
+
autoDiscoverSitemaps?: boolean;
|
|
1500
|
+
autoDiscoverLinkedPages?: boolean;
|
|
1501
|
+
maxDiscoveredFeeds?: number;
|
|
1502
|
+
maxEntriesPerFeed?: number;
|
|
1503
|
+
maxUrlsPerSitemap?: number;
|
|
1504
|
+
maxNestedSitemaps?: number;
|
|
1505
|
+
maxLinkedPages?: number;
|
|
1506
|
+
maxLinksPerPage?: number;
|
|
1507
|
+
maxLinkDepth?: number;
|
|
1508
|
+
baseMetadata?: Record<string, unknown>;
|
|
1509
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1510
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1511
|
+
extractors?: RAGFileExtractor[];
|
|
1512
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1513
|
+
metadata?: Record<string, unknown>;
|
|
1514
|
+
retryAttempts?: number;
|
|
1515
|
+
retryDelayMs?: number;
|
|
1516
|
+
};
|
|
1517
|
+
export type RAGGitHubRepoSyncInput = {
|
|
1518
|
+
owner: string;
|
|
1519
|
+
repo: string;
|
|
1520
|
+
branch?: string;
|
|
1521
|
+
pathPrefix?: string;
|
|
1522
|
+
includePaths?: string[];
|
|
1523
|
+
excludePaths?: string[];
|
|
1524
|
+
metadata?: Record<string, unknown>;
|
|
1525
|
+
};
|
|
1526
|
+
export type RAGGitHubSyncSourceOptions = {
|
|
1527
|
+
id: string;
|
|
1528
|
+
label: string;
|
|
1529
|
+
repos: RAGGitHubRepoSyncInput[];
|
|
1530
|
+
description?: string;
|
|
1531
|
+
apiBaseUrl?: string;
|
|
1532
|
+
token?: string;
|
|
1533
|
+
maxDepth?: number;
|
|
1534
|
+
maxFilesPerRepo?: number;
|
|
1535
|
+
includeExtensions?: string[];
|
|
1536
|
+
baseMetadata?: Record<string, unknown>;
|
|
1537
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1538
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1539
|
+
extractors?: RAGFileExtractor[];
|
|
1540
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1541
|
+
metadata?: Record<string, unknown>;
|
|
1542
|
+
retryAttempts?: number;
|
|
1543
|
+
retryDelayMs?: number;
|
|
1544
|
+
};
|
|
1545
|
+
export type RAGStorageSyncSourceOptions = {
|
|
1546
|
+
id: string;
|
|
1547
|
+
label: string;
|
|
1548
|
+
client: RAGStorageSyncClient;
|
|
1549
|
+
description?: string;
|
|
1550
|
+
prefix?: string;
|
|
1551
|
+
keys?: string[];
|
|
1552
|
+
maxKeys?: number;
|
|
1553
|
+
baseMetadata?: Record<string, unknown>;
|
|
1554
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1555
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1556
|
+
extractors?: RAGFileExtractor[];
|
|
1557
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1558
|
+
maxPagesPerRun?: number;
|
|
1559
|
+
metadata?: Record<string, unknown>;
|
|
1560
|
+
resumeFromLastCursor?: boolean;
|
|
1561
|
+
retryAttempts?: number;
|
|
1562
|
+
retryDelayMs?: number;
|
|
1563
|
+
};
|
|
1564
|
+
export type RAGEmailSyncAttachment = {
|
|
1565
|
+
id?: string;
|
|
1566
|
+
name: string;
|
|
1567
|
+
content: string | Uint8Array;
|
|
1568
|
+
contentType?: string;
|
|
1569
|
+
encoding?: 'base64' | 'utf8';
|
|
1570
|
+
format?: RAGContentFormat;
|
|
1571
|
+
source?: string;
|
|
1572
|
+
title?: string;
|
|
1573
|
+
metadata?: Record<string, unknown>;
|
|
1574
|
+
chunking?: RAGChunkingOptions;
|
|
1575
|
+
};
|
|
1576
|
+
export type RAGEmailSyncMessage = {
|
|
1577
|
+
id: string;
|
|
1578
|
+
threadId?: string;
|
|
1579
|
+
subject?: string;
|
|
1580
|
+
from?: string;
|
|
1581
|
+
to?: string[];
|
|
1582
|
+
cc?: string[];
|
|
1583
|
+
sentAt?: number | string | Date;
|
|
1584
|
+
receivedAt?: number | string | Date;
|
|
1585
|
+
bodyText: string;
|
|
1586
|
+
bodyHtml?: string;
|
|
1587
|
+
metadata?: Record<string, unknown>;
|
|
1588
|
+
attachments?: RAGEmailSyncAttachment[];
|
|
1589
|
+
};
|
|
1590
|
+
export type RAGEmailSyncListInput = {
|
|
1591
|
+
cursor?: string;
|
|
1592
|
+
maxResults?: number;
|
|
1593
|
+
};
|
|
1594
|
+
export type RAGEmailSyncListResult = {
|
|
1595
|
+
messages: RAGEmailSyncMessage[];
|
|
1596
|
+
nextCursor?: string;
|
|
1597
|
+
};
|
|
1598
|
+
export type RAGEmailSyncClient = {
|
|
1599
|
+
listMessages: (input?: RAGEmailSyncListInput) => Promise<RAGEmailSyncListResult> | RAGEmailSyncListResult;
|
|
1600
|
+
};
|
|
1601
|
+
export type RAGEmailSyncSourceOptions = {
|
|
1602
|
+
id: string;
|
|
1603
|
+
label: string;
|
|
1604
|
+
client: RAGEmailSyncClient;
|
|
1605
|
+
description?: string;
|
|
1606
|
+
maxResults?: number;
|
|
1607
|
+
baseMetadata?: Record<string, unknown>;
|
|
1608
|
+
defaultChunking?: RAGChunkingOptions;
|
|
1609
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
1610
|
+
extractors?: RAGFileExtractor[];
|
|
1611
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
1612
|
+
maxPagesPerRun?: number;
|
|
1613
|
+
metadata?: Record<string, unknown>;
|
|
1614
|
+
resumeFromLastCursor?: boolean;
|
|
1615
|
+
retryAttempts?: number;
|
|
1616
|
+
retryDelayMs?: number;
|
|
1617
|
+
};
|
|
1618
|
+
export type RAGSyncManager = Pick<RAGIndexManager, 'listSyncSources' | 'syncSource' | 'syncAllSources'>;
|
|
1619
|
+
export type RAGSyncRunOptions = {
|
|
1620
|
+
background?: boolean;
|
|
1621
|
+
};
|
|
1622
|
+
export type CreateRAGSyncManagerOptions = {
|
|
1623
|
+
collection: RAGCollection;
|
|
1624
|
+
deleteDocument?: (id: string) => Promise<boolean> | boolean;
|
|
1625
|
+
listDocuments?: () => Promise<RAGIndexedDocument[]> | RAGIndexedDocument[];
|
|
1626
|
+
loadState?: () => Promise<RAGSyncSourceRecord[]> | RAGSyncSourceRecord[];
|
|
1627
|
+
saveState?: (records: RAGSyncSourceRecord[]) => Promise<void> | void;
|
|
1628
|
+
backgroundByDefault?: boolean;
|
|
1629
|
+
continueOnError?: boolean;
|
|
1630
|
+
retryAttempts?: number;
|
|
1631
|
+
retryDelayMs?: number;
|
|
1632
|
+
sources: RAGSyncSourceDefinition[];
|
|
1633
|
+
};
|
|
1634
|
+
export type RAGSyncStateStore = {
|
|
1635
|
+
load: () => Promise<RAGSyncSourceRecord[]> | RAGSyncSourceRecord[];
|
|
1636
|
+
save: (records: RAGSyncSourceRecord[]) => Promise<void> | void;
|
|
1637
|
+
};
|
|
1638
|
+
export type RAGSyncSchedule = {
|
|
1639
|
+
id: string;
|
|
1640
|
+
label?: string;
|
|
1641
|
+
sourceIds?: string[];
|
|
1642
|
+
intervalMs: number;
|
|
1643
|
+
runImmediately?: boolean;
|
|
1644
|
+
background?: boolean;
|
|
1645
|
+
};
|
|
1646
|
+
export type RAGSyncScheduler = {
|
|
1647
|
+
start: () => Promise<void> | void;
|
|
1648
|
+
stop: () => void;
|
|
1649
|
+
isRunning: () => boolean;
|
|
1650
|
+
listSchedules: () => RAGSyncSchedule[];
|
|
1651
|
+
};
|
|
1652
|
+
export type RAGSyncResponse = {
|
|
1653
|
+
ok: true;
|
|
1654
|
+
source: RAGSyncSourceRecord;
|
|
1655
|
+
partial?: boolean;
|
|
1656
|
+
} | {
|
|
1657
|
+
ok: true;
|
|
1658
|
+
sources: RAGSyncSourceRecord[];
|
|
1659
|
+
partial?: boolean;
|
|
1660
|
+
failedSourceIds?: string[];
|
|
1661
|
+
errorsBySource?: Record<string, string>;
|
|
1662
|
+
} | {
|
|
1663
|
+
ok: false;
|
|
1664
|
+
error: string;
|
|
1665
|
+
};
|
|
1666
|
+
export type RAGExtractorReadiness = {
|
|
1667
|
+
providerConfigured: boolean;
|
|
1668
|
+
providerName?: string;
|
|
1669
|
+
model?: string;
|
|
1670
|
+
embeddingConfigured: boolean;
|
|
1671
|
+
embeddingModel?: string;
|
|
1672
|
+
rerankerConfigured: boolean;
|
|
1673
|
+
indexManagerConfigured: boolean;
|
|
1674
|
+
extractorsConfigured: boolean;
|
|
1675
|
+
extractorNames: string[];
|
|
1676
|
+
};
|
|
1677
|
+
export type RAGOperationsResponse = {
|
|
1678
|
+
ok: true;
|
|
1679
|
+
status?: RAGVectorStoreStatus;
|
|
1680
|
+
capabilities?: RAGBackendCapabilities;
|
|
1681
|
+
documents?: RAGDocumentSummary;
|
|
1682
|
+
admin: RAGAdminCapabilities;
|
|
1683
|
+
adminActions: RAGAdminActionRecord[];
|
|
1684
|
+
adminJobs: RAGAdminJobRecord[];
|
|
1685
|
+
maintenance?: RAGBackendMaintenanceSummary;
|
|
1686
|
+
health: RAGCorpusHealth;
|
|
1687
|
+
readiness: RAGExtractorReadiness;
|
|
1688
|
+
ingestJobs: RAGIngestJobRecord[];
|
|
1689
|
+
syncSources: RAGSyncSourceRecord[];
|
|
1690
|
+
searchTraces?: RAGSearchTraceRetentionRuntime;
|
|
1691
|
+
retrievalComparisons?: RAGRetrievalComparisonRuntime;
|
|
1692
|
+
};
|
|
1693
|
+
export type RAGStatusResponse = {
|
|
1694
|
+
ok: true;
|
|
1695
|
+
status?: RAGVectorStoreStatus;
|
|
1696
|
+
capabilities?: RAGBackendCapabilities;
|
|
1697
|
+
documents?: RAGDocumentSummary;
|
|
1698
|
+
admin?: RAGAdminCapabilities;
|
|
1699
|
+
adminActions?: RAGAdminActionRecord[];
|
|
1700
|
+
adminJobs?: RAGAdminJobRecord[];
|
|
1701
|
+
maintenance?: RAGBackendMaintenanceSummary;
|
|
1702
|
+
health?: RAGCorpusHealth;
|
|
1703
|
+
readiness?: RAGExtractorReadiness;
|
|
1704
|
+
ingestJobs?: RAGIngestJobRecord[];
|
|
1705
|
+
syncSources?: RAGSyncSourceRecord[];
|
|
1706
|
+
searchTraces?: RAGSearchTraceRetentionRuntime;
|
|
1707
|
+
retrievalComparisons?: RAGRetrievalComparisonRuntime;
|
|
1708
|
+
};
|
|
1709
|
+
export type RAGRetrievalReleaseStatusResponse = {
|
|
1710
|
+
ok: true;
|
|
1711
|
+
retrievalComparisons?: RAGRetrievalComparisonRuntime;
|
|
1712
|
+
};
|
|
1713
|
+
export type RAGRetrievalReleaseDriftStatusResponse = {
|
|
1714
|
+
ok: true;
|
|
1715
|
+
handoffDriftRollups?: RAGRetrievalComparisonRuntime['handoffDriftRollups'];
|
|
1716
|
+
handoffDriftCountsByLane?: RAGRetrievalComparisonRuntime['handoffDriftCountsByLane'];
|
|
1717
|
+
};
|
|
1718
|
+
export type RAGRemediationAction = {
|
|
1719
|
+
kind: 'approve_candidate' | 'acknowledge_incident' | 'resolve_incident' | 'view_release_status' | 'view_release_drift' | 'view_handoffs';
|
|
1720
|
+
label: string;
|
|
1721
|
+
method: 'GET' | 'POST';
|
|
1722
|
+
path: string;
|
|
1723
|
+
payload?: Record<string, unknown>;
|
|
1724
|
+
};
|
|
1725
|
+
export type RAGRemediationStep = {
|
|
1726
|
+
kind: 'renew_approval' | 'record_approval' | 'inspect_gate' | 'rerun_comparison' | 'restore_source_lane' | 'review_readiness' | 'monitor_lane';
|
|
1727
|
+
label: string;
|
|
1728
|
+
actions?: RAGRemediationAction[];
|
|
1729
|
+
};
|
|
1730
|
+
export type RAGRetrievalLaneHandoffIncidentSummary = {
|
|
1731
|
+
openCount: number;
|
|
1732
|
+
resolvedCount: number;
|
|
1733
|
+
staleOpenCount: number;
|
|
1734
|
+
acknowledgedOpenCount: number;
|
|
1735
|
+
unacknowledgedOpenCount: number;
|
|
1736
|
+
latestTriggeredAt?: number;
|
|
1737
|
+
latestResolvedAt?: number;
|
|
1738
|
+
oldestOpenTriggeredAt?: number;
|
|
1739
|
+
oldestOpenAgeMs?: number;
|
|
1740
|
+
};
|
|
1741
|
+
export type RAGRetrievalLaneHandoffFreshnessWindow = {
|
|
1742
|
+
groupKey: string;
|
|
1743
|
+
sourceRolloutLabel?: RAGRetrievalLaneHandoffDecisionRecord['sourceRolloutLabel'];
|
|
1744
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
1745
|
+
candidateRetrievalId?: string;
|
|
1746
|
+
sourceRunId?: string;
|
|
1747
|
+
latestApprovedAt?: number;
|
|
1748
|
+
approvalAgeMs?: number;
|
|
1749
|
+
staleAfterMs?: number;
|
|
1750
|
+
expiresAt?: number;
|
|
1751
|
+
freshnessStatus: 'fresh' | 'expired' | 'not_applicable';
|
|
1752
|
+
};
|
|
1753
|
+
export type RAGRetrievalLaneHandoffAutoCompleteSummary = {
|
|
1754
|
+
groupKey: string;
|
|
1755
|
+
sourceRolloutLabel?: RAGRetrievalLaneHandoffDecisionRecord['sourceRolloutLabel'];
|
|
1756
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
1757
|
+
candidateRetrievalId?: string;
|
|
1758
|
+
sourceRunId?: string;
|
|
1759
|
+
enabled: boolean;
|
|
1760
|
+
ready: boolean;
|
|
1761
|
+
maxApprovedDecisionAgeMs?: number;
|
|
1762
|
+
latestApprovedAt?: number;
|
|
1763
|
+
approvalAgeMs?: number;
|
|
1764
|
+
approvalExpiresAt?: number;
|
|
1765
|
+
freshnessStatus: 'fresh' | 'expired' | 'not_applicable';
|
|
1766
|
+
reasons: string[];
|
|
1767
|
+
};
|
|
1768
|
+
export type RAGRetrievalLaneHandoffIncidentStatusResponse = {
|
|
1769
|
+
ok: true;
|
|
1770
|
+
incidents?: RAGRetrievalLaneHandoffIncidentRecord[];
|
|
1771
|
+
incidentSummary?: RAGRetrievalLaneHandoffIncidentSummary;
|
|
1772
|
+
freshnessWindows?: RAGRetrievalLaneHandoffFreshnessWindow[];
|
|
1773
|
+
recentHistory?: RAGRetrievalLaneHandoffIncidentHistoryRecord[];
|
|
1774
|
+
};
|
|
1775
|
+
export type RAGRetrievalLaneHandoffStatusResponse = {
|
|
1776
|
+
ok: true;
|
|
1777
|
+
handoffs?: RAGRetrievalReleaseLaneHandoffSummary[];
|
|
1778
|
+
decisions?: RAGRetrievalLaneHandoffDecisionRecord[];
|
|
1779
|
+
incidents?: RAGRetrievalLaneHandoffIncidentRecord[];
|
|
1780
|
+
incidentSummary?: RAGRetrievalLaneHandoffIncidentSummary;
|
|
1781
|
+
freshnessWindows?: RAGRetrievalLaneHandoffFreshnessWindow[];
|
|
1782
|
+
autoComplete?: RAGRetrievalLaneHandoffAutoCompleteSummary[];
|
|
1783
|
+
recentHistory?: RAGRetrievalLaneHandoffIncidentHistoryRecord[];
|
|
1784
|
+
};
|
|
1785
|
+
export type RAGSearchTraceStatsResponse = {
|
|
1786
|
+
ok: boolean;
|
|
1787
|
+
stats?: RAGSearchTraceStats;
|
|
1788
|
+
error?: string;
|
|
1789
|
+
};
|
|
1790
|
+
export type RAGSearchTracePrunePreviewResponse = {
|
|
1791
|
+
ok: boolean;
|
|
1792
|
+
preview?: RAGSearchTracePrunePreview;
|
|
1793
|
+
error?: string;
|
|
1794
|
+
};
|
|
1795
|
+
export type RAGSearchTracePruneResponse = {
|
|
1796
|
+
ok: boolean;
|
|
1797
|
+
result?: RAGSearchTracePruneResult;
|
|
1798
|
+
stats?: RAGSearchTraceStats;
|
|
1799
|
+
error?: string;
|
|
1800
|
+
};
|
|
1801
|
+
export type RAGSearchTracePruneHistoryResponse = {
|
|
1802
|
+
ok: boolean;
|
|
1803
|
+
runs?: RAGSearchTracePruneRun[];
|
|
1804
|
+
error?: string;
|
|
1805
|
+
};
|
|
1806
|
+
export type RAGDocumentsResponse = {
|
|
1807
|
+
ok: true;
|
|
1808
|
+
documents: RAGIndexedDocument[];
|
|
1809
|
+
lastSeedMsByMode?: Record<string, number>;
|
|
1810
|
+
};
|
|
1811
|
+
export type RAGDocumentChunksResponse = ({
|
|
1812
|
+
ok: true;
|
|
1813
|
+
} & RAGDocumentChunkPreview) | {
|
|
1814
|
+
ok: false;
|
|
1815
|
+
error: string;
|
|
1816
|
+
};
|
|
1817
|
+
export type RAGMutationResponse = {
|
|
1818
|
+
ok: boolean;
|
|
1819
|
+
error?: string;
|
|
1820
|
+
deleted?: string;
|
|
1821
|
+
inserted?: string;
|
|
1822
|
+
reindexed?: string;
|
|
1823
|
+
status?: string;
|
|
1824
|
+
documents?: number;
|
|
1825
|
+
maintenance?: RAGBackendMaintenanceSummary;
|
|
1826
|
+
workflowStatus?: RAGVectorStoreStatus;
|
|
1827
|
+
admin?: RAGAdminCapabilities;
|
|
1828
|
+
adminActions?: RAGAdminActionRecord[];
|
|
1829
|
+
adminJobs?: RAGAdminJobRecord[];
|
|
1830
|
+
backendStats?: Record<string, {
|
|
1831
|
+
chunkCount: number;
|
|
1832
|
+
totalDocuments: number;
|
|
1833
|
+
elapsedMs: number;
|
|
1834
|
+
}>;
|
|
1835
|
+
document?: RAGIndexedDocument;
|
|
1836
|
+
};
|
|
1837
|
+
export type RAGEvaluationCase = {
|
|
1838
|
+
id: string;
|
|
1839
|
+
query: string;
|
|
1840
|
+
corpusKey?: string;
|
|
1841
|
+
topK?: number;
|
|
1842
|
+
model?: string;
|
|
1843
|
+
scoreThreshold?: number;
|
|
1844
|
+
filter?: Record<string, unknown>;
|
|
1845
|
+
retrieval?: RAGCollectionSearchParams['retrieval'];
|
|
1846
|
+
expectedChunkIds?: string[];
|
|
1847
|
+
expectedSources?: string[];
|
|
1848
|
+
expectedDocumentIds?: string[];
|
|
1849
|
+
goldenSet?: boolean;
|
|
1850
|
+
hardNegativeChunkIds?: string[];
|
|
1851
|
+
hardNegativeSources?: string[];
|
|
1852
|
+
hardNegativeDocumentIds?: string[];
|
|
1853
|
+
label?: string;
|
|
1854
|
+
metadata?: Record<string, unknown>;
|
|
1855
|
+
};
|
|
1856
|
+
export type RAGAnswerGroundingEvaluationCase = {
|
|
1857
|
+
id: string;
|
|
1858
|
+
answer: string;
|
|
1859
|
+
sources: RAGSource[];
|
|
1860
|
+
query?: string;
|
|
1861
|
+
label?: string;
|
|
1862
|
+
expectedChunkIds?: string[];
|
|
1863
|
+
expectedSources?: string[];
|
|
1864
|
+
expectedDocumentIds?: string[];
|
|
1865
|
+
metadata?: Record<string, unknown>;
|
|
1866
|
+
};
|
|
1867
|
+
export type RAGAnswerGroundingEvaluationInput = {
|
|
1868
|
+
cases: RAGAnswerGroundingEvaluationCase[];
|
|
1869
|
+
};
|
|
1870
|
+
export type RAGAnswerGroundingEvaluationCaseResult = {
|
|
1871
|
+
caseId: string;
|
|
1872
|
+
answer: string;
|
|
1873
|
+
query?: string;
|
|
1874
|
+
label?: string;
|
|
1875
|
+
status: 'pass' | 'partial' | 'fail';
|
|
1876
|
+
mode: 'chunkId' | 'source' | 'documentId';
|
|
1877
|
+
coverage: RAGGroundedAnswer['coverage'];
|
|
1878
|
+
hasCitations: boolean;
|
|
1879
|
+
citationCount: number;
|
|
1880
|
+
referenceCount: number;
|
|
1881
|
+
resolvedCitationCount: number;
|
|
1882
|
+
unresolvedCitationCount: number;
|
|
1883
|
+
resolvedCitationRate: number;
|
|
1884
|
+
citationPrecision: number;
|
|
1885
|
+
citationRecall: number;
|
|
1886
|
+
citationF1: number;
|
|
1887
|
+
expectedCount: number;
|
|
1888
|
+
matchedCount: number;
|
|
1889
|
+
expectedIds: string[];
|
|
1890
|
+
citedIds: string[];
|
|
1891
|
+
matchedIds: string[];
|
|
1892
|
+
missingIds: string[];
|
|
1893
|
+
extraIds: string[];
|
|
1894
|
+
failureClasses?: Array<'no_expected_targets' | 'no_citations' | 'unresolved_citations' | 'missing_expected_sources' | 'extra_citations' | 'section_source_miss' | 'section_graph_source_miss' | 'section_hierarchy_source_miss' | 'spreadsheet_source_miss' | 'media_source_miss' | 'ocr_source_miss'>;
|
|
1895
|
+
groundedAnswer: RAGGroundedAnswer;
|
|
1896
|
+
metadata?: Record<string, unknown>;
|
|
1897
|
+
};
|
|
1898
|
+
export type RAGAnswerGroundingEvaluationSummary = {
|
|
1899
|
+
totalCases: number;
|
|
1900
|
+
passedCases: number;
|
|
1901
|
+
partialCases: number;
|
|
1902
|
+
failedCases: number;
|
|
1903
|
+
groundedCases: number;
|
|
1904
|
+
partiallyGroundedCases: number;
|
|
1905
|
+
ungroundedCases: number;
|
|
1906
|
+
averageResolvedCitationRate: number;
|
|
1907
|
+
averageCitationPrecision: number;
|
|
1908
|
+
averageCitationRecall: number;
|
|
1909
|
+
averageCitationF1: number;
|
|
1910
|
+
};
|
|
1911
|
+
export type RAGAnswerGroundingEvaluationResponse = {
|
|
1912
|
+
ok: true;
|
|
1913
|
+
cases: RAGAnswerGroundingEvaluationCaseResult[];
|
|
1914
|
+
summary: RAGAnswerGroundingEvaluationSummary;
|
|
1915
|
+
totalCases: number;
|
|
1916
|
+
passingRate: number;
|
|
1917
|
+
};
|
|
1918
|
+
export type RAGAnswerGroundingEvaluationRun = {
|
|
1919
|
+
id: string;
|
|
1920
|
+
suiteId: string;
|
|
1921
|
+
label: string;
|
|
1922
|
+
startedAt: number;
|
|
1923
|
+
finishedAt: number;
|
|
1924
|
+
elapsedMs: number;
|
|
1925
|
+
response: RAGAnswerGroundingEvaluationResponse;
|
|
1926
|
+
metadata?: Record<string, unknown>;
|
|
1927
|
+
};
|
|
1928
|
+
export type RAGAnswerGroundingEvaluationHistoryStore = {
|
|
1929
|
+
saveRun: (run: RAGAnswerGroundingEvaluationRun) => Promise<void> | void;
|
|
1930
|
+
listRuns: (input?: {
|
|
1931
|
+
suiteId?: string;
|
|
1932
|
+
limit?: number;
|
|
1933
|
+
}) => Promise<RAGAnswerGroundingEvaluationRun[]> | RAGAnswerGroundingEvaluationRun[];
|
|
1934
|
+
pruneRuns?: (input?: RAGEvaluationHistoryPruneInput) => Promise<RAGEvaluationHistoryPruneResult> | RAGEvaluationHistoryPruneResult;
|
|
1935
|
+
};
|
|
1936
|
+
export type RAGAnswerGroundingEvaluationLeaderboardEntry = {
|
|
1937
|
+
runId: string;
|
|
1938
|
+
suiteId: string;
|
|
1939
|
+
label: string;
|
|
1940
|
+
passingRate: number;
|
|
1941
|
+
averageCitationF1: number;
|
|
1942
|
+
averageResolvedCitationRate: number;
|
|
1943
|
+
rank: number;
|
|
1944
|
+
totalCases: number;
|
|
1945
|
+
};
|
|
1946
|
+
export type RAGAnswerGroundingEvaluationCaseDifficultyEntry = {
|
|
1947
|
+
caseId: string;
|
|
1948
|
+
label?: string;
|
|
1949
|
+
query?: string;
|
|
1950
|
+
passRate: number;
|
|
1951
|
+
partialRate: number;
|
|
1952
|
+
failRate: number;
|
|
1953
|
+
groundedRate: number;
|
|
1954
|
+
averageCitationF1: number;
|
|
1955
|
+
averageResolvedCitationRate: number;
|
|
1956
|
+
rank: number;
|
|
1957
|
+
totalEvaluations: number;
|
|
1958
|
+
};
|
|
1959
|
+
export type RAGAnswerGroundingCaseDifficultyRun = {
|
|
1960
|
+
id: string;
|
|
1961
|
+
suiteId: string;
|
|
1962
|
+
label: string;
|
|
1963
|
+
startedAt: number;
|
|
1964
|
+
finishedAt: number;
|
|
1965
|
+
entries: RAGAnswerGroundingEvaluationCaseDifficultyEntry[];
|
|
1966
|
+
metadata?: Record<string, unknown>;
|
|
1967
|
+
};
|
|
1968
|
+
export type RAGAnswerGroundingCaseDifficultyHistoryStore = {
|
|
1969
|
+
saveRun: (run: RAGAnswerGroundingCaseDifficultyRun) => Promise<void> | void;
|
|
1970
|
+
listRuns: (input?: {
|
|
1971
|
+
suiteId?: string;
|
|
1972
|
+
limit?: number;
|
|
1973
|
+
}) => Promise<RAGAnswerGroundingCaseDifficultyRun[]> | RAGAnswerGroundingCaseDifficultyRun[];
|
|
1974
|
+
};
|
|
1975
|
+
export type RAGAnswerGroundingCaseDifficultyDiffEntry = {
|
|
1976
|
+
caseId: string;
|
|
1977
|
+
label?: string;
|
|
1978
|
+
query?: string;
|
|
1979
|
+
previousRank?: number;
|
|
1980
|
+
currentRank: number;
|
|
1981
|
+
previousPassRate?: number;
|
|
1982
|
+
currentPassRate: number;
|
|
1983
|
+
previousFailRate?: number;
|
|
1984
|
+
currentFailRate: number;
|
|
1985
|
+
previousAverageCitationF1?: number;
|
|
1986
|
+
currentAverageCitationF1: number;
|
|
1987
|
+
};
|
|
1988
|
+
export type RAGAnswerGroundingCaseDifficultyRunDiff = {
|
|
1989
|
+
suiteId: string;
|
|
1990
|
+
currentRunId: string;
|
|
1991
|
+
previousRunId?: string;
|
|
1992
|
+
harderCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
1993
|
+
easierCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
1994
|
+
unchangedCases: RAGAnswerGroundingCaseDifficultyDiffEntry[];
|
|
1995
|
+
};
|
|
1996
|
+
export type RAGAnswerGroundingCaseDifficultyHistory = {
|
|
1997
|
+
suiteId: string;
|
|
1998
|
+
suiteLabel?: string;
|
|
1999
|
+
runs: RAGAnswerGroundingCaseDifficultyRun[];
|
|
2000
|
+
latestRun?: RAGAnswerGroundingCaseDifficultyRun;
|
|
2001
|
+
previousRun?: RAGAnswerGroundingCaseDifficultyRun;
|
|
2002
|
+
diff?: RAGAnswerGroundingCaseDifficultyRunDiff;
|
|
2003
|
+
trends: {
|
|
2004
|
+
hardestCaseIds: string[];
|
|
2005
|
+
easiestCaseIds: string[];
|
|
2006
|
+
mostOftenHarderCaseIds: string[];
|
|
2007
|
+
mostOftenEasierCaseIds: string[];
|
|
2008
|
+
movementCounts: Record<string, {
|
|
2009
|
+
harder: number;
|
|
2010
|
+
easier: number;
|
|
2011
|
+
unchanged: number;
|
|
2012
|
+
}>;
|
|
2013
|
+
};
|
|
2014
|
+
};
|
|
2015
|
+
export type RAGAnswerGroundingEvaluationCaseDiff = {
|
|
2016
|
+
caseId: string;
|
|
2017
|
+
label?: string;
|
|
2018
|
+
query?: string;
|
|
2019
|
+
previousStatus?: RAGAnswerGroundingEvaluationCaseResult['status'];
|
|
2020
|
+
currentStatus: RAGAnswerGroundingEvaluationCaseResult['status'];
|
|
2021
|
+
previousCoverage?: RAGAnswerGroundingEvaluationCaseResult['coverage'];
|
|
2022
|
+
currentCoverage: RAGAnswerGroundingEvaluationCaseResult['coverage'];
|
|
2023
|
+
previousCitationF1?: number;
|
|
2024
|
+
currentCitationF1: number;
|
|
2025
|
+
previousCitedIds: string[];
|
|
2026
|
+
currentCitedIds: string[];
|
|
2027
|
+
previousMatchedIds: string[];
|
|
2028
|
+
currentMatchedIds: string[];
|
|
2029
|
+
previousMissingIds: string[];
|
|
2030
|
+
currentMissingIds: string[];
|
|
2031
|
+
previousExtraIds: string[];
|
|
2032
|
+
currentExtraIds: string[];
|
|
2033
|
+
previousFailureClasses?: NonNullable<RAGAnswerGroundingEvaluationCaseResult['failureClasses']>;
|
|
2034
|
+
currentFailureClasses?: NonNullable<RAGAnswerGroundingEvaluationCaseResult['failureClasses']>;
|
|
2035
|
+
previousReferenceCount?: number;
|
|
2036
|
+
currentReferenceCount: number;
|
|
2037
|
+
previousResolvedCitationCount?: number;
|
|
2038
|
+
currentResolvedCitationCount: number;
|
|
2039
|
+
previousUnresolvedCitationCount?: number;
|
|
2040
|
+
currentUnresolvedCitationCount: number;
|
|
2041
|
+
previousUngroundedReferenceNumbers: number[];
|
|
2042
|
+
currentUngroundedReferenceNumbers: number[];
|
|
2043
|
+
previousAnswer?: string;
|
|
2044
|
+
currentAnswer: string;
|
|
2045
|
+
answerChanged: boolean;
|
|
2046
|
+
};
|
|
2047
|
+
export type RAGAnswerGroundingEvaluationCaseSnapshot = {
|
|
2048
|
+
caseId: string;
|
|
2049
|
+
label?: string;
|
|
2050
|
+
query?: string;
|
|
2051
|
+
status: RAGAnswerGroundingEvaluationCaseResult['status'];
|
|
2052
|
+
coverage: RAGAnswerGroundingEvaluationCaseResult['coverage'];
|
|
2053
|
+
citationF1: number;
|
|
2054
|
+
resolvedCitationRate: number;
|
|
2055
|
+
citationCount: number;
|
|
2056
|
+
referenceCount: number;
|
|
2057
|
+
resolvedCitationCount: number;
|
|
2058
|
+
unresolvedCitationCount: number;
|
|
2059
|
+
citedIds: string[];
|
|
2060
|
+
matchedIds: string[];
|
|
2061
|
+
missingIds: string[];
|
|
2062
|
+
extraIds: string[];
|
|
2063
|
+
failureClasses?: NonNullable<RAGAnswerGroundingEvaluationCaseResult['failureClasses']>;
|
|
2064
|
+
ungroundedReferenceNumbers: number[];
|
|
2065
|
+
answer: string;
|
|
2066
|
+
previousAnswer?: string;
|
|
2067
|
+
answerChange: 'new' | 'changed' | 'unchanged';
|
|
2068
|
+
};
|
|
2069
|
+
export type RAGAnswerGroundingEvaluationRunDiff = {
|
|
2070
|
+
suiteId: string;
|
|
2071
|
+
currentRunId: string;
|
|
2072
|
+
previousRunId?: string;
|
|
2073
|
+
regressedCases: RAGAnswerGroundingEvaluationCaseDiff[];
|
|
2074
|
+
improvedCases: RAGAnswerGroundingEvaluationCaseDiff[];
|
|
2075
|
+
unchangedCases: RAGAnswerGroundingEvaluationCaseDiff[];
|
|
2076
|
+
summaryDelta: {
|
|
2077
|
+
passingRate: number;
|
|
2078
|
+
averageCitationF1: number;
|
|
2079
|
+
averageResolvedCitationRate: number;
|
|
2080
|
+
passedCases: number;
|
|
2081
|
+
failedCases: number;
|
|
2082
|
+
partialCases: number;
|
|
2083
|
+
};
|
|
2084
|
+
};
|
|
2085
|
+
export type RAGAnswerGroundingEvaluationHistory = {
|
|
2086
|
+
suiteId: string;
|
|
2087
|
+
suiteLabel?: string;
|
|
2088
|
+
runs: RAGAnswerGroundingEvaluationRun[];
|
|
2089
|
+
leaderboard: RAGAnswerGroundingEvaluationLeaderboardEntry[];
|
|
2090
|
+
latestRun?: RAGAnswerGroundingEvaluationRun;
|
|
2091
|
+
previousRun?: RAGAnswerGroundingEvaluationRun;
|
|
2092
|
+
caseSnapshots: RAGAnswerGroundingEvaluationCaseSnapshot[];
|
|
2093
|
+
diff?: RAGAnswerGroundingEvaluationRunDiff;
|
|
2094
|
+
};
|
|
2095
|
+
export type RAGAnswerGroundingCaseSnapshotPresentation = {
|
|
2096
|
+
caseId: string;
|
|
2097
|
+
label: string;
|
|
2098
|
+
summary: string;
|
|
2099
|
+
answerChange: RAGAnswerGroundingEvaluationCaseSnapshot['answerChange'];
|
|
2100
|
+
rows: RAGLabelValueRow[];
|
|
2101
|
+
};
|
|
2102
|
+
export type RAGEvaluationInput = {
|
|
2103
|
+
cases: RAGEvaluationCase[];
|
|
2104
|
+
topK?: number;
|
|
2105
|
+
scoreThreshold?: number;
|
|
2106
|
+
model?: string;
|
|
2107
|
+
filter?: Record<string, unknown>;
|
|
2108
|
+
retrieval?: RAGCollectionSearchParams['retrieval'];
|
|
2109
|
+
dryRun?: boolean;
|
|
2110
|
+
};
|
|
2111
|
+
export type RAGEvaluationCaseResult = {
|
|
2112
|
+
caseId: string;
|
|
2113
|
+
corpusKey?: string;
|
|
2114
|
+
query: string;
|
|
2115
|
+
label?: string;
|
|
2116
|
+
status: 'pass' | 'partial' | 'fail';
|
|
2117
|
+
topK: number;
|
|
2118
|
+
elapsedMs: number;
|
|
2119
|
+
retrievedCount: number;
|
|
2120
|
+
expectedCount: number;
|
|
2121
|
+
matchedCount: number;
|
|
2122
|
+
precision: number;
|
|
2123
|
+
recall: number;
|
|
2124
|
+
f1: number;
|
|
2125
|
+
retrievedIds: string[];
|
|
2126
|
+
expectedIds: string[];
|
|
2127
|
+
matchedIds: string[];
|
|
2128
|
+
missingIds: string[];
|
|
2129
|
+
mode: 'chunkId' | 'source' | 'documentId';
|
|
2130
|
+
failureClasses?: Array<'no_expected_targets' | 'no_results' | 'no_match' | 'partial_recall' | 'extra_noise' | 'section_evidence_miss' | 'section_graph_miss' | 'section_hierarchy_miss' | 'spreadsheet_evidence_miss' | 'media_evidence_miss' | 'ocr_evidence_miss' | 'routing_miss'>;
|
|
2131
|
+
metadata?: Record<string, unknown>;
|
|
2132
|
+
};
|
|
2133
|
+
export type RAGEvaluationSummary = {
|
|
2134
|
+
totalCases: number;
|
|
2135
|
+
passedCases: number;
|
|
2136
|
+
partialCases: number;
|
|
2137
|
+
failedCases: number;
|
|
2138
|
+
averagePrecision: number;
|
|
2139
|
+
averageRecall: number;
|
|
2140
|
+
averageF1: number;
|
|
2141
|
+
averageLatencyMs: number;
|
|
2142
|
+
};
|
|
2143
|
+
export type RAGEvaluationResponse = {
|
|
2144
|
+
ok: true;
|
|
2145
|
+
corpusKeys?: string[];
|
|
2146
|
+
cases: RAGEvaluationCaseResult[];
|
|
2147
|
+
summary: RAGEvaluationSummary;
|
|
2148
|
+
elapsedMs: number;
|
|
2149
|
+
totalCases: number;
|
|
2150
|
+
passingRate: number;
|
|
2151
|
+
};
|
|
2152
|
+
export type RAGEvaluationSuite = {
|
|
2153
|
+
id: string;
|
|
2154
|
+
label?: string;
|
|
2155
|
+
description?: string;
|
|
2156
|
+
input: RAGEvaluationInput;
|
|
2157
|
+
metadata?: Record<string, unknown>;
|
|
2158
|
+
};
|
|
2159
|
+
export type RAGEvaluationSuiteDatasetSummary = {
|
|
2160
|
+
suiteId: string;
|
|
2161
|
+
caseCount: number;
|
|
2162
|
+
goldenSetCount: number;
|
|
2163
|
+
hardNegativeCaseCount: number;
|
|
2164
|
+
hardNegativeChunkIdCount: number;
|
|
2165
|
+
hardNegativeSourceCount: number;
|
|
2166
|
+
hardNegativeDocumentIdCount: number;
|
|
2167
|
+
};
|
|
2168
|
+
export type RAGEvaluationSuiteGenerationOptions = {
|
|
2169
|
+
suiteId: string;
|
|
2170
|
+
documents: RAGIndexedDocument[];
|
|
2171
|
+
label?: string;
|
|
2172
|
+
description?: string;
|
|
2173
|
+
maxCases?: number;
|
|
2174
|
+
topK?: number;
|
|
2175
|
+
scoreThreshold?: number;
|
|
2176
|
+
filter?: Record<string, unknown>;
|
|
2177
|
+
retrieval?: RAGCollectionSearchParams['retrieval'];
|
|
2178
|
+
includeGoldenSet?: boolean;
|
|
2179
|
+
hardNegativePerCase?: number;
|
|
2180
|
+
metadata?: Record<string, unknown>;
|
|
2181
|
+
};
|
|
2182
|
+
export type RAGEvaluationSuiteSnapshot = {
|
|
2183
|
+
id: string;
|
|
2184
|
+
suiteId: string;
|
|
2185
|
+
label?: string;
|
|
2186
|
+
description?: string;
|
|
2187
|
+
version: number;
|
|
2188
|
+
createdAt: number;
|
|
2189
|
+
caseCount: number;
|
|
2190
|
+
suite: RAGEvaluationSuite;
|
|
2191
|
+
metadata?: Record<string, unknown>;
|
|
2192
|
+
};
|
|
2193
|
+
export type RAGEvaluationSuiteSnapshotDiff = {
|
|
2194
|
+
suiteId: string;
|
|
2195
|
+
currentSnapshotId: string;
|
|
2196
|
+
previousSnapshotId?: string;
|
|
2197
|
+
addedCaseIds: string[];
|
|
2198
|
+
removedCaseIds: string[];
|
|
2199
|
+
changedCaseIds: string[];
|
|
2200
|
+
unchangedCaseIds: string[];
|
|
2201
|
+
orderChanged: boolean;
|
|
2202
|
+
caseCountDelta: number;
|
|
2203
|
+
};
|
|
2204
|
+
export type RAGEvaluationSuiteSnapshotHistoryStore = {
|
|
2205
|
+
saveSnapshot: (snapshot: RAGEvaluationSuiteSnapshot) => Promise<void> | void;
|
|
2206
|
+
listSnapshots: (input?: {
|
|
2207
|
+
suiteId?: string;
|
|
2208
|
+
limit?: number;
|
|
2209
|
+
}) => Promise<RAGEvaluationSuiteSnapshot[]> | RAGEvaluationSuiteSnapshot[];
|
|
2210
|
+
pruneSnapshots?: (input?: RAGEvaluationHistoryPruneInput) => Promise<RAGEvaluationHistoryPruneResult> | RAGEvaluationHistoryPruneResult;
|
|
2211
|
+
};
|
|
2212
|
+
export type RAGEvaluationSuiteSnapshotHistory = {
|
|
2213
|
+
suiteId: string;
|
|
2214
|
+
suiteLabel?: string;
|
|
2215
|
+
snapshots: RAGEvaluationSuiteSnapshot[];
|
|
2216
|
+
latestSnapshot?: RAGEvaluationSuiteSnapshot;
|
|
2217
|
+
previousSnapshot?: RAGEvaluationSuiteSnapshot;
|
|
2218
|
+
diff?: RAGEvaluationSuiteSnapshotDiff;
|
|
2219
|
+
};
|
|
2220
|
+
export type RAGEvaluationSuiteRun = {
|
|
2221
|
+
id: string;
|
|
2222
|
+
suiteId: string;
|
|
2223
|
+
label: string;
|
|
2224
|
+
startedAt: number;
|
|
2225
|
+
finishedAt: number;
|
|
2226
|
+
elapsedMs: number;
|
|
2227
|
+
response: RAGEvaluationResponse;
|
|
2228
|
+
traceSummary?: RAGRetrievalTraceComparisonSummary;
|
|
2229
|
+
caseTraceSnapshots?: RAGEvaluationCaseTraceSnapshot[];
|
|
2230
|
+
metadata?: Record<string, unknown>;
|
|
2231
|
+
};
|
|
2232
|
+
export type RAGRetrievalTraceSummaryRun = {
|
|
2233
|
+
id: string;
|
|
2234
|
+
label?: string;
|
|
2235
|
+
finishedAt: number;
|
|
2236
|
+
traceSummary?: RAGRetrievalTraceComparisonSummary;
|
|
2237
|
+
};
|
|
2238
|
+
export type RAGEvaluationHistoryStore = {
|
|
2239
|
+
saveRun: (run: RAGEvaluationSuiteRun) => Promise<void> | void;
|
|
2240
|
+
listRuns: (input?: {
|
|
2241
|
+
suiteId?: string;
|
|
2242
|
+
limit?: number;
|
|
2243
|
+
}) => Promise<RAGEvaluationSuiteRun[]> | RAGEvaluationSuiteRun[];
|
|
2244
|
+
pruneRuns?: (input?: RAGEvaluationHistoryPruneInput) => Promise<RAGEvaluationHistoryPruneResult> | RAGEvaluationHistoryPruneResult;
|
|
2245
|
+
};
|
|
2246
|
+
export type RAGEvaluationHistoryPruneInput = {
|
|
2247
|
+
suiteId?: string;
|
|
2248
|
+
maxAgeMs?: number;
|
|
2249
|
+
maxRunsPerSuite?: number;
|
|
2250
|
+
now?: number;
|
|
2251
|
+
};
|
|
2252
|
+
export type RAGEvaluationHistoryPruneResult = {
|
|
2253
|
+
removedCount: number;
|
|
2254
|
+
keptCount: number;
|
|
2255
|
+
};
|
|
2256
|
+
export type RAGEvaluationCaseDiff = {
|
|
2257
|
+
caseId: string;
|
|
2258
|
+
label?: string;
|
|
2259
|
+
query: string;
|
|
2260
|
+
previousStatus?: RAGEvaluationCaseResult['status'];
|
|
2261
|
+
currentStatus: RAGEvaluationCaseResult['status'];
|
|
2262
|
+
previousF1?: number;
|
|
2263
|
+
currentF1: number;
|
|
2264
|
+
previousMatchedIds: string[];
|
|
2265
|
+
currentMatchedIds: string[];
|
|
2266
|
+
previousMissingIds: string[];
|
|
2267
|
+
currentMissingIds: string[];
|
|
2268
|
+
previousFailureClasses?: NonNullable<RAGEvaluationCaseResult['failureClasses']>;
|
|
2269
|
+
currentFailureClasses?: NonNullable<RAGEvaluationCaseResult['failureClasses']>;
|
|
2270
|
+
};
|
|
2271
|
+
export type RAGEvaluationRunDiff = {
|
|
2272
|
+
suiteId: string;
|
|
2273
|
+
currentRunId: string;
|
|
2274
|
+
previousRunId?: string;
|
|
2275
|
+
regressedCases: RAGEvaluationCaseDiff[];
|
|
2276
|
+
improvedCases: RAGEvaluationCaseDiff[];
|
|
2277
|
+
unchangedCases: RAGEvaluationCaseDiff[];
|
|
2278
|
+
traceLeadChanges?: Array<{
|
|
2279
|
+
caseId: string;
|
|
2280
|
+
label?: string;
|
|
2281
|
+
previousLead?: string;
|
|
2282
|
+
currentLead: string;
|
|
2283
|
+
}>;
|
|
2284
|
+
summaryDelta: {
|
|
2285
|
+
passingRate: number;
|
|
2286
|
+
averageF1: number;
|
|
2287
|
+
averageLatencyMs: number;
|
|
2288
|
+
passedCases: number;
|
|
2289
|
+
failedCases: number;
|
|
2290
|
+
partialCases: number;
|
|
2291
|
+
};
|
|
2292
|
+
traceSummaryDelta?: {
|
|
2293
|
+
modesChanged: boolean;
|
|
2294
|
+
sourceBalanceStrategiesChanged: boolean;
|
|
2295
|
+
vectorCases: number;
|
|
2296
|
+
lexicalCases: number;
|
|
2297
|
+
balancedCases: number;
|
|
2298
|
+
roundRobinCases: number;
|
|
2299
|
+
transformedCases: number;
|
|
2300
|
+
variantCases: number;
|
|
2301
|
+
averageFinalCount: number;
|
|
2302
|
+
averageVectorCount: number;
|
|
2303
|
+
averageLexicalCount: number;
|
|
2304
|
+
averageCandidateTopK: number;
|
|
2305
|
+
averageLexicalTopK: number;
|
|
2306
|
+
officeEvidenceReconcileCasesDelta: number;
|
|
2307
|
+
pdfEvidenceReconcileCasesDelta: number;
|
|
2308
|
+
stageCounts: Partial<Record<RAGRetrievalTraceStage, number>>;
|
|
2309
|
+
};
|
|
2310
|
+
};
|
|
2311
|
+
export type RAGEvaluationCaseTraceSnapshot = {
|
|
2312
|
+
caseId: string;
|
|
2313
|
+
corpusKey?: string;
|
|
2314
|
+
label?: string;
|
|
2315
|
+
query: string;
|
|
2316
|
+
status: RAGEvaluationCaseResult['status'];
|
|
2317
|
+
inputFilter?: Record<string, unknown>;
|
|
2318
|
+
previousInputFilter?: Record<string, unknown>;
|
|
2319
|
+
inputRetrieval?: RAGCollectionSearchParams['retrieval'];
|
|
2320
|
+
previousInputRetrieval?: RAGCollectionSearchParams['retrieval'];
|
|
2321
|
+
traceMode?: RAGHybridRetrievalMode;
|
|
2322
|
+
previousTraceMode?: RAGHybridRetrievalMode;
|
|
2323
|
+
sourceBalanceStrategy?: RAGSourceBalanceStrategy;
|
|
2324
|
+
previousSourceBalanceStrategy?: RAGSourceBalanceStrategy;
|
|
2325
|
+
transformedQuery?: string;
|
|
2326
|
+
previousTransformedQuery?: string;
|
|
2327
|
+
variantQueries: string[];
|
|
2328
|
+
previousVariantQueries: string[];
|
|
2329
|
+
finalCount: number;
|
|
2330
|
+
previousFinalCount?: number;
|
|
2331
|
+
vectorCount: number;
|
|
2332
|
+
previousVectorCount?: number;
|
|
2333
|
+
lexicalCount: number;
|
|
2334
|
+
previousLexicalCount?: number;
|
|
2335
|
+
candidateTopK: number;
|
|
2336
|
+
previousCandidateTopK?: number;
|
|
2337
|
+
lexicalTopK: number;
|
|
2338
|
+
previousLexicalTopK?: number;
|
|
2339
|
+
topContextLabel?: string;
|
|
2340
|
+
previousTopContextLabel?: string;
|
|
2341
|
+
topLocatorLabel?: string;
|
|
2342
|
+
previousTopLocatorLabel?: string;
|
|
2343
|
+
leadSpeakerCue?: string;
|
|
2344
|
+
previousLeadSpeakerCue?: string;
|
|
2345
|
+
leadSpeakerAttributionCue?: string;
|
|
2346
|
+
previousLeadSpeakerAttributionCue?: string;
|
|
2347
|
+
leadChannelCue?: string;
|
|
2348
|
+
previousLeadChannelCue?: string;
|
|
2349
|
+
leadChannelAttributionCue?: string;
|
|
2350
|
+
previousLeadChannelAttributionCue?: string;
|
|
2351
|
+
leadContinuityCue?: string;
|
|
2352
|
+
previousLeadContinuityCue?: string;
|
|
2353
|
+
sqliteQueryMode?: 'json_fallback' | 'native_vec0';
|
|
2354
|
+
previousSqliteQueryMode?: 'json_fallback' | 'native_vec0';
|
|
2355
|
+
sqliteQueryPushdownMode?: 'none' | 'partial' | 'full';
|
|
2356
|
+
previousSqliteQueryPushdownMode?: 'none' | 'partial' | 'full';
|
|
2357
|
+
sqliteQueryPushdownApplied?: boolean;
|
|
2358
|
+
previousSqliteQueryPushdownApplied?: boolean;
|
|
2359
|
+
sqliteQueryPushdownClauseCount?: number;
|
|
2360
|
+
previousSqliteQueryPushdownClauseCount?: number;
|
|
2361
|
+
sqliteQueryTotalFilterClauseCount?: number;
|
|
2362
|
+
previousSqliteQueryTotalFilterClauseCount?: number;
|
|
2363
|
+
sqliteQueryJsRemainderClauseCount?: number;
|
|
2364
|
+
previousSqliteQueryJsRemainderClauseCount?: number;
|
|
2365
|
+
sqliteQueryMultiplierUsed?: number;
|
|
2366
|
+
previousSqliteQueryMultiplierUsed?: number;
|
|
2367
|
+
sqliteQueryPlannerProfileUsed?: RAGNativeQueryProfile;
|
|
2368
|
+
previousSqliteQueryPlannerProfileUsed?: RAGNativeQueryProfile;
|
|
2369
|
+
sqliteQueryCandidateLimitUsed?: number;
|
|
2370
|
+
previousSqliteQueryCandidateLimitUsed?: number;
|
|
2371
|
+
sqliteQueryMaxBackfillsUsed?: number;
|
|
2372
|
+
previousSqliteQueryMaxBackfillsUsed?: number;
|
|
2373
|
+
sqliteQueryMinResultsUsed?: number;
|
|
2374
|
+
previousSqliteQueryMinResultsUsed?: number;
|
|
2375
|
+
sqliteQueryFillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
2376
|
+
previousSqliteQueryFillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
2377
|
+
sqliteQueryPushdownCoverageRatio?: number;
|
|
2378
|
+
previousSqliteQueryPushdownCoverageRatio?: number;
|
|
2379
|
+
sqliteQueryJsRemainderRatio?: number;
|
|
2380
|
+
previousSqliteQueryJsRemainderRatio?: number;
|
|
2381
|
+
sqliteQueryFilteredCandidates?: number;
|
|
2382
|
+
previousSqliteQueryFilteredCandidates?: number;
|
|
2383
|
+
sqliteQueryInitialSearchK?: number;
|
|
2384
|
+
previousSqliteQueryInitialSearchK?: number;
|
|
2385
|
+
sqliteQueryFinalSearchK?: number;
|
|
2386
|
+
previousSqliteQueryFinalSearchK?: number;
|
|
2387
|
+
sqliteQuerySearchExpansionRatio?: number;
|
|
2388
|
+
previousSqliteQuerySearchExpansionRatio?: number;
|
|
2389
|
+
sqliteQueryBackfillCount?: number;
|
|
2390
|
+
previousSqliteQueryBackfillCount?: number;
|
|
2391
|
+
sqliteQueryBackfillLimitReached?: boolean;
|
|
2392
|
+
previousSqliteQueryBackfillLimitReached?: boolean;
|
|
2393
|
+
sqliteQueryMinResultsSatisfied?: boolean;
|
|
2394
|
+
previousSqliteQueryMinResultsSatisfied?: boolean;
|
|
2395
|
+
sqliteQueryReturnedCount?: number;
|
|
2396
|
+
previousSqliteQueryReturnedCount?: number;
|
|
2397
|
+
sqliteQueryCandidateYieldRatio?: number;
|
|
2398
|
+
previousSqliteQueryCandidateYieldRatio?: number;
|
|
2399
|
+
sqliteQueryTopKFillRatio?: number;
|
|
2400
|
+
previousSqliteQueryTopKFillRatio?: number;
|
|
2401
|
+
sqliteQueryUnderfilledTopK?: boolean;
|
|
2402
|
+
previousSqliteQueryUnderfilledTopK?: boolean;
|
|
2403
|
+
sqliteQueryCandidateBudgetExhausted?: boolean;
|
|
2404
|
+
previousSqliteQueryCandidateBudgetExhausted?: boolean;
|
|
2405
|
+
sqliteQueryCandidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
2406
|
+
previousSqliteQueryCandidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
2407
|
+
postgresQueryMode?: 'native_pgvector';
|
|
2408
|
+
previousPostgresQueryMode?: 'native_pgvector';
|
|
2409
|
+
postgresQueryPushdownMode?: 'none' | 'partial' | 'full';
|
|
2410
|
+
previousPostgresQueryPushdownMode?: 'none' | 'partial' | 'full';
|
|
2411
|
+
postgresQueryPushdownApplied?: boolean;
|
|
2412
|
+
previousPostgresQueryPushdownApplied?: boolean;
|
|
2413
|
+
postgresQueryPushdownClauseCount?: number;
|
|
2414
|
+
previousPostgresQueryPushdownClauseCount?: number;
|
|
2415
|
+
postgresQueryTotalFilterClauseCount?: number;
|
|
2416
|
+
previousPostgresQueryTotalFilterClauseCount?: number;
|
|
2417
|
+
postgresQueryJsRemainderClauseCount?: number;
|
|
2418
|
+
previousPostgresQueryJsRemainderClauseCount?: number;
|
|
2419
|
+
postgresQueryMultiplierUsed?: number;
|
|
2420
|
+
previousPostgresQueryMultiplierUsed?: number;
|
|
2421
|
+
postgresQueryPlannerProfileUsed?: RAGNativeQueryProfile;
|
|
2422
|
+
previousPostgresQueryPlannerProfileUsed?: RAGNativeQueryProfile;
|
|
2423
|
+
postgresQueryCandidateLimitUsed?: number;
|
|
2424
|
+
previousPostgresQueryCandidateLimitUsed?: number;
|
|
2425
|
+
postgresQueryMaxBackfillsUsed?: number;
|
|
2426
|
+
previousPostgresQueryMaxBackfillsUsed?: number;
|
|
2427
|
+
postgresQueryMinResultsUsed?: number;
|
|
2428
|
+
previousPostgresQueryMinResultsUsed?: number;
|
|
2429
|
+
postgresQueryFillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
2430
|
+
previousPostgresQueryFillPolicyUsed?: 'strict_topk' | 'satisfy_min_results';
|
|
2431
|
+
postgresQueryPushdownCoverageRatio?: number;
|
|
2432
|
+
previousPostgresQueryPushdownCoverageRatio?: number;
|
|
2433
|
+
postgresQueryJsRemainderRatio?: number;
|
|
2434
|
+
previousPostgresQueryJsRemainderRatio?: number;
|
|
2435
|
+
postgresQueryFilteredCandidates?: number;
|
|
2436
|
+
previousPostgresQueryFilteredCandidates?: number;
|
|
2437
|
+
postgresQueryInitialSearchK?: number;
|
|
2438
|
+
previousPostgresQueryInitialSearchK?: number;
|
|
2439
|
+
postgresQueryFinalSearchK?: number;
|
|
2440
|
+
previousPostgresQueryFinalSearchK?: number;
|
|
2441
|
+
postgresQuerySearchExpansionRatio?: number;
|
|
2442
|
+
previousPostgresQuerySearchExpansionRatio?: number;
|
|
2443
|
+
postgresQueryBackfillCount?: number;
|
|
2444
|
+
previousPostgresQueryBackfillCount?: number;
|
|
2445
|
+
postgresQueryBackfillLimitReached?: boolean;
|
|
2446
|
+
previousPostgresQueryBackfillLimitReached?: boolean;
|
|
2447
|
+
postgresQueryMinResultsSatisfied?: boolean;
|
|
2448
|
+
previousPostgresQueryMinResultsSatisfied?: boolean;
|
|
2449
|
+
postgresQueryReturnedCount?: number;
|
|
2450
|
+
previousPostgresQueryReturnedCount?: number;
|
|
2451
|
+
postgresQueryCandidateYieldRatio?: number;
|
|
2452
|
+
previousPostgresQueryCandidateYieldRatio?: number;
|
|
2453
|
+
postgresQueryTopKFillRatio?: number;
|
|
2454
|
+
previousPostgresQueryTopKFillRatio?: number;
|
|
2455
|
+
postgresQueryUnderfilledTopK?: boolean;
|
|
2456
|
+
previousPostgresQueryUnderfilledTopK?: boolean;
|
|
2457
|
+
postgresQueryCandidateBudgetExhausted?: boolean;
|
|
2458
|
+
previousPostgresQueryCandidateBudgetExhausted?: boolean;
|
|
2459
|
+
postgresQueryCandidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
2460
|
+
previousPostgresQueryCandidateCoverage?: 'empty' | 'under_target' | 'target_sized' | 'broad';
|
|
2461
|
+
postgresIndexType?: 'none' | 'hnsw' | 'ivfflat';
|
|
2462
|
+
previousPostgresIndexType?: 'none' | 'hnsw' | 'ivfflat';
|
|
2463
|
+
postgresIndexName?: string;
|
|
2464
|
+
previousPostgresIndexName?: string;
|
|
2465
|
+
postgresIndexPresent?: boolean;
|
|
2466
|
+
previousPostgresIndexPresent?: boolean;
|
|
2467
|
+
postgresEstimatedRowCount?: number;
|
|
2468
|
+
previousPostgresEstimatedRowCount?: number;
|
|
2469
|
+
postgresTableBytes?: number;
|
|
2470
|
+
previousPostgresTableBytes?: number;
|
|
2471
|
+
postgresIndexBytes?: number;
|
|
2472
|
+
previousPostgresIndexBytes?: number;
|
|
2473
|
+
postgresTotalBytes?: number;
|
|
2474
|
+
previousPostgresTotalBytes?: number;
|
|
2475
|
+
postgresIndexStorageRatio?: number;
|
|
2476
|
+
previousPostgresIndexStorageRatio?: number;
|
|
2477
|
+
sourceAwareChunkReasonLabel?: string;
|
|
2478
|
+
previousSourceAwareChunkReasonLabel?: string;
|
|
2479
|
+
sourceAwareUnitScopeLabel?: string;
|
|
2480
|
+
previousSourceAwareUnitScopeLabel?: string;
|
|
2481
|
+
stageCounts: Partial<Record<RAGRetrievalTraceStage, number>>;
|
|
2482
|
+
previousStageCounts: Partial<Record<RAGRetrievalTraceStage, number>>;
|
|
2483
|
+
traceChange: 'new' | 'changed' | 'unchanged';
|
|
2484
|
+
};
|
|
2485
|
+
export type RAGEvaluationHistory = {
|
|
2486
|
+
suiteId: string;
|
|
2487
|
+
suiteLabel?: string;
|
|
2488
|
+
runs: RAGEvaluationSuiteRun[];
|
|
2489
|
+
leaderboard: RAGEvaluationLeaderboardEntry[];
|
|
2490
|
+
retrievalTraceTrend?: RAGRetrievalTraceTrend;
|
|
2491
|
+
caseTraceSnapshots: RAGEvaluationCaseTraceSnapshot[];
|
|
2492
|
+
latestRun?: RAGEvaluationSuiteRun;
|
|
2493
|
+
previousRun?: RAGEvaluationSuiteRun;
|
|
2494
|
+
diff?: RAGEvaluationRunDiff;
|
|
2495
|
+
};
|
|
2496
|
+
export type RAGLabelValueRow = {
|
|
2497
|
+
label: string;
|
|
2498
|
+
value: string;
|
|
2499
|
+
};
|
|
2500
|
+
export type RAGRetrievalTraceStepPresentation = {
|
|
2501
|
+
stage: RAGRetrievalTraceStage;
|
|
2502
|
+
label: string;
|
|
2503
|
+
count?: number;
|
|
2504
|
+
rows: RAGLabelValueRow[];
|
|
2505
|
+
};
|
|
2506
|
+
export type RAGRetrievalTracePresentation = {
|
|
2507
|
+
stats: RAGLabelValueRow[];
|
|
2508
|
+
details: RAGLabelValueRow[];
|
|
2509
|
+
steps: RAGRetrievalTraceStepPresentation[];
|
|
2510
|
+
};
|
|
2511
|
+
export type RAGSummarySectionPresentation = {
|
|
2512
|
+
label: string;
|
|
2513
|
+
title: string;
|
|
2514
|
+
summary: string;
|
|
2515
|
+
rows?: RAGLabelValueRow[];
|
|
2516
|
+
tags?: string[];
|
|
2517
|
+
};
|
|
2518
|
+
export type RAGReadinessPresentation = {
|
|
2519
|
+
sections: RAGSummarySectionPresentation[];
|
|
2520
|
+
};
|
|
2521
|
+
export type RAGCorpusHealthPresentation = {
|
|
2522
|
+
sections: RAGSummarySectionPresentation[];
|
|
2523
|
+
};
|
|
2524
|
+
export type RAGSyncOverviewPresentation = {
|
|
2525
|
+
rows: RAGLabelValueRow[];
|
|
2526
|
+
sections: RAGSummarySectionPresentation[];
|
|
2527
|
+
};
|
|
2528
|
+
export type RAGSyncSourceRunPresentation = {
|
|
2529
|
+
label: string;
|
|
2530
|
+
status: string;
|
|
2531
|
+
summary: string;
|
|
2532
|
+
rows?: RAGLabelValueRow[];
|
|
2533
|
+
};
|
|
2534
|
+
export type RAGSyncSourcePresentation = {
|
|
2535
|
+
id: string;
|
|
2536
|
+
label: string;
|
|
2537
|
+
kind: RAGSyncSourceRecord['kind'];
|
|
2538
|
+
status: RAGSyncSourceRecord['status'];
|
|
2539
|
+
summary: string;
|
|
2540
|
+
rows: RAGLabelValueRow[];
|
|
2541
|
+
tags?: string[];
|
|
2542
|
+
extendedSummary?: string;
|
|
2543
|
+
runs?: RAGSyncSourceRunPresentation[];
|
|
2544
|
+
};
|
|
2545
|
+
export type RAGAdminJobPresentation = {
|
|
2546
|
+
id: string;
|
|
2547
|
+
action: RAGAdminJobRecord['action'];
|
|
2548
|
+
status: RAGAdminJobRecord['status'];
|
|
2549
|
+
summary: string;
|
|
2550
|
+
rows: RAGLabelValueRow[];
|
|
2551
|
+
};
|
|
2552
|
+
export type RAGAdminActionPresentation = {
|
|
2553
|
+
id: string;
|
|
2554
|
+
action: RAGAdminActionRecord['action'];
|
|
2555
|
+
status: RAGAdminActionRecord['status'];
|
|
2556
|
+
summary: string;
|
|
2557
|
+
rows: RAGLabelValueRow[];
|
|
2558
|
+
};
|
|
2559
|
+
export type RAGEvaluationCaseTracePresentation = {
|
|
2560
|
+
caseId: string;
|
|
2561
|
+
label: string;
|
|
2562
|
+
summary: string;
|
|
2563
|
+
traceChange: RAGEvaluationCaseTraceSnapshot['traceChange'];
|
|
2564
|
+
rows: RAGLabelValueRow[];
|
|
2565
|
+
};
|
|
2566
|
+
export type RAGEvaluationHistoryPresentation = {
|
|
2567
|
+
summary: string;
|
|
2568
|
+
rows: RAGLabelValueRow[];
|
|
2569
|
+
caseTraces: RAGEvaluationCaseTracePresentation[];
|
|
2570
|
+
};
|
|
2571
|
+
export type RAGEvaluationSuiteSnapshotPresentation = {
|
|
2572
|
+
id: string;
|
|
2573
|
+
label: string;
|
|
2574
|
+
summary: string;
|
|
2575
|
+
version: number;
|
|
2576
|
+
rows: RAGLabelValueRow[];
|
|
2577
|
+
};
|
|
2578
|
+
export type RAGEvaluationSuiteSnapshotHistoryPresentation = {
|
|
2579
|
+
summary: string;
|
|
2580
|
+
rows: RAGLabelValueRow[];
|
|
2581
|
+
snapshots: RAGEvaluationSuiteSnapshotPresentation[];
|
|
2582
|
+
};
|
|
2583
|
+
export type RAGAdaptiveNativePlannerBenchmarkRuntime = {
|
|
2584
|
+
suiteId: string;
|
|
2585
|
+
suiteLabel: string;
|
|
2586
|
+
groupKey?: string;
|
|
2587
|
+
corpusGroupKey?: string;
|
|
2588
|
+
latestFixtureVariant?: string;
|
|
2589
|
+
fixtureVariants?: string[];
|
|
2590
|
+
recommendedGroupKey?: string;
|
|
2591
|
+
recommendedTags?: string[];
|
|
2592
|
+
latestRun?: RAGRetrievalComparisonRun;
|
|
2593
|
+
recentRuns?: RAGRetrievalComparisonRun[];
|
|
2594
|
+
historyPresentation?: RAGRetrievalReleaseGroupHistoryPresentation;
|
|
2595
|
+
snapshotHistory?: RAGEvaluationSuiteSnapshotHistory;
|
|
2596
|
+
snapshotHistoryPresentation?: RAGEvaluationSuiteSnapshotHistoryPresentation;
|
|
2597
|
+
};
|
|
2598
|
+
export type RAGNativeBackendComparisonBenchmarkRuntime = RAGAdaptiveNativePlannerBenchmarkRuntime;
|
|
2599
|
+
export type RAGAdaptiveNativePlannerBenchmarkResponse = {
|
|
2600
|
+
ok: boolean;
|
|
2601
|
+
suite?: RAGEvaluationSuite;
|
|
2602
|
+
comparison?: RAGRetrievalComparison;
|
|
2603
|
+
groupKey?: string;
|
|
2604
|
+
corpusGroupKey?: string;
|
|
2605
|
+
latestFixtureVariant?: string;
|
|
2606
|
+
fixtureVariants?: string[];
|
|
2607
|
+
latestRun?: RAGRetrievalComparisonRun;
|
|
2608
|
+
recentRuns?: RAGRetrievalComparisonRun[];
|
|
2609
|
+
historyPresentation?: RAGRetrievalReleaseGroupHistoryPresentation;
|
|
2610
|
+
snapshotHistory?: RAGEvaluationSuiteSnapshotHistory;
|
|
2611
|
+
snapshotHistoryPresentation?: RAGEvaluationSuiteSnapshotHistoryPresentation;
|
|
2612
|
+
error?: string;
|
|
2613
|
+
};
|
|
2614
|
+
export type RAGNativeBackendComparisonBenchmarkResponse = RAGAdaptiveNativePlannerBenchmarkResponse;
|
|
2615
|
+
export type RAGAdaptiveNativePlannerBenchmarkSnapshotResponse = {
|
|
2616
|
+
ok: boolean;
|
|
2617
|
+
suite?: RAGEvaluationSuite;
|
|
2618
|
+
snapshot?: RAGEvaluationSuiteSnapshot;
|
|
2619
|
+
snapshotHistory?: RAGEvaluationSuiteSnapshotHistory;
|
|
2620
|
+
snapshotHistoryPresentation?: RAGEvaluationSuiteSnapshotHistoryPresentation;
|
|
2621
|
+
error?: string;
|
|
2622
|
+
};
|
|
2623
|
+
export type RAGNativeBackendComparisonBenchmarkSnapshotResponse = RAGAdaptiveNativePlannerBenchmarkSnapshotResponse;
|
|
2624
|
+
export type RAGRetrievalReleaseHistoryRunPresentation = {
|
|
2625
|
+
runId: string;
|
|
2626
|
+
label: string;
|
|
2627
|
+
summary: string;
|
|
2628
|
+
rows: RAGLabelValueRow[];
|
|
2629
|
+
};
|
|
2630
|
+
export type RAGRetrievalReleaseGroupHistoryPresentation = {
|
|
2631
|
+
summary: string;
|
|
2632
|
+
rows: RAGLabelValueRow[];
|
|
2633
|
+
recentRuns: RAGRetrievalReleaseHistoryRunPresentation[];
|
|
2634
|
+
};
|
|
2635
|
+
export type RAGAnswerGroundingHistoryPresentation = {
|
|
2636
|
+
summary: string;
|
|
2637
|
+
rows: RAGLabelValueRow[];
|
|
2638
|
+
caseSnapshots: RAGAnswerGroundingCaseSnapshotPresentation[];
|
|
2639
|
+
};
|
|
2640
|
+
export type RAGEvaluationEntityQualitySummary = {
|
|
2641
|
+
key: string;
|
|
2642
|
+
label: string;
|
|
2643
|
+
entityType: 'source' | 'document';
|
|
2644
|
+
totalCases: number;
|
|
2645
|
+
passedCases: number;
|
|
2646
|
+
partialCases: number;
|
|
2647
|
+
failedCases: number;
|
|
2648
|
+
passingRate: number;
|
|
2649
|
+
averageF1: number;
|
|
2650
|
+
failureCounts: Record<string, number>;
|
|
2651
|
+
caseIds: string[];
|
|
2652
|
+
};
|
|
2653
|
+
export type RAGAnswerGroundingEntityQualitySummary = {
|
|
2654
|
+
key: string;
|
|
2655
|
+
label: string;
|
|
2656
|
+
entityType: 'source' | 'document';
|
|
2657
|
+
totalCases: number;
|
|
2658
|
+
passedCases: number;
|
|
2659
|
+
partialCases: number;
|
|
2660
|
+
failedCases: number;
|
|
2661
|
+
passingRate: number;
|
|
2662
|
+
averageCitationF1: number;
|
|
2663
|
+
averageResolvedCitationRate: number;
|
|
2664
|
+
failureCounts: Record<string, number>;
|
|
2665
|
+
caseIds: string[];
|
|
2666
|
+
};
|
|
2667
|
+
export type RAGEvaluationEntityQualityView = {
|
|
2668
|
+
bySource: RAGEvaluationEntityQualitySummary[];
|
|
2669
|
+
byDocument: RAGEvaluationEntityQualitySummary[];
|
|
2670
|
+
};
|
|
2671
|
+
export type RAGAnswerGroundingEntityQualityView = {
|
|
2672
|
+
bySource: RAGAnswerGroundingEntityQualitySummary[];
|
|
2673
|
+
byDocument: RAGAnswerGroundingEntityQualitySummary[];
|
|
2674
|
+
};
|
|
2675
|
+
export type RAGEntityQualityPresentation = {
|
|
2676
|
+
key: string;
|
|
2677
|
+
label: string;
|
|
2678
|
+
summary: string;
|
|
2679
|
+
rows: RAGLabelValueRow[];
|
|
2680
|
+
};
|
|
2681
|
+
export type RAGEntityQualityViewPresentation = {
|
|
2682
|
+
summary: string;
|
|
2683
|
+
rows: RAGLabelValueRow[];
|
|
2684
|
+
entities: RAGEntityQualityPresentation[];
|
|
2685
|
+
};
|
|
2686
|
+
export type RAGComparisonPresentation = {
|
|
2687
|
+
id: string;
|
|
2688
|
+
label: string;
|
|
2689
|
+
summary: string;
|
|
2690
|
+
traceSummaryRows: RAGLabelValueRow[];
|
|
2691
|
+
diffLabel: string;
|
|
2692
|
+
diffRows: RAGLabelValueRow[];
|
|
2693
|
+
};
|
|
2694
|
+
export type RAGComparisonOverviewPresentation = {
|
|
2695
|
+
winnerLabel: string;
|
|
2696
|
+
summary: string;
|
|
2697
|
+
rows: RAGLabelValueRow[];
|
|
2698
|
+
};
|
|
2699
|
+
export type RAGGroundingProviderPresentation = {
|
|
2700
|
+
id: string;
|
|
2701
|
+
label: string;
|
|
2702
|
+
summary: string;
|
|
2703
|
+
};
|
|
2704
|
+
export type RAGGroundingProviderOverviewPresentation = {
|
|
2705
|
+
winnerLabel: string;
|
|
2706
|
+
summary: string;
|
|
2707
|
+
rows: RAGLabelValueRow[];
|
|
2708
|
+
};
|
|
2709
|
+
export type RAGQualityOverviewPresentation = {
|
|
2710
|
+
rows: RAGLabelValueRow[];
|
|
2711
|
+
};
|
|
2712
|
+
export type RAGGroundingOverviewPresentation = {
|
|
2713
|
+
rows: RAGLabelValueRow[];
|
|
2714
|
+
};
|
|
2715
|
+
export type RAGGroundingProviderCaseComparisonPresentation = {
|
|
2716
|
+
caseId: string;
|
|
2717
|
+
label: string;
|
|
2718
|
+
summary: string;
|
|
2719
|
+
rows: RAGLabelValueRow[];
|
|
2720
|
+
};
|
|
2721
|
+
export type RAGEvaluationLeaderboardEntry = {
|
|
2722
|
+
runId: string;
|
|
2723
|
+
suiteId: string;
|
|
2724
|
+
label: string;
|
|
2725
|
+
passingRate: number;
|
|
2726
|
+
averageF1: number;
|
|
2727
|
+
averageLatencyMs: number;
|
|
2728
|
+
totalCases: number;
|
|
2729
|
+
rank: number;
|
|
2730
|
+
};
|
|
2731
|
+
export type RAGRerankerCandidate = {
|
|
2732
|
+
id: string;
|
|
2733
|
+
label?: string;
|
|
2734
|
+
rerank?: RAGRerankerProviderLike;
|
|
2735
|
+
};
|
|
2736
|
+
export type RAGRetrievalTraceComparisonSummary = {
|
|
2737
|
+
totalCases: number;
|
|
2738
|
+
modes: RAGHybridRetrievalMode[];
|
|
2739
|
+
sourceBalanceStrategies: RAGSourceBalanceStrategy[];
|
|
2740
|
+
vectorCases: number;
|
|
2741
|
+
lexicalCases: number;
|
|
2742
|
+
balancedCases: number;
|
|
2743
|
+
roundRobinCases: number;
|
|
2744
|
+
transformedCases: number;
|
|
2745
|
+
variantCases: number;
|
|
2746
|
+
multiVectorCases: number;
|
|
2747
|
+
multiVectorVectorHitCases: number;
|
|
2748
|
+
multiVectorLexicalHitCases: number;
|
|
2749
|
+
multiVectorCollapsedCases: number;
|
|
2750
|
+
officeEvidenceReconcileCases: number;
|
|
2751
|
+
pdfEvidenceReconcileCases: number;
|
|
2752
|
+
runtimeCandidateBudgetExhaustedCases: number;
|
|
2753
|
+
runtimeUnderfilledTopKCases: number;
|
|
2754
|
+
averageFinalCount: number;
|
|
2755
|
+
averageVectorCount: number;
|
|
2756
|
+
averageLexicalCount: number;
|
|
2757
|
+
averageCandidateTopK: number;
|
|
2758
|
+
averageLexicalTopK: number;
|
|
2759
|
+
stageCounts: Partial<Record<RAGRetrievalTraceStage, number>>;
|
|
2760
|
+
};
|
|
2761
|
+
export type RAGTraceSummaryListDelta<T extends string> = {
|
|
2762
|
+
current: T[];
|
|
2763
|
+
previous: T[];
|
|
2764
|
+
added: T[];
|
|
2765
|
+
removed: T[];
|
|
2766
|
+
};
|
|
2767
|
+
export type RAGTraceSummaryTrendDirection = 'flat' | 'up' | 'down';
|
|
2768
|
+
export type RAGTraceSummaryNumericDelta = {
|
|
2769
|
+
metric: string;
|
|
2770
|
+
current: number;
|
|
2771
|
+
previous: number;
|
|
2772
|
+
delta: number;
|
|
2773
|
+
direction: RAGTraceSummaryTrendDirection;
|
|
2774
|
+
};
|
|
2775
|
+
export type RAGTraceSummaryListTrend<T extends string> = {
|
|
2776
|
+
current: T[];
|
|
2777
|
+
previous: T[];
|
|
2778
|
+
appeared: T[];
|
|
2779
|
+
disappeared: T[];
|
|
2780
|
+
stable: T[];
|
|
2781
|
+
frequency: Record<T, number>;
|
|
2782
|
+
};
|
|
2783
|
+
export type RAGTraceSummaryStageTrend = {
|
|
2784
|
+
netDelta: number;
|
|
2785
|
+
latestDelta: number;
|
|
2786
|
+
stage: RAGRetrievalTraceStage;
|
|
2787
|
+
totalChanges: number;
|
|
2788
|
+
};
|
|
2789
|
+
export type RAGRetrievalTraceHistoryWindow = {
|
|
2790
|
+
current: RAGRetrievalTraceComparisonSummary;
|
|
2791
|
+
currentRunId: string;
|
|
2792
|
+
currentRunLabel?: string;
|
|
2793
|
+
delta?: RAGRetrievalTraceComparisonSummaryDiff;
|
|
2794
|
+
previous: RAGRetrievalTraceComparisonSummary;
|
|
2795
|
+
previousRunId: string;
|
|
2796
|
+
previousRunLabel?: string;
|
|
2797
|
+
};
|
|
2798
|
+
export type RAGRetrievalTraceTrend = {
|
|
2799
|
+
aggregate: RAGTraceSummaryNumericDelta[];
|
|
2800
|
+
latestToPrevious?: RAGRetrievalTraceComparisonSummaryDiff;
|
|
2801
|
+
modeTurnover: RAGTraceSummaryListTrend<RAGHybridRetrievalMode>;
|
|
2802
|
+
runsWithTraceSummary: number;
|
|
2803
|
+
stageChurn: RAGTraceSummaryStageTrend[];
|
|
2804
|
+
sourceBalanceStrategyTurnover: RAGTraceSummaryListTrend<RAGSourceBalanceStrategy>;
|
|
2805
|
+
summaryTrendWindows: RAGRetrievalTraceHistoryWindow[];
|
|
2806
|
+
worstMetric: RAGTraceSummaryNumericDelta | undefined;
|
|
2807
|
+
bestMetric: RAGTraceSummaryNumericDelta | undefined;
|
|
2808
|
+
worstVolatileStage: RAGTraceSummaryStageTrend | undefined;
|
|
2809
|
+
};
|
|
2810
|
+
export type RAGSearchTraceResultSnapshot = {
|
|
2811
|
+
chunkId: string;
|
|
2812
|
+
corpusKey?: string;
|
|
2813
|
+
score: number;
|
|
2814
|
+
source?: string;
|
|
2815
|
+
title?: string;
|
|
2816
|
+
documentId?: string;
|
|
2817
|
+
};
|
|
2818
|
+
export type RAGSearchTraceRecord = {
|
|
2819
|
+
id: string;
|
|
2820
|
+
label: string;
|
|
2821
|
+
query: string;
|
|
2822
|
+
groupKey?: string;
|
|
2823
|
+
tags?: string[];
|
|
2824
|
+
startedAt: number;
|
|
2825
|
+
finishedAt: number;
|
|
2826
|
+
elapsedMs: number;
|
|
2827
|
+
trace: RAGRetrievalTrace;
|
|
2828
|
+
summary: RAGRetrievalTraceComparisonSummary;
|
|
2829
|
+
results: RAGSearchTraceResultSnapshot[];
|
|
2830
|
+
metadata?: Record<string, unknown>;
|
|
2831
|
+
};
|
|
2832
|
+
export type RAGSearchTraceStore = {
|
|
2833
|
+
saveTrace: (trace: RAGSearchTraceRecord) => Promise<void> | void;
|
|
2834
|
+
listTraces: (input?: {
|
|
2835
|
+
query?: string;
|
|
2836
|
+
groupKey?: string;
|
|
2837
|
+
tag?: string;
|
|
2838
|
+
limit?: number;
|
|
2839
|
+
}) => Promise<RAGSearchTraceRecord[]> | RAGSearchTraceRecord[];
|
|
2840
|
+
pruneTraces: (input?: RAGSearchTracePruneInput) => Promise<RAGSearchTracePruneResult> | RAGSearchTracePruneResult;
|
|
2841
|
+
};
|
|
2842
|
+
export type RAGSearchTracePruneInput = {
|
|
2843
|
+
maxAgeMs?: number;
|
|
2844
|
+
maxRecordsPerQuery?: number;
|
|
2845
|
+
maxRecordsPerGroup?: number;
|
|
2846
|
+
now?: number;
|
|
2847
|
+
tag?: string;
|
|
2848
|
+
};
|
|
2849
|
+
export type RAGSearchTracePruneResult = {
|
|
2850
|
+
removedCount: number;
|
|
2851
|
+
keptCount: number;
|
|
2852
|
+
};
|
|
2853
|
+
export type RAGSearchTraceStats = {
|
|
2854
|
+
totalTraces: number;
|
|
2855
|
+
queryCount: number;
|
|
2856
|
+
groupCount: number;
|
|
2857
|
+
tagCounts: Record<string, number>;
|
|
2858
|
+
oldestFinishedAt?: number;
|
|
2859
|
+
newestFinishedAt?: number;
|
|
2860
|
+
};
|
|
2861
|
+
export type RAGSearchTracePrunePreview = {
|
|
2862
|
+
input?: RAGSearchTracePruneInput;
|
|
2863
|
+
statsBefore: RAGSearchTraceStats;
|
|
2864
|
+
statsAfter: RAGSearchTraceStats;
|
|
2865
|
+
result: RAGSearchTracePruneResult;
|
|
2866
|
+
};
|
|
2867
|
+
export type RAGSearchTraceRetentionSchedule = {
|
|
2868
|
+
intervalMs: number;
|
|
2869
|
+
runImmediately?: boolean;
|
|
2870
|
+
};
|
|
2871
|
+
export type RAGSearchTraceRetentionRuntime = {
|
|
2872
|
+
configured: boolean;
|
|
2873
|
+
retention?: RAGSearchTracePruneInput;
|
|
2874
|
+
schedule?: RAGSearchTraceRetentionSchedule;
|
|
2875
|
+
stats?: RAGSearchTraceStats;
|
|
2876
|
+
running?: boolean;
|
|
2877
|
+
totalRuns?: number;
|
|
2878
|
+
lastStartedAt?: number;
|
|
2879
|
+
lastFinishedAt?: number;
|
|
2880
|
+
lastResult?: RAGSearchTracePruneResult;
|
|
2881
|
+
lastError?: string;
|
|
2882
|
+
nextScheduledAt?: number;
|
|
2883
|
+
recentRuns?: RAGSearchTracePruneRun[];
|
|
2884
|
+
};
|
|
2885
|
+
export type RAGSearchTracePruneRun = {
|
|
2886
|
+
id: string;
|
|
2887
|
+
startedAt: number;
|
|
2888
|
+
finishedAt: number;
|
|
2889
|
+
elapsedMs: number;
|
|
2890
|
+
trigger: 'manual' | 'write' | 'schedule';
|
|
2891
|
+
input?: RAGSearchTracePruneInput;
|
|
2892
|
+
result?: RAGSearchTracePruneResult;
|
|
2893
|
+
statsBefore?: RAGSearchTraceStats;
|
|
2894
|
+
statsAfter?: RAGSearchTraceStats;
|
|
2895
|
+
error?: string;
|
|
2896
|
+
};
|
|
2897
|
+
export type RAGSearchTracePruneHistoryStore = {
|
|
2898
|
+
saveRun: (run: RAGSearchTracePruneRun) => Promise<void> | void;
|
|
2899
|
+
listRuns: (input?: {
|
|
2900
|
+
limit?: number;
|
|
2901
|
+
trigger?: RAGSearchTracePruneRun['trigger'];
|
|
2902
|
+
}) => Promise<RAGSearchTracePruneRun[]> | RAGSearchTracePruneRun[];
|
|
2903
|
+
};
|
|
2904
|
+
export type RAGSearchTraceDiff = {
|
|
2905
|
+
currentTraceId: string;
|
|
2906
|
+
previousTraceId?: string;
|
|
2907
|
+
summaryDelta?: RAGRetrievalTraceComparisonSummaryDiff;
|
|
2908
|
+
addedChunkIds: string[];
|
|
2909
|
+
removedChunkIds: string[];
|
|
2910
|
+
retainedChunkIds: string[];
|
|
2911
|
+
topResultChanged: boolean;
|
|
2912
|
+
};
|
|
2913
|
+
export type RAGSearchTraceHistory = {
|
|
2914
|
+
query?: string;
|
|
2915
|
+
groupKey?: string;
|
|
2916
|
+
tag?: string;
|
|
2917
|
+
traces: RAGSearchTraceRecord[];
|
|
2918
|
+
latestTrace?: RAGSearchTraceRecord;
|
|
2919
|
+
previousTrace?: RAGSearchTraceRecord;
|
|
2920
|
+
diff?: RAGSearchTraceDiff;
|
|
2921
|
+
retrievalTraceTrend: RAGRetrievalTraceTrend;
|
|
2922
|
+
};
|
|
2923
|
+
export type RAGSearchTraceGroupHistoryEntry = {
|
|
2924
|
+
groupKey: string;
|
|
2925
|
+
traceCount: number;
|
|
2926
|
+
latestTrace?: RAGSearchTraceRecord;
|
|
2927
|
+
previousTrace?: RAGSearchTraceRecord;
|
|
2928
|
+
diff?: RAGSearchTraceDiff;
|
|
2929
|
+
retrievalTraceTrend: RAGRetrievalTraceTrend;
|
|
2930
|
+
};
|
|
2931
|
+
export type RAGSearchTraceGroupHistory = {
|
|
2932
|
+
groups: RAGSearchTraceGroupHistoryEntry[];
|
|
2933
|
+
tag?: string;
|
|
2934
|
+
};
|
|
2935
|
+
export type RAGTraceSummaryStageCountsDelta = {
|
|
2936
|
+
previous: number;
|
|
2937
|
+
current: number;
|
|
2938
|
+
delta: number;
|
|
2939
|
+
};
|
|
2940
|
+
export type RAGRetrievalTraceComparisonSummaryDiff = {
|
|
2941
|
+
current: RAGRetrievalTraceComparisonSummary;
|
|
2942
|
+
previous: RAGRetrievalTraceComparisonSummary;
|
|
2943
|
+
totalCasesDelta: number;
|
|
2944
|
+
averageFinalCountDelta: number;
|
|
2945
|
+
averageVectorCountDelta: number;
|
|
2946
|
+
averageLexicalCountDelta: number;
|
|
2947
|
+
averageCandidateTopKDelta: number;
|
|
2948
|
+
averageLexicalTopKDelta: number;
|
|
2949
|
+
vectorCasesDelta: number;
|
|
2950
|
+
lexicalCasesDelta: number;
|
|
2951
|
+
balancedCasesDelta: number;
|
|
2952
|
+
roundRobinCasesDelta: number;
|
|
2953
|
+
transformedCasesDelta: number;
|
|
2954
|
+
variantCasesDelta: number;
|
|
2955
|
+
multiVectorCasesDelta: number;
|
|
2956
|
+
multiVectorVectorHitCasesDelta: number;
|
|
2957
|
+
multiVectorLexicalHitCasesDelta: number;
|
|
2958
|
+
multiVectorCollapsedCasesDelta: number;
|
|
2959
|
+
officeEvidenceReconcileCasesDelta: number;
|
|
2960
|
+
pdfEvidenceReconcileCasesDelta: number;
|
|
2961
|
+
runtimeCandidateBudgetExhaustedCasesDelta: number;
|
|
2962
|
+
runtimeUnderfilledTopKCasesDelta: number;
|
|
2963
|
+
modeDelta: RAGTraceSummaryListDelta<RAGHybridRetrievalMode>;
|
|
2964
|
+
sourceBalanceStrategyDelta: RAGTraceSummaryListDelta<RAGSourceBalanceStrategy>;
|
|
2965
|
+
stageCountsDelta: Partial<Record<RAGRetrievalTraceStage, RAGTraceSummaryStageCountsDelta>>;
|
|
2966
|
+
};
|
|
2967
|
+
export type RAGRetrievalCandidate = {
|
|
2968
|
+
id: string;
|
|
2969
|
+
label?: string;
|
|
2970
|
+
retrieval?: RAGCollectionSearchParams['retrieval'];
|
|
2971
|
+
queryTransform?: RAGQueryTransformProviderLike;
|
|
2972
|
+
rerank?: RAGRerankerProviderLike;
|
|
2973
|
+
};
|
|
2974
|
+
export type RAGRerankerComparisonEntry = {
|
|
2975
|
+
rerankerId: string;
|
|
2976
|
+
label: string;
|
|
2977
|
+
providerName?: string;
|
|
2978
|
+
response: RAGEvaluationResponse;
|
|
2979
|
+
traceSummary?: RAGRetrievalTraceComparisonSummary;
|
|
2980
|
+
caseTraceSnapshots?: RAGEvaluationCaseTraceSnapshot[];
|
|
2981
|
+
};
|
|
2982
|
+
export type RAGRerankerComparisonSummary = {
|
|
2983
|
+
bestByPassingRate?: string;
|
|
2984
|
+
bestByAverageF1?: string;
|
|
2985
|
+
fastest?: string;
|
|
2986
|
+
};
|
|
2987
|
+
export type RAGRerankerComparison = {
|
|
2988
|
+
suiteId: string;
|
|
2989
|
+
suiteLabel: string;
|
|
2990
|
+
entries: RAGRerankerComparisonEntry[];
|
|
2991
|
+
summary: RAGRerankerComparisonSummary;
|
|
2992
|
+
leaderboard: RAGEvaluationLeaderboardEntry[];
|
|
2993
|
+
};
|
|
2994
|
+
export type RAGRetrievalComparisonEntry = {
|
|
2995
|
+
retrievalId: string;
|
|
2996
|
+
label: string;
|
|
2997
|
+
retrievalMode: RAGHybridRetrievalMode;
|
|
2998
|
+
response: RAGEvaluationResponse;
|
|
2999
|
+
traceSummary?: RAGRetrievalTraceComparisonSummary;
|
|
3000
|
+
caseTraceSnapshots?: RAGEvaluationCaseTraceSnapshot[];
|
|
3001
|
+
};
|
|
3002
|
+
export type RAGRetrievalComparisonSummary = {
|
|
3003
|
+
bestByPassingRate?: string;
|
|
3004
|
+
bestByAverageF1?: string;
|
|
3005
|
+
fastest?: string;
|
|
3006
|
+
bestByMultivectorCollapsedCases?: string;
|
|
3007
|
+
bestByMultivectorLexicalHitCases?: string;
|
|
3008
|
+
bestByMultivectorVectorHitCases?: string;
|
|
3009
|
+
bestByEvidenceReconcileCases?: string;
|
|
3010
|
+
bestByOfficeEvidenceReconcileCases?: string;
|
|
3011
|
+
bestByPDFEvidenceReconcileCases?: string;
|
|
3012
|
+
bestByLowestRuntimeCandidateBudgetExhaustedCases?: string;
|
|
3013
|
+
bestByLowestRuntimeUnderfilledTopKCases?: string;
|
|
3014
|
+
};
|
|
3015
|
+
export type RAGRetrievalComparison = {
|
|
3016
|
+
suiteId: string;
|
|
3017
|
+
suiteLabel: string;
|
|
3018
|
+
corpusGroupKey?: string;
|
|
3019
|
+
corpusKeys?: string[];
|
|
3020
|
+
entries: RAGRetrievalComparisonEntry[];
|
|
3021
|
+
summary: RAGRetrievalComparisonSummary;
|
|
3022
|
+
leaderboard: RAGEvaluationLeaderboardEntry[];
|
|
3023
|
+
};
|
|
3024
|
+
export type RAGRetrievalComparisonCandidateInput = {
|
|
3025
|
+
id: string;
|
|
3026
|
+
label?: string;
|
|
3027
|
+
retrieval?: RAGCollectionSearchParams['retrieval'];
|
|
3028
|
+
};
|
|
3029
|
+
export type RAGRetrievalComparisonRequest = RAGEvaluationInput & {
|
|
3030
|
+
retrievals: RAGRetrievalComparisonCandidateInput[];
|
|
3031
|
+
suiteId?: string;
|
|
3032
|
+
label?: string;
|
|
3033
|
+
persistRun?: boolean;
|
|
3034
|
+
baselineRetrievalId?: string;
|
|
3035
|
+
candidateRetrievalId?: string;
|
|
3036
|
+
corpusGroupKey?: string;
|
|
3037
|
+
groupKey?: string;
|
|
3038
|
+
tags?: string[];
|
|
3039
|
+
};
|
|
3040
|
+
export type RAGRetrievalComparisonResponse = {
|
|
3041
|
+
ok: boolean;
|
|
3042
|
+
comparison?: RAGRetrievalComparison;
|
|
3043
|
+
error?: string;
|
|
3044
|
+
};
|
|
3045
|
+
export type RAGRetrievalComparisonRun = {
|
|
3046
|
+
id: string;
|
|
3047
|
+
label: string;
|
|
3048
|
+
suiteId: string;
|
|
3049
|
+
suiteLabel: string;
|
|
3050
|
+
corpusGroupKey?: string;
|
|
3051
|
+
corpusKeys?: string[];
|
|
3052
|
+
groupKey?: string;
|
|
3053
|
+
tags?: string[];
|
|
3054
|
+
startedAt: number;
|
|
3055
|
+
finishedAt: number;
|
|
3056
|
+
elapsedMs: number;
|
|
3057
|
+
comparison: RAGRetrievalComparison;
|
|
3058
|
+
decisionSummary?: RAGRetrievalComparisonDecisionSummary;
|
|
3059
|
+
releaseVerdict?: RAGRetrievalReleaseVerdict;
|
|
3060
|
+
};
|
|
3061
|
+
export type RAGRetrievalComparisonDecisionDelta = {
|
|
3062
|
+
passingRateDelta: number;
|
|
3063
|
+
averageF1Delta: number;
|
|
3064
|
+
elapsedMsDelta: number;
|
|
3065
|
+
multiVectorCollapsedCasesDelta?: number;
|
|
3066
|
+
multiVectorLexicalHitCasesDelta?: number;
|
|
3067
|
+
multiVectorVectorHitCasesDelta?: number;
|
|
3068
|
+
evidenceReconcileCasesDelta?: number;
|
|
3069
|
+
officeEvidenceReconcileCasesDelta?: number;
|
|
3070
|
+
pdfEvidenceReconcileCasesDelta?: number;
|
|
3071
|
+
runtimeCandidateBudgetExhaustedCasesDelta?: number;
|
|
3072
|
+
runtimeUnderfilledTopKCasesDelta?: number;
|
|
3073
|
+
};
|
|
3074
|
+
export type RAGRetrievalBaselineGatePolicy = {
|
|
3075
|
+
minPassingRateDelta?: number;
|
|
3076
|
+
minAverageF1Delta?: number;
|
|
3077
|
+
maxElapsedMsDelta?: number;
|
|
3078
|
+
minMultiVectorCollapsedCasesDelta?: number;
|
|
3079
|
+
minMultiVectorLexicalHitCasesDelta?: number;
|
|
3080
|
+
minMultiVectorVectorHitCasesDelta?: number;
|
|
3081
|
+
minEvidenceReconcileCasesDelta?: number;
|
|
3082
|
+
maxRuntimeCandidateBudgetExhaustedCasesDelta?: number;
|
|
3083
|
+
maxRuntimeUnderfilledTopKCasesDelta?: number;
|
|
3084
|
+
severity?: 'warn' | 'fail';
|
|
3085
|
+
};
|
|
3086
|
+
export type RAGRetrievalComparisonGateResult = {
|
|
3087
|
+
status: 'pass' | 'warn' | 'fail';
|
|
3088
|
+
reasons: string[];
|
|
3089
|
+
policy?: RAGRetrievalBaselineGatePolicy;
|
|
3090
|
+
};
|
|
3091
|
+
export type RAGRetrievalReleaseVerdict = {
|
|
3092
|
+
status: 'pass' | 'warn' | 'fail' | 'needs_review';
|
|
3093
|
+
summary: string;
|
|
3094
|
+
baselineGroupKey?: string;
|
|
3095
|
+
baselineRetrievalId?: string;
|
|
3096
|
+
candidateRetrievalId?: string;
|
|
3097
|
+
gate?: RAGRetrievalComparisonGateResult;
|
|
3098
|
+
delta?: RAGRetrievalComparisonDecisionDelta;
|
|
3099
|
+
};
|
|
3100
|
+
export type RAGRetrievalComparisonDecisionSummary = {
|
|
3101
|
+
baselineRetrievalId?: string;
|
|
3102
|
+
candidateRetrievalId?: string;
|
|
3103
|
+
winnerByPassingRate?: string;
|
|
3104
|
+
winnerByAverageF1?: string;
|
|
3105
|
+
fastest?: string;
|
|
3106
|
+
winnerByMultivectorCollapsedCases?: string;
|
|
3107
|
+
winnerByMultivectorLexicalHitCases?: string;
|
|
3108
|
+
winnerByMultivectorVectorHitCases?: string;
|
|
3109
|
+
winnerByEvidenceReconcileCases?: string;
|
|
3110
|
+
winnerByOfficeEvidenceReconcileCases?: string;
|
|
3111
|
+
winnerByPDFEvidenceReconcileCases?: string;
|
|
3112
|
+
winnerByLowestRuntimeCandidateBudgetExhaustedCases?: string;
|
|
3113
|
+
winnerByLowestRuntimeUnderfilledTopKCases?: string;
|
|
3114
|
+
baseline?: {
|
|
3115
|
+
retrievalId: string;
|
|
3116
|
+
label: string;
|
|
3117
|
+
passingRate: number;
|
|
3118
|
+
averageF1: number;
|
|
3119
|
+
elapsedMs: number;
|
|
3120
|
+
multiVectorCollapsedCases?: number;
|
|
3121
|
+
multiVectorLexicalHitCases?: number;
|
|
3122
|
+
multiVectorVectorHitCases?: number;
|
|
3123
|
+
evidenceReconcileCases?: number;
|
|
3124
|
+
officeEvidenceReconcileCases?: number;
|
|
3125
|
+
pdfEvidenceReconcileCases?: number;
|
|
3126
|
+
runtimeCandidateBudgetExhaustedCases?: number;
|
|
3127
|
+
runtimeUnderfilledTopKCases?: number;
|
|
3128
|
+
};
|
|
3129
|
+
candidate?: {
|
|
3130
|
+
retrievalId: string;
|
|
3131
|
+
label: string;
|
|
3132
|
+
passingRate: number;
|
|
3133
|
+
averageF1: number;
|
|
3134
|
+
elapsedMs: number;
|
|
3135
|
+
multiVectorCollapsedCases?: number;
|
|
3136
|
+
multiVectorLexicalHitCases?: number;
|
|
3137
|
+
multiVectorVectorHitCases?: number;
|
|
3138
|
+
evidenceReconcileCases?: number;
|
|
3139
|
+
officeEvidenceReconcileCases?: number;
|
|
3140
|
+
pdfEvidenceReconcileCases?: number;
|
|
3141
|
+
runtimeCandidateBudgetExhaustedCases?: number;
|
|
3142
|
+
runtimeUnderfilledTopKCases?: number;
|
|
3143
|
+
};
|
|
3144
|
+
delta?: RAGRetrievalComparisonDecisionDelta;
|
|
3145
|
+
gate?: RAGRetrievalComparisonGateResult;
|
|
3146
|
+
};
|
|
3147
|
+
export type RAGRetrievalComparisonHistoryStore = {
|
|
3148
|
+
saveRun: (run: RAGRetrievalComparisonRun) => Promise<void> | void;
|
|
3149
|
+
listRuns: (input?: {
|
|
3150
|
+
limit?: number;
|
|
3151
|
+
suiteId?: string;
|
|
3152
|
+
label?: string;
|
|
3153
|
+
winnerId?: string;
|
|
3154
|
+
corpusGroupKey?: string;
|
|
3155
|
+
groupKey?: string;
|
|
3156
|
+
tag?: string;
|
|
3157
|
+
}) => Promise<RAGRetrievalComparisonRun[]> | RAGRetrievalComparisonRun[];
|
|
3158
|
+
};
|
|
3159
|
+
export type RAGRetrievalComparisonHistoryResponse = {
|
|
3160
|
+
ok: boolean;
|
|
3161
|
+
runs?: RAGRetrievalComparisonRun[];
|
|
3162
|
+
error?: string;
|
|
3163
|
+
};
|
|
3164
|
+
export type RAGRetrievalBaselineRecord = {
|
|
3165
|
+
id: string;
|
|
3166
|
+
corpusGroupKey?: string;
|
|
3167
|
+
groupKey: string;
|
|
3168
|
+
version: number;
|
|
3169
|
+
status: 'active' | 'superseded';
|
|
3170
|
+
rolloutLabel?: 'canary' | 'stable' | 'rollback_target';
|
|
3171
|
+
retrievalId: string;
|
|
3172
|
+
label: string;
|
|
3173
|
+
suiteId?: string;
|
|
3174
|
+
suiteLabel?: string;
|
|
3175
|
+
sourceRunId?: string;
|
|
3176
|
+
promotedAt: number;
|
|
3177
|
+
tags?: string[];
|
|
3178
|
+
approvedBy?: string;
|
|
3179
|
+
approvedAt?: number;
|
|
3180
|
+
approvalNotes?: string;
|
|
3181
|
+
policy?: RAGRetrievalBaselineGatePolicy;
|
|
3182
|
+
metadata?: Record<string, unknown>;
|
|
3183
|
+
};
|
|
3184
|
+
export type RAGRetrievalBaselineStore = {
|
|
3185
|
+
saveBaseline: (record: RAGRetrievalBaselineRecord) => Promise<void> | void;
|
|
3186
|
+
listBaselines: (input?: {
|
|
3187
|
+
corpusGroupKey?: string;
|
|
3188
|
+
groupKey?: string;
|
|
3189
|
+
tag?: string;
|
|
3190
|
+
limit?: number;
|
|
3191
|
+
status?: RAGRetrievalBaselineRecord['status'];
|
|
3192
|
+
}) => Promise<RAGRetrievalBaselineRecord[]> | RAGRetrievalBaselineRecord[];
|
|
3193
|
+
getBaseline?: (groupKey: string) => Promise<RAGRetrievalBaselineRecord | null | undefined> | RAGRetrievalBaselineRecord | null | undefined;
|
|
3194
|
+
};
|
|
3195
|
+
export type RAGRetrievalBaselinePromotionRequest = {
|
|
3196
|
+
corpusGroupKey?: string;
|
|
3197
|
+
groupKey: string;
|
|
3198
|
+
retrievalId: string;
|
|
3199
|
+
rolloutLabel?: 'canary' | 'stable' | 'rollback_target';
|
|
3200
|
+
label?: string;
|
|
3201
|
+
suiteId?: string;
|
|
3202
|
+
suiteLabel?: string;
|
|
3203
|
+
sourceRunId?: string;
|
|
3204
|
+
tags?: string[];
|
|
3205
|
+
approvedBy?: string;
|
|
3206
|
+
approvedAt?: number;
|
|
3207
|
+
approvalNotes?: string;
|
|
3208
|
+
policy?: RAGRetrievalBaselineGatePolicy;
|
|
3209
|
+
metadata?: Record<string, unknown>;
|
|
3210
|
+
};
|
|
3211
|
+
export type RAGRetrievalBaselinePromotionFromRunRequest = {
|
|
3212
|
+
corpusGroupKey?: string;
|
|
3213
|
+
groupKey: string;
|
|
3214
|
+
sourceRunId: string;
|
|
3215
|
+
retrievalId?: string;
|
|
3216
|
+
rolloutLabel?: 'canary' | 'stable' | 'rollback_target';
|
|
3217
|
+
overrideGate?: boolean;
|
|
3218
|
+
overrideReason?: string;
|
|
3219
|
+
approvedBy?: string;
|
|
3220
|
+
approvedAt?: number;
|
|
3221
|
+
approvalNotes?: string;
|
|
3222
|
+
policy?: RAGRetrievalBaselineGatePolicy;
|
|
3223
|
+
metadata?: Record<string, unknown>;
|
|
3224
|
+
};
|
|
3225
|
+
export type RAGRetrievalBaselineRevertRequest = {
|
|
3226
|
+
corpusGroupKey?: string;
|
|
3227
|
+
groupKey: string;
|
|
3228
|
+
version?: number;
|
|
3229
|
+
baselineId?: string;
|
|
3230
|
+
approvedBy?: string;
|
|
3231
|
+
approvedAt?: number;
|
|
3232
|
+
approvalNotes?: string;
|
|
3233
|
+
metadata?: Record<string, unknown>;
|
|
3234
|
+
};
|
|
3235
|
+
export type RAGRetrievalBaselineResponse = {
|
|
3236
|
+
ok: boolean;
|
|
3237
|
+
baseline?: RAGRetrievalBaselineRecord;
|
|
3238
|
+
rolloutState?: RAGRetrievalLanePromotionStateSummary;
|
|
3239
|
+
error?: string;
|
|
3240
|
+
};
|
|
3241
|
+
export type RAGRetrievalBaselineListResponse = {
|
|
3242
|
+
ok: boolean;
|
|
3243
|
+
baselines?: RAGRetrievalBaselineRecord[];
|
|
3244
|
+
error?: string;
|
|
3245
|
+
};
|
|
3246
|
+
export type RAGRetrievalReleaseDecisionRecord = {
|
|
3247
|
+
id: string;
|
|
3248
|
+
kind: 'approve' | 'promote' | 'reject' | 'revert';
|
|
3249
|
+
corpusGroupKey?: string;
|
|
3250
|
+
groupKey: string;
|
|
3251
|
+
targetRolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3252
|
+
baselineId?: string;
|
|
3253
|
+
retrievalId: string;
|
|
3254
|
+
version?: number;
|
|
3255
|
+
decidedAt: number;
|
|
3256
|
+
decidedBy?: string;
|
|
3257
|
+
notes?: string;
|
|
3258
|
+
sourceRunId?: string;
|
|
3259
|
+
restoredFromBaselineId?: string;
|
|
3260
|
+
restoredFromVersion?: number;
|
|
3261
|
+
gateStatus?: RAGRetrievalComparisonGateResult['status'];
|
|
3262
|
+
overrideGate?: boolean;
|
|
3263
|
+
overrideReason?: string;
|
|
3264
|
+
freshnessStatus?: 'fresh' | 'expired' | 'not_applicable';
|
|
3265
|
+
expiresAt?: number;
|
|
3266
|
+
ageMs?: number;
|
|
3267
|
+
};
|
|
3268
|
+
export type RAGRetrievalPromotionReadiness = {
|
|
3269
|
+
ready: boolean;
|
|
3270
|
+
reasons: string[];
|
|
3271
|
+
targetRolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3272
|
+
sourceRunId?: string;
|
|
3273
|
+
baselineRetrievalId?: string;
|
|
3274
|
+
candidateRetrievalId?: string;
|
|
3275
|
+
gateStatus?: RAGRetrievalComparisonGateResult['status'];
|
|
3276
|
+
requiresApproval?: boolean;
|
|
3277
|
+
requiresOverride?: boolean;
|
|
3278
|
+
effectiveReleasePolicy?: RAGRetrievalReleasePolicy;
|
|
3279
|
+
effectiveBaselineGatePolicy?: RAGRetrievalBaselineGatePolicy;
|
|
3280
|
+
};
|
|
3281
|
+
export type RAGRetrievalPromotionCandidate = {
|
|
3282
|
+
sourceRunId: string;
|
|
3283
|
+
groupKey?: string;
|
|
3284
|
+
label: string;
|
|
3285
|
+
suiteId: string;
|
|
3286
|
+
suiteLabel: string;
|
|
3287
|
+
finishedAt: number;
|
|
3288
|
+
targetRolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3289
|
+
candidateRetrievalId?: string;
|
|
3290
|
+
baselineRetrievalId?: string;
|
|
3291
|
+
gateStatus?: RAGRetrievalComparisonGateResult['status'];
|
|
3292
|
+
reviewStatus: 'approved' | 'blocked' | 'needs_review' | 'ready';
|
|
3293
|
+
priority: 'ready_now' | 'needs_review' | 'gate_warn' | 'gate_fail' | 'blocked';
|
|
3294
|
+
priorityScore: number;
|
|
3295
|
+
sortReason: string;
|
|
3296
|
+
ready: boolean;
|
|
3297
|
+
reasons: string[];
|
|
3298
|
+
requiresApproval: boolean;
|
|
3299
|
+
approved: boolean;
|
|
3300
|
+
approvedAt?: number;
|
|
3301
|
+
approvedBy?: string;
|
|
3302
|
+
approvalFreshnessStatus?: 'fresh' | 'expired' | 'not_applicable';
|
|
3303
|
+
approvalExpiresAt?: number;
|
|
3304
|
+
approvalAgeMs?: number;
|
|
3305
|
+
effectiveReleasePolicy?: RAGRetrievalReleasePolicy;
|
|
3306
|
+
effectiveBaselineGatePolicy?: RAGRetrievalBaselineGatePolicy;
|
|
3307
|
+
delta?: RAGRetrievalComparisonDecisionDelta;
|
|
3308
|
+
releaseVerdictStatus?: RAGRetrievalReleaseVerdict['status'];
|
|
3309
|
+
tags?: string[];
|
|
3310
|
+
};
|
|
3311
|
+
export type RAGRetrievalReleasePolicy = {
|
|
3312
|
+
requireApprovalBeforePromotion?: boolean;
|
|
3313
|
+
approvalMaxAgeMs?: number;
|
|
3314
|
+
};
|
|
3315
|
+
export type RAGRetrievalReleaseLanePolicySummary = RAGRetrievalReleasePolicy & {
|
|
3316
|
+
groupKey?: string;
|
|
3317
|
+
rolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3318
|
+
scope: 'rollout_label' | 'group_rollout_label';
|
|
3319
|
+
};
|
|
3320
|
+
export type RAGRetrievalReleaseLanePolicyHistoryRecord = {
|
|
3321
|
+
id: string;
|
|
3322
|
+
corpusGroupKey?: string;
|
|
3323
|
+
groupKey?: string;
|
|
3324
|
+
rolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3325
|
+
scope: 'rollout_label' | 'group_rollout_label';
|
|
3326
|
+
requireApprovalBeforePromotion?: boolean;
|
|
3327
|
+
approvalMaxAgeMs?: number;
|
|
3328
|
+
recordedAt: number;
|
|
3329
|
+
changeKind: 'snapshot' | 'changed';
|
|
3330
|
+
previousRequireApprovalBeforePromotion?: boolean;
|
|
3331
|
+
previousApprovalMaxAgeMs?: number;
|
|
3332
|
+
};
|
|
3333
|
+
export type RAGRetrievalReleaseLanePolicyHistoryStore = {
|
|
3334
|
+
saveRecord: (record: RAGRetrievalReleaseLanePolicyHistoryRecord) => Promise<void> | void;
|
|
3335
|
+
listRecords: (input?: {
|
|
3336
|
+
corpusGroupKey?: string;
|
|
3337
|
+
groupKey?: string;
|
|
3338
|
+
limit?: number;
|
|
3339
|
+
rolloutLabel?: RAGRetrievalReleaseLanePolicyHistoryRecord['rolloutLabel'];
|
|
3340
|
+
scope?: RAGRetrievalReleaseLanePolicyHistoryRecord['scope'];
|
|
3341
|
+
}) => Promise<RAGRetrievalReleaseLanePolicyHistoryRecord[]> | RAGRetrievalReleaseLanePolicyHistoryRecord[];
|
|
3342
|
+
};
|
|
3343
|
+
export type RAGRetrievalReleaseLanePolicyHistoryResponse = {
|
|
3344
|
+
ok: boolean;
|
|
3345
|
+
records?: RAGRetrievalReleaseLanePolicyHistoryRecord[];
|
|
3346
|
+
error?: string;
|
|
3347
|
+
};
|
|
3348
|
+
export type RAGRetrievalBaselineGatePolicySummary = {
|
|
3349
|
+
groupKey?: string;
|
|
3350
|
+
rolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3351
|
+
scope: 'rollout_label' | 'group_rollout_label';
|
|
3352
|
+
policy: RAGRetrievalBaselineGatePolicy;
|
|
3353
|
+
};
|
|
3354
|
+
export type RAGRetrievalBaselineGatePolicyHistoryRecord = {
|
|
3355
|
+
id: string;
|
|
3356
|
+
corpusGroupKey?: string;
|
|
3357
|
+
groupKey?: string;
|
|
3358
|
+
rolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3359
|
+
scope: 'rollout_label' | 'group_rollout_label';
|
|
3360
|
+
policy: RAGRetrievalBaselineGatePolicy;
|
|
3361
|
+
recordedAt: number;
|
|
3362
|
+
changeKind: 'snapshot' | 'changed';
|
|
3363
|
+
previousPolicy?: RAGRetrievalBaselineGatePolicy;
|
|
3364
|
+
};
|
|
3365
|
+
export type RAGRetrievalBaselineGatePolicyHistoryStore = {
|
|
3366
|
+
saveRecord: (record: RAGRetrievalBaselineGatePolicyHistoryRecord) => Promise<void> | void;
|
|
3367
|
+
listRecords: (input?: {
|
|
3368
|
+
corpusGroupKey?: string;
|
|
3369
|
+
groupKey?: string;
|
|
3370
|
+
limit?: number;
|
|
3371
|
+
rolloutLabel?: RAGRetrievalBaselineGatePolicyHistoryRecord['rolloutLabel'];
|
|
3372
|
+
scope?: RAGRetrievalBaselineGatePolicyHistoryRecord['scope'];
|
|
3373
|
+
}) => Promise<RAGRetrievalBaselineGatePolicyHistoryRecord[]> | RAGRetrievalBaselineGatePolicyHistoryRecord[];
|
|
3374
|
+
};
|
|
3375
|
+
export type RAGRetrievalBaselineGatePolicyHistoryResponse = {
|
|
3376
|
+
ok: boolean;
|
|
3377
|
+
records?: RAGRetrievalBaselineGatePolicyHistoryRecord[];
|
|
3378
|
+
error?: string;
|
|
3379
|
+
};
|
|
3380
|
+
export type RAGRetrievalReleaseIncidentSummary = {
|
|
3381
|
+
openCount: number;
|
|
3382
|
+
resolvedCount: number;
|
|
3383
|
+
acknowledgedOpenCount: number;
|
|
3384
|
+
unacknowledgedOpenCount: number;
|
|
3385
|
+
latestAcknowledgedAt?: number;
|
|
3386
|
+
};
|
|
3387
|
+
export type RAGRetrievalIncidentRemediationDecisionRecord = {
|
|
3388
|
+
id: string;
|
|
3389
|
+
incidentId: string;
|
|
3390
|
+
idempotencyKey?: string;
|
|
3391
|
+
groupKey: string;
|
|
3392
|
+
targetRolloutLabel?: RAGRetrievalReleaseIncidentRecord['targetRolloutLabel'];
|
|
3393
|
+
incidentKind?: RAGRetrievalReleaseIncidentRecord['kind'];
|
|
3394
|
+
remediationKind: RAGRemediationStep['kind'];
|
|
3395
|
+
status: 'planned' | 'applied' | 'dismissed';
|
|
3396
|
+
decidedAt: number;
|
|
3397
|
+
decidedBy?: string;
|
|
3398
|
+
notes?: string;
|
|
3399
|
+
action?: RAGRemediationAction;
|
|
3400
|
+
};
|
|
3401
|
+
export type RAGRetrievalIncidentRemediationDecisionRequest = {
|
|
3402
|
+
incidentId: string;
|
|
3403
|
+
remediationKind: RAGRemediationStep['kind'];
|
|
3404
|
+
status?: RAGRetrievalIncidentRemediationDecisionRecord['status'];
|
|
3405
|
+
decidedAt?: number;
|
|
3406
|
+
decidedBy?: string;
|
|
3407
|
+
notes?: string;
|
|
3408
|
+
action?: RAGRemediationAction;
|
|
3409
|
+
};
|
|
3410
|
+
export type RAGRetrievalIncidentRemediationDecisionStore = {
|
|
3411
|
+
saveRecord: (record: RAGRetrievalIncidentRemediationDecisionRecord) => Promise<void> | void;
|
|
3412
|
+
listRecords: (input?: {
|
|
3413
|
+
corpusGroupKey?: string;
|
|
3414
|
+
groupKey?: string;
|
|
3415
|
+
incidentId?: string;
|
|
3416
|
+
limit?: number;
|
|
3417
|
+
remediationKind?: RAGRetrievalIncidentRemediationDecisionRecord['remediationKind'];
|
|
3418
|
+
status?: RAGRetrievalIncidentRemediationDecisionRecord['status'];
|
|
3419
|
+
targetRolloutLabel?: RAGRetrievalIncidentRemediationDecisionRecord['targetRolloutLabel'];
|
|
3420
|
+
}) => Promise<RAGRetrievalIncidentRemediationDecisionRecord[]> | RAGRetrievalIncidentRemediationDecisionRecord[];
|
|
3421
|
+
};
|
|
3422
|
+
export type RAGRetrievalIncidentRemediationDecisionListResponse = {
|
|
3423
|
+
ok: boolean;
|
|
3424
|
+
records?: RAGRetrievalIncidentRemediationDecisionRecord[];
|
|
3425
|
+
error?: string;
|
|
3426
|
+
};
|
|
3427
|
+
export type RAGRetrievalIncidentRemediationExecutionRequest = {
|
|
3428
|
+
incidentId?: string;
|
|
3429
|
+
idempotencyKey?: string;
|
|
3430
|
+
remediationKind?: RAGRemediationStep['kind'];
|
|
3431
|
+
decidedAt?: number;
|
|
3432
|
+
decidedBy?: string;
|
|
3433
|
+
notes?: string;
|
|
3434
|
+
persistDecision?: boolean;
|
|
3435
|
+
action: RAGRemediationAction;
|
|
3436
|
+
};
|
|
3437
|
+
export type RAGRetrievalIncidentRemediationExecutionCode = 'approval_recorded' | 'incident_acknowledged' | 'incident_resolved' | 'release_status_loaded' | 'release_drift_loaded' | 'handoff_status_loaded' | 'guardrail_blocked' | 'idempotent_replay';
|
|
3438
|
+
export type RAGRetrievalIncidentRemediationExecutionResult = {
|
|
3439
|
+
action: RAGRemediationAction;
|
|
3440
|
+
code: RAGRetrievalIncidentRemediationExecutionCode;
|
|
3441
|
+
idempotentReplay?: boolean;
|
|
3442
|
+
incidents?: RAGRetrievalReleaseIncidentRecord[];
|
|
3443
|
+
decisions?: RAGRetrievalReleaseDecisionRecord[];
|
|
3444
|
+
releaseStatus?: RAGRetrievalComparisonRuntime;
|
|
3445
|
+
releaseIncidentStatus?: RAGRetrievalReleaseIncidentStatusResponse;
|
|
3446
|
+
releaseDriftStatus?: RAGRetrievalReleaseDriftStatusResponse;
|
|
3447
|
+
handoffStatus?: RAGRetrievalLaneHandoffStatusResponse;
|
|
3448
|
+
followUpSteps?: RAGRemediationStep[];
|
|
3449
|
+
};
|
|
3450
|
+
export type RAGRetrievalIncidentRemediationExecutionResponse = {
|
|
3451
|
+
ok: boolean;
|
|
3452
|
+
execution?: RAGRetrievalIncidentRemediationExecutionResult;
|
|
3453
|
+
record?: RAGRetrievalIncidentRemediationDecisionRecord;
|
|
3454
|
+
error?: string;
|
|
3455
|
+
};
|
|
3456
|
+
export type RAGRetrievalIncidentRemediationExecutionHistoryRecord = {
|
|
3457
|
+
id: string;
|
|
3458
|
+
executedAt: number;
|
|
3459
|
+
groupKey?: string;
|
|
3460
|
+
incidentId?: string;
|
|
3461
|
+
incidentKind?: RAGRetrievalReleaseIncidentRecord['kind'];
|
|
3462
|
+
targetRolloutLabel?: RAGRetrievalReleaseIncidentRecord['targetRolloutLabel'];
|
|
3463
|
+
remediationKind?: RAGRemediationStep['kind'];
|
|
3464
|
+
action: RAGRemediationAction;
|
|
3465
|
+
code: RAGRetrievalIncidentRemediationExecutionCode;
|
|
3466
|
+
ok: boolean;
|
|
3467
|
+
error?: string;
|
|
3468
|
+
idempotencyKey?: string;
|
|
3469
|
+
idempotentReplay?: boolean;
|
|
3470
|
+
mutationSkipped?: boolean;
|
|
3471
|
+
blockedByGuardrail?: boolean;
|
|
3472
|
+
guardrailKind?: 'bulk_mutation_opt_in_required' | 'bulk_missing_idempotency_key';
|
|
3473
|
+
bulkExecutionId?: string;
|
|
3474
|
+
bulkIndex?: number;
|
|
3475
|
+
};
|
|
3476
|
+
export type RAGRetrievalIncidentRemediationExecutionHistoryStore = {
|
|
3477
|
+
saveRecord: (record: RAGRetrievalIncidentRemediationExecutionHistoryRecord) => Promise<void> | void;
|
|
3478
|
+
listRecords: (input?: {
|
|
3479
|
+
groupKey?: string;
|
|
3480
|
+
incidentId?: string;
|
|
3481
|
+
limit?: number;
|
|
3482
|
+
actionKind?: RAGRemediationAction['kind'];
|
|
3483
|
+
code?: RAGRetrievalIncidentRemediationExecutionCode;
|
|
3484
|
+
blockedByGuardrail?: boolean;
|
|
3485
|
+
idempotentReplay?: boolean;
|
|
3486
|
+
targetRolloutLabel?: RAGRetrievalReleaseIncidentRecord['targetRolloutLabel'];
|
|
3487
|
+
}) => Promise<RAGRetrievalIncidentRemediationExecutionHistoryRecord[]> | RAGRetrievalIncidentRemediationExecutionHistoryRecord[];
|
|
3488
|
+
};
|
|
3489
|
+
export type RAGRetrievalIncidentRemediationExecutionHistoryResponse = {
|
|
3490
|
+
ok: boolean;
|
|
3491
|
+
records?: RAGRetrievalIncidentRemediationExecutionHistoryRecord[];
|
|
3492
|
+
error?: string;
|
|
3493
|
+
};
|
|
3494
|
+
export type RAGRetrievalIncidentRemediationExecutionSummary = {
|
|
3495
|
+
totalCount: number;
|
|
3496
|
+
replayCount: number;
|
|
3497
|
+
replayRate: number;
|
|
3498
|
+
guardrailBlockedCount: number;
|
|
3499
|
+
guardrailBlockRate: number;
|
|
3500
|
+
mutationSkippedReplayCount: number;
|
|
3501
|
+
recentMutationSkippedReplays: RAGRetrievalIncidentRemediationExecutionHistoryRecord[];
|
|
3502
|
+
recentGuardrailBlocks: RAGRetrievalIncidentRemediationExecutionHistoryRecord[];
|
|
3503
|
+
};
|
|
3504
|
+
export type RAGRetrievalIncidentRemediationBulkExecutionRequest = {
|
|
3505
|
+
items: RAGRetrievalIncidentRemediationExecutionRequest[];
|
|
3506
|
+
allowMutationExecution?: boolean;
|
|
3507
|
+
stopOnError?: boolean;
|
|
3508
|
+
};
|
|
3509
|
+
export type RAGRetrievalIncidentRemediationBulkExecutionResponse = {
|
|
3510
|
+
ok: boolean;
|
|
3511
|
+
results?: Array<{
|
|
3512
|
+
index: number;
|
|
3513
|
+
ok: boolean;
|
|
3514
|
+
execution?: RAGRetrievalIncidentRemediationExecutionResult;
|
|
3515
|
+
record?: RAGRetrievalIncidentRemediationDecisionRecord;
|
|
3516
|
+
error?: string;
|
|
3517
|
+
}>;
|
|
3518
|
+
error?: string;
|
|
3519
|
+
};
|
|
3520
|
+
export type RAGRetrievalReleaseGroupSummary = {
|
|
3521
|
+
corpusGroupKey?: string;
|
|
3522
|
+
groupKey: string;
|
|
3523
|
+
classification?: 'general' | 'multivector' | 'runtime' | 'evidence';
|
|
3524
|
+
escalationSeverity: 'none' | 'info' | 'warning' | 'critical';
|
|
3525
|
+
recommendedAction: 'promote_candidate' | 'renew_approval' | 'await_approval' | 'investigate_regression' | 'monitor';
|
|
3526
|
+
recommendedActionReasons: string[];
|
|
3527
|
+
approvalRequired: boolean;
|
|
3528
|
+
approvalMaxAgeMs?: number;
|
|
3529
|
+
blockedReasons: string[];
|
|
3530
|
+
actionRequired: boolean;
|
|
3531
|
+
actionRequiredReasons: string[];
|
|
3532
|
+
activeBaselineRetrievalId?: string;
|
|
3533
|
+
activeBaselineVersion?: number;
|
|
3534
|
+
activeBaselineRolloutLabel?: 'canary' | 'stable' | 'rollback_target';
|
|
3535
|
+
latestDecisionKind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3536
|
+
latestDecisionAt?: number;
|
|
3537
|
+
latestRejectedCandidateRetrievalId?: string;
|
|
3538
|
+
pendingCandidateCount: number;
|
|
3539
|
+
openIncidentCount: number;
|
|
3540
|
+
acknowledgedOpenIncidentCount: number;
|
|
3541
|
+
unacknowledgedOpenIncidentCount: number;
|
|
3542
|
+
activeBaselineGatePolicy?: RAGRetrievalBaselineGatePolicy;
|
|
3543
|
+
};
|
|
3544
|
+
export type RAGRetrievalReleaseTimelineSummary = {
|
|
3545
|
+
corpusGroupKey?: string;
|
|
3546
|
+
groupKey: string;
|
|
3547
|
+
lastApprovedAt?: number;
|
|
3548
|
+
lastPromotedAt?: number;
|
|
3549
|
+
lastRejectedAt?: number;
|
|
3550
|
+
lastRevertedAt?: number;
|
|
3551
|
+
latestDecisionKind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3552
|
+
latestDecisionAt?: number;
|
|
3553
|
+
latestDecisionFreshnessStatus?: RAGRetrievalReleaseDecisionRecord['freshnessStatus'];
|
|
3554
|
+
};
|
|
3555
|
+
export type RAGRetrievalReleaseLaneTimelineSummary = {
|
|
3556
|
+
corpusGroupKey?: string;
|
|
3557
|
+
groupKey: string;
|
|
3558
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3559
|
+
lastApprovedAt?: number;
|
|
3560
|
+
lastPromotedAt?: number;
|
|
3561
|
+
lastRejectedAt?: number;
|
|
3562
|
+
lastRevertedAt?: number;
|
|
3563
|
+
latestDecisionKind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3564
|
+
latestDecisionAt?: number;
|
|
3565
|
+
latestDecisionFreshnessStatus?: RAGRetrievalReleaseDecisionRecord['freshnessStatus'];
|
|
3566
|
+
};
|
|
3567
|
+
export type RAGRetrievalReleaseLaneDecisionSummary = {
|
|
3568
|
+
corpusGroupKey?: string;
|
|
3569
|
+
groupKey: string;
|
|
3570
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3571
|
+
decisionCount: number;
|
|
3572
|
+
approvalCount: number;
|
|
3573
|
+
promotionCount: number;
|
|
3574
|
+
rejectionCount: number;
|
|
3575
|
+
revertCount: number;
|
|
3576
|
+
latestDecisionKind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3577
|
+
latestDecisionAt?: number;
|
|
3578
|
+
latestDecisionBy?: string;
|
|
3579
|
+
};
|
|
3580
|
+
export type RAGRetrievalReleaseApprovalScopeSummary = {
|
|
3581
|
+
corpusGroupKey?: string;
|
|
3582
|
+
groupKey: string;
|
|
3583
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3584
|
+
status: 'approved' | 'rejected' | 'none';
|
|
3585
|
+
latestDecisionKind?: 'approve' | 'reject';
|
|
3586
|
+
latestDecisionAt?: number;
|
|
3587
|
+
latestApprovedAt?: number;
|
|
3588
|
+
latestApprovedBy?: string;
|
|
3589
|
+
latestRejectedAt?: number;
|
|
3590
|
+
latestRejectedBy?: string;
|
|
3591
|
+
};
|
|
3592
|
+
export type RAGRetrievalReleaseLaneEscalationPolicySummary = {
|
|
3593
|
+
corpusGroupKey?: string;
|
|
3594
|
+
groupKey: string;
|
|
3595
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3596
|
+
openIncidentSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3597
|
+
regressionSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3598
|
+
gateFailureSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3599
|
+
approvalExpiredSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3600
|
+
};
|
|
3601
|
+
export type RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord = {
|
|
3602
|
+
id: string;
|
|
3603
|
+
corpusGroupKey?: string;
|
|
3604
|
+
groupKey: string;
|
|
3605
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3606
|
+
openIncidentSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3607
|
+
regressionSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3608
|
+
gateFailureSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3609
|
+
approvalExpiredSeverity: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3610
|
+
recordedAt: number;
|
|
3611
|
+
changeKind: 'snapshot' | 'changed';
|
|
3612
|
+
previousOpenIncidentSeverity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3613
|
+
previousRegressionSeverity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3614
|
+
previousGateFailureSeverity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3615
|
+
previousApprovalExpiredSeverity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3616
|
+
};
|
|
3617
|
+
export type RAGRetrievalReleaseLaneEscalationPolicyHistoryStore = {
|
|
3618
|
+
saveRecord: (record: RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord) => Promise<void> | void;
|
|
3619
|
+
listRecords: (input?: {
|
|
3620
|
+
corpusGroupKey?: string;
|
|
3621
|
+
groupKey?: string;
|
|
3622
|
+
limit?: number;
|
|
3623
|
+
targetRolloutLabel?: RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord['targetRolloutLabel'];
|
|
3624
|
+
}) => Promise<RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord[]> | RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord[];
|
|
3625
|
+
};
|
|
3626
|
+
export type RAGRetrievalReleaseLaneEscalationPolicyHistoryResponse = {
|
|
3627
|
+
ok: boolean;
|
|
3628
|
+
records?: RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord[];
|
|
3629
|
+
error?: string;
|
|
3630
|
+
};
|
|
3631
|
+
export type RAGRetrievalReleaseLaneAuditSummary = {
|
|
3632
|
+
corpusGroupKey?: string;
|
|
3633
|
+
groupKey: string;
|
|
3634
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3635
|
+
activeBaselineRetrievalId?: string;
|
|
3636
|
+
activeBaselineVersion?: number;
|
|
3637
|
+
latestDecisionKind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3638
|
+
latestDecisionAt?: number;
|
|
3639
|
+
lastApprovedAt?: number;
|
|
3640
|
+
lastApprovedBy?: string;
|
|
3641
|
+
lastPromotedAt?: number;
|
|
3642
|
+
lastPromotedBy?: string;
|
|
3643
|
+
lastRejectedAt?: number;
|
|
3644
|
+
lastRejectedBy?: string;
|
|
3645
|
+
lastRevertedAt?: number;
|
|
3646
|
+
lastRevertedBy?: string;
|
|
3647
|
+
};
|
|
3648
|
+
export type RAGRetrievalReleaseLaneRecommendationSummary = {
|
|
3649
|
+
corpusGroupKey?: string;
|
|
3650
|
+
groupKey: string;
|
|
3651
|
+
classification?: 'general' | 'multivector' | 'runtime' | 'evidence';
|
|
3652
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3653
|
+
recommendedAction: 'promote_candidate' | 'renew_approval' | 'await_approval' | 'investigate_regression' | 'monitor';
|
|
3654
|
+
recommendedActionReasons: string[];
|
|
3655
|
+
ready: boolean;
|
|
3656
|
+
requiresApproval: boolean;
|
|
3657
|
+
requiresOverride?: boolean;
|
|
3658
|
+
reviewStatus?: RAGRetrievalPromotionCandidate['reviewStatus'];
|
|
3659
|
+
gateStatus?: RAGRetrievalPromotionCandidate['gateStatus'];
|
|
3660
|
+
candidateRetrievalId?: string;
|
|
3661
|
+
baselineRetrievalId?: string;
|
|
3662
|
+
sourceRunId?: string;
|
|
3663
|
+
effectiveReleasePolicy?: RAGRetrievalPromotionCandidate['effectiveReleasePolicy'];
|
|
3664
|
+
effectiveBaselineGatePolicy?: RAGRetrievalPromotionCandidate['effectiveBaselineGatePolicy'];
|
|
3665
|
+
remediationActions?: string[];
|
|
3666
|
+
remediationSteps?: RAGRemediationStep[];
|
|
3667
|
+
};
|
|
3668
|
+
export type RAGRetrievalReleaseLaneHandoffSummary = {
|
|
3669
|
+
corpusGroupKey?: string;
|
|
3670
|
+
groupKey: string;
|
|
3671
|
+
sourceRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3672
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3673
|
+
sourceBaselineRetrievalId?: string;
|
|
3674
|
+
targetBaselineRetrievalId?: string;
|
|
3675
|
+
candidateRetrievalId?: string;
|
|
3676
|
+
sourceActive: boolean;
|
|
3677
|
+
targetActive: boolean;
|
|
3678
|
+
readyForHandoff: boolean;
|
|
3679
|
+
reasons: string[];
|
|
3680
|
+
policyDelta: {
|
|
3681
|
+
requireApprovalBeforePromotionChanged: boolean;
|
|
3682
|
+
approvalMaxAgeMsDelta?: number;
|
|
3683
|
+
gateSeverityChanged: boolean;
|
|
3684
|
+
minPassingRateDeltaDelta?: number;
|
|
3685
|
+
minAverageF1DeltaDelta?: number;
|
|
3686
|
+
};
|
|
3687
|
+
targetReadiness?: RAGRetrievalPromotionReadiness;
|
|
3688
|
+
};
|
|
3689
|
+
export type RAGRetrievalLanePromotionStateSummary = {
|
|
3690
|
+
groupKey: string;
|
|
3691
|
+
classification?: 'general' | 'multivector' | 'runtime' | 'evidence';
|
|
3692
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3693
|
+
baselineRetrievalId?: string;
|
|
3694
|
+
candidateRetrievalId?: string;
|
|
3695
|
+
sourceRunId?: string;
|
|
3696
|
+
ready: boolean;
|
|
3697
|
+
reasons: string[];
|
|
3698
|
+
gateStatus?: RAGRetrievalPromotionCandidate['gateStatus'];
|
|
3699
|
+
reviewStatus?: RAGRetrievalPromotionCandidate['reviewStatus'];
|
|
3700
|
+
requiresApproval: boolean;
|
|
3701
|
+
requiresOverride?: boolean;
|
|
3702
|
+
effectiveReleasePolicy?: RAGRetrievalPromotionCandidate['effectiveReleasePolicy'];
|
|
3703
|
+
effectiveBaselineGatePolicy?: RAGRetrievalPromotionCandidate['effectiveBaselineGatePolicy'];
|
|
3704
|
+
remediationActions?: string[];
|
|
3705
|
+
remediationSteps?: RAGRemediationStep[];
|
|
3706
|
+
};
|
|
3707
|
+
export type RAGRetrievalReleaseIncidentRecord = {
|
|
3708
|
+
id: string;
|
|
3709
|
+
groupKey: string;
|
|
3710
|
+
corpusGroupKey?: string;
|
|
3711
|
+
targetRolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3712
|
+
severity: 'warning' | 'critical';
|
|
3713
|
+
status: 'open' | 'resolved';
|
|
3714
|
+
kind: 'approval_expired' | 'baseline_regression' | 'gate_failure' | 'handoff_stale';
|
|
3715
|
+
message: string;
|
|
3716
|
+
triggeredAt: number;
|
|
3717
|
+
resolvedAt?: number;
|
|
3718
|
+
candidateRetrievalId?: string;
|
|
3719
|
+
baselineRetrievalId?: string;
|
|
3720
|
+
sourceRunId?: string;
|
|
3721
|
+
acknowledgedAt?: number;
|
|
3722
|
+
acknowledgedBy?: string;
|
|
3723
|
+
acknowledgementNotes?: string;
|
|
3724
|
+
notes?: string;
|
|
3725
|
+
classification?: 'general' | 'multivector' | 'runtime' | 'evidence';
|
|
3726
|
+
};
|
|
3727
|
+
export type RAGRetrievalLaneHandoffIncidentRecord = Omit<RAGRetrievalReleaseIncidentRecord, 'kind'> & {
|
|
3728
|
+
corpusGroupKey?: string;
|
|
3729
|
+
kind: 'handoff_stale';
|
|
3730
|
+
sourceRolloutLabel?: RAGRetrievalLaneHandoffDecisionRecord['sourceRolloutLabel'];
|
|
3731
|
+
};
|
|
3732
|
+
export type RAGRetrievalReleaseLaneIncidentSummary = {
|
|
3733
|
+
corpusGroupKey?: string;
|
|
3734
|
+
groupKey: string;
|
|
3735
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3736
|
+
openCount: number;
|
|
3737
|
+
resolvedCount: number;
|
|
3738
|
+
acknowledgedOpenCount: number;
|
|
3739
|
+
unacknowledgedOpenCount: number;
|
|
3740
|
+
latestTriggeredAt?: number;
|
|
3741
|
+
latestResolvedAt?: number;
|
|
3742
|
+
latestKind?: RAGRetrievalReleaseIncidentRecord['kind'];
|
|
3743
|
+
highestSeverity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3744
|
+
};
|
|
3745
|
+
export type RAGRetrievalReleaseIncidentAcknowledgeRequest = {
|
|
3746
|
+
incidentId: string;
|
|
3747
|
+
acknowledgedAt?: number;
|
|
3748
|
+
acknowledgedBy?: string;
|
|
3749
|
+
acknowledgementNotes?: string;
|
|
3750
|
+
};
|
|
3751
|
+
export type RAGRetrievalReleaseIncidentUnacknowledgeRequest = {
|
|
3752
|
+
incidentId: string;
|
|
3753
|
+
};
|
|
3754
|
+
export type RAGRetrievalReleaseIncidentResolveRequest = {
|
|
3755
|
+
incidentId: string;
|
|
3756
|
+
resolvedAt?: number;
|
|
3757
|
+
resolvedBy?: string;
|
|
3758
|
+
resolutionNotes?: string;
|
|
3759
|
+
};
|
|
3760
|
+
export type RAGRetrievalReleaseIncidentStore = {
|
|
3761
|
+
saveIncident: (record: RAGRetrievalReleaseIncidentRecord) => Promise<void> | void;
|
|
3762
|
+
listIncidents: (input?: {
|
|
3763
|
+
corpusGroupKey?: string;
|
|
3764
|
+
groupKey?: string;
|
|
3765
|
+
limit?: number;
|
|
3766
|
+
targetRolloutLabel?: RAGRetrievalReleaseIncidentRecord['targetRolloutLabel'];
|
|
3767
|
+
status?: RAGRetrievalReleaseIncidentRecord['status'];
|
|
3768
|
+
severity?: RAGRetrievalReleaseIncidentRecord['severity'];
|
|
3769
|
+
}) => Promise<RAGRetrievalReleaseIncidentRecord[]> | RAGRetrievalReleaseIncidentRecord[];
|
|
3770
|
+
};
|
|
3771
|
+
export type RAGRetrievalLaneHandoffIncidentStore = {
|
|
3772
|
+
saveIncident: (record: RAGRetrievalLaneHandoffIncidentRecord) => Promise<void> | void;
|
|
3773
|
+
listIncidents: (input?: {
|
|
3774
|
+
corpusGroupKey?: string;
|
|
3775
|
+
groupKey?: string;
|
|
3776
|
+
limit?: number;
|
|
3777
|
+
targetRolloutLabel?: RAGRetrievalLaneHandoffIncidentRecord['targetRolloutLabel'];
|
|
3778
|
+
status?: RAGRetrievalLaneHandoffIncidentRecord['status'];
|
|
3779
|
+
severity?: RAGRetrievalLaneHandoffIncidentRecord['severity'];
|
|
3780
|
+
}) => Promise<RAGRetrievalLaneHandoffIncidentRecord[]> | RAGRetrievalLaneHandoffIncidentRecord[];
|
|
3781
|
+
};
|
|
3782
|
+
export type RAGRetrievalLaneHandoffIncidentListResponse = {
|
|
3783
|
+
ok: boolean;
|
|
3784
|
+
incidents?: RAGRetrievalLaneHandoffIncidentRecord[];
|
|
3785
|
+
error?: string;
|
|
3786
|
+
};
|
|
3787
|
+
export type RAGRetrievalLaneHandoffIncidentHistoryRecord = {
|
|
3788
|
+
id: string;
|
|
3789
|
+
incidentId: string;
|
|
3790
|
+
corpusGroupKey?: string;
|
|
3791
|
+
groupKey: string;
|
|
3792
|
+
kind: 'handoff_stale';
|
|
3793
|
+
targetRolloutLabel?: RAGRetrievalLaneHandoffIncidentRecord['targetRolloutLabel'];
|
|
3794
|
+
sourceRolloutLabel?: RAGRetrievalLaneHandoffIncidentRecord['sourceRolloutLabel'];
|
|
3795
|
+
action: 'opened' | 'acknowledged' | 'unacknowledged' | 'resolved';
|
|
3796
|
+
recordedAt: number;
|
|
3797
|
+
recordedBy?: string;
|
|
3798
|
+
notes?: string;
|
|
3799
|
+
status?: RAGRetrievalLaneHandoffIncidentRecord['status'];
|
|
3800
|
+
severity?: RAGRetrievalLaneHandoffIncidentRecord['severity'];
|
|
3801
|
+
};
|
|
3802
|
+
export type RAGRetrievalLaneHandoffIncidentHistoryStore = {
|
|
3803
|
+
saveRecord: (record: RAGRetrievalLaneHandoffIncidentHistoryRecord) => Promise<void> | void;
|
|
3804
|
+
listRecords: (input?: {
|
|
3805
|
+
corpusGroupKey?: string;
|
|
3806
|
+
groupKey?: string;
|
|
3807
|
+
incidentId?: string;
|
|
3808
|
+
limit?: number;
|
|
3809
|
+
targetRolloutLabel?: RAGRetrievalLaneHandoffIncidentRecord['targetRolloutLabel'];
|
|
3810
|
+
action?: RAGRetrievalLaneHandoffIncidentHistoryRecord['action'];
|
|
3811
|
+
}) => Promise<RAGRetrievalLaneHandoffIncidentHistoryRecord[]> | RAGRetrievalLaneHandoffIncidentHistoryRecord[];
|
|
3812
|
+
};
|
|
3813
|
+
export type RAGRetrievalLaneHandoffIncidentHistoryResponse = {
|
|
3814
|
+
ok: boolean;
|
|
3815
|
+
records?: RAGRetrievalLaneHandoffIncidentHistoryRecord[];
|
|
3816
|
+
error?: string;
|
|
3817
|
+
};
|
|
3818
|
+
export type RAGRetrievalLaneHandoffAutoCompletePolicy = {
|
|
3819
|
+
enabled?: boolean;
|
|
3820
|
+
maxApprovedDecisionAgeMs?: number;
|
|
3821
|
+
};
|
|
3822
|
+
export type RAGRetrievalLaneHandoffAutoCompletePolicySummary = {
|
|
3823
|
+
groupKey: string;
|
|
3824
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
3825
|
+
enabled: boolean;
|
|
3826
|
+
maxApprovedDecisionAgeMs?: number;
|
|
3827
|
+
scope: 'group_target_rollout_label';
|
|
3828
|
+
};
|
|
3829
|
+
export type RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord = {
|
|
3830
|
+
id: string;
|
|
3831
|
+
corpusGroupKey?: string;
|
|
3832
|
+
groupKey: string;
|
|
3833
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
3834
|
+
enabled: boolean;
|
|
3835
|
+
maxApprovedDecisionAgeMs?: number;
|
|
3836
|
+
recordedAt: number;
|
|
3837
|
+
changeKind: 'snapshot' | 'changed';
|
|
3838
|
+
previousEnabled?: boolean;
|
|
3839
|
+
previousMaxApprovedDecisionAgeMs?: number;
|
|
3840
|
+
};
|
|
3841
|
+
export type RAGRetrievalLaneHandoffAutoCompletePolicyHistoryStore = {
|
|
3842
|
+
saveRecord: (record: RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord) => Promise<void> | void;
|
|
3843
|
+
listRecords: (input?: {
|
|
3844
|
+
corpusGroupKey?: string;
|
|
3845
|
+
groupKey?: string;
|
|
3846
|
+
limit?: number;
|
|
3847
|
+
targetRolloutLabel?: RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord['targetRolloutLabel'];
|
|
3848
|
+
}) => Promise<RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord[]> | RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord[];
|
|
3849
|
+
};
|
|
3850
|
+
export type RAGRetrievalLaneHandoffAutoCompletePolicyHistoryResponse = {
|
|
3851
|
+
ok: boolean;
|
|
3852
|
+
records?: RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord[];
|
|
3853
|
+
error?: string;
|
|
3854
|
+
};
|
|
3855
|
+
export type RAGRetrievalLaneAutoCompleteSafetySummary = {
|
|
3856
|
+
groupKey: string;
|
|
3857
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
3858
|
+
safe: boolean;
|
|
3859
|
+
enabled: boolean;
|
|
3860
|
+
reasons: string[];
|
|
3861
|
+
candidateRetrievalId?: string;
|
|
3862
|
+
sourceRunId?: string;
|
|
3863
|
+
latestApprovedAt?: number;
|
|
3864
|
+
approvalExpiresAt?: number;
|
|
3865
|
+
freshnessStatus: 'fresh' | 'expired' | 'not_applicable';
|
|
3866
|
+
};
|
|
3867
|
+
export type RAGRetrievalLaneHandoffDriftRollup = {
|
|
3868
|
+
kind: 'handoff_auto_complete_policy_drift' | 'handoff_auto_complete_stale_approval' | 'handoff_auto_complete_source_lane_missing' | 'handoff_auto_complete_gate_blocked' | 'handoff_auto_complete_approval_missing';
|
|
3869
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
3870
|
+
count: number;
|
|
3871
|
+
groupKeys: string[];
|
|
3872
|
+
severity: 'warning';
|
|
3873
|
+
remediationHints: string[];
|
|
3874
|
+
remediationSteps?: RAGRemediationStep[];
|
|
3875
|
+
};
|
|
3876
|
+
export type RAGRetrievalLaneHandoffDriftCountByLane = {
|
|
3877
|
+
targetRolloutLabel: Exclude<RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'], undefined>;
|
|
3878
|
+
totalCount: number;
|
|
3879
|
+
countsByKind: Record<RAGRetrievalLaneHandoffDriftRollup['kind'], number>;
|
|
3880
|
+
};
|
|
3881
|
+
export type RAGRetrievalReleaseIncidentListResponse = {
|
|
3882
|
+
ok: boolean;
|
|
3883
|
+
incidents?: RAGRetrievalReleaseIncidentRecord[];
|
|
3884
|
+
error?: string;
|
|
3885
|
+
};
|
|
3886
|
+
export type RAGRetrievalReleaseIncidentStatusResponse = {
|
|
3887
|
+
ok: true;
|
|
3888
|
+
incidentSummary?: RAGRetrievalComparisonRuntime['incidentSummary'];
|
|
3889
|
+
incidentClassificationSummary?: RAGRetrievalIncidentClassificationSummary;
|
|
3890
|
+
releaseLaneIncidentSummaries?: RAGRetrievalComparisonRuntime['releaseLaneIncidentSummaries'];
|
|
3891
|
+
recentIncidents?: RAGRetrievalComparisonRuntime['recentIncidents'];
|
|
3892
|
+
recentIncidentRemediationDecisions?: RAGRetrievalComparisonRuntime['recentIncidentRemediationDecisions'];
|
|
3893
|
+
recentIncidentRemediationExecutions?: RAGRetrievalComparisonRuntime['recentIncidentRemediationExecutions'];
|
|
3894
|
+
incidentRemediationExecutionSummary?: RAGRetrievalComparisonRuntime['incidentRemediationExecutionSummary'];
|
|
3895
|
+
recentReleaseLaneEscalationPolicyHistory?: RAGRetrievalComparisonRuntime['recentReleaseLaneEscalationPolicyHistory'];
|
|
3896
|
+
};
|
|
3897
|
+
export type RAGRetrievalIncidentRemediationStatusResponse = {
|
|
3898
|
+
ok: true;
|
|
3899
|
+
incidentClassificationSummary?: RAGRetrievalIncidentClassificationSummary;
|
|
3900
|
+
recentIncidentRemediationExecutions?: RAGRetrievalComparisonRuntime['recentIncidentRemediationExecutions'];
|
|
3901
|
+
incidentRemediationExecutionSummary?: RAGRetrievalComparisonRuntime['incidentRemediationExecutionSummary'];
|
|
3902
|
+
};
|
|
3903
|
+
export type RAGRetrievalIncidentClassificationSummary = {
|
|
3904
|
+
totalGeneralCount: number;
|
|
3905
|
+
totalMultiVectorCount: number;
|
|
3906
|
+
totalRuntimeCount: number;
|
|
3907
|
+
totalEvidenceCount: number;
|
|
3908
|
+
openGeneralCount: number;
|
|
3909
|
+
openMultiVectorCount: number;
|
|
3910
|
+
openRuntimeCount: number;
|
|
3911
|
+
openEvidenceCount: number;
|
|
3912
|
+
resolvedGeneralCount: number;
|
|
3913
|
+
resolvedMultiVectorCount: number;
|
|
3914
|
+
resolvedRuntimeCount: number;
|
|
3915
|
+
resolvedEvidenceCount: number;
|
|
3916
|
+
};
|
|
3917
|
+
export type RAGRetrievalReleaseEvent = {
|
|
3918
|
+
kind: 'incident_opened' | 'incident_resolved';
|
|
3919
|
+
incident: RAGRetrievalReleaseIncidentRecord;
|
|
3920
|
+
};
|
|
3921
|
+
export type RAGRetrievalReleasePolicySummary = RAGRetrievalReleasePolicy & {
|
|
3922
|
+
groupKey: string;
|
|
3923
|
+
rolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3924
|
+
};
|
|
3925
|
+
export type RAGRetrievalReleaseDecisionStore = {
|
|
3926
|
+
saveDecision: (record: RAGRetrievalReleaseDecisionRecord) => Promise<void> | void;
|
|
3927
|
+
listDecisions: (input?: {
|
|
3928
|
+
corpusGroupKey?: string;
|
|
3929
|
+
groupKey?: string;
|
|
3930
|
+
limit?: number;
|
|
3931
|
+
kind?: RAGRetrievalReleaseDecisionRecord['kind'];
|
|
3932
|
+
}) => Promise<RAGRetrievalReleaseDecisionRecord[]> | RAGRetrievalReleaseDecisionRecord[];
|
|
3933
|
+
};
|
|
3934
|
+
export type RAGRetrievalReleaseDecisionActionRequest = {
|
|
3935
|
+
corpusGroupKey?: string;
|
|
3936
|
+
groupKey: string;
|
|
3937
|
+
sourceRunId: string;
|
|
3938
|
+
targetRolloutLabel?: RAGRetrievalBaselineRecord['rolloutLabel'];
|
|
3939
|
+
retrievalId?: string;
|
|
3940
|
+
decidedBy?: string;
|
|
3941
|
+
decidedAt?: number;
|
|
3942
|
+
notes?: string;
|
|
3943
|
+
overrideGate?: boolean;
|
|
3944
|
+
overrideReason?: string;
|
|
3945
|
+
};
|
|
3946
|
+
export type RAGRetrievalReleaseDecisionResponse = {
|
|
3947
|
+
ok: boolean;
|
|
3948
|
+
decision?: RAGRetrievalReleaseDecisionRecord;
|
|
3949
|
+
error?: string;
|
|
3950
|
+
};
|
|
3951
|
+
export type RAGRetrievalReleaseDecisionListResponse = {
|
|
3952
|
+
ok: boolean;
|
|
3953
|
+
decisions?: RAGRetrievalReleaseDecisionRecord[];
|
|
3954
|
+
error?: string;
|
|
3955
|
+
};
|
|
3956
|
+
export type RAGRetrievalLaneHandoffDecisionRecord = {
|
|
3957
|
+
id: string;
|
|
3958
|
+
corpusGroupKey?: string;
|
|
3959
|
+
groupKey: string;
|
|
3960
|
+
sourceRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3961
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3962
|
+
kind: 'approve' | 'reject' | 'complete';
|
|
3963
|
+
decidedAt: number;
|
|
3964
|
+
decidedBy?: string;
|
|
3965
|
+
notes?: string;
|
|
3966
|
+
candidateRetrievalId?: string;
|
|
3967
|
+
sourceBaselineRetrievalId?: string;
|
|
3968
|
+
targetBaselineRetrievalId?: string;
|
|
3969
|
+
sourceRunId?: string;
|
|
3970
|
+
};
|
|
3971
|
+
export type RAGRetrievalLaneHandoffDecisionStore = {
|
|
3972
|
+
saveDecision: (record: RAGRetrievalLaneHandoffDecisionRecord) => Promise<void> | void;
|
|
3973
|
+
listDecisions: (input?: {
|
|
3974
|
+
corpusGroupKey?: string;
|
|
3975
|
+
groupKey?: string;
|
|
3976
|
+
sourceRolloutLabel?: RAGRetrievalLaneHandoffDecisionRecord['sourceRolloutLabel'];
|
|
3977
|
+
targetRolloutLabel?: RAGRetrievalLaneHandoffDecisionRecord['targetRolloutLabel'];
|
|
3978
|
+
kind?: RAGRetrievalLaneHandoffDecisionRecord['kind'];
|
|
3979
|
+
limit?: number;
|
|
3980
|
+
}) => Promise<RAGRetrievalLaneHandoffDecisionRecord[]> | RAGRetrievalLaneHandoffDecisionRecord[];
|
|
3981
|
+
};
|
|
3982
|
+
export type RAGRetrievalLaneHandoffDecisionRequest = {
|
|
3983
|
+
corpusGroupKey?: string;
|
|
3984
|
+
groupKey: string;
|
|
3985
|
+
sourceRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3986
|
+
targetRolloutLabel: Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>;
|
|
3987
|
+
kind: RAGRetrievalLaneHandoffDecisionRecord['kind'];
|
|
3988
|
+
decidedBy?: string;
|
|
3989
|
+
decidedAt?: number;
|
|
3990
|
+
notes?: string;
|
|
3991
|
+
candidateRetrievalId?: string;
|
|
3992
|
+
sourceRunId?: string;
|
|
3993
|
+
executePromotion?: boolean;
|
|
3994
|
+
};
|
|
3995
|
+
export type RAGRetrievalLaneHandoffDecisionResponse = {
|
|
3996
|
+
ok: boolean;
|
|
3997
|
+
decision?: RAGRetrievalLaneHandoffDecisionRecord;
|
|
3998
|
+
baseline?: RAGRetrievalBaselineRecord;
|
|
3999
|
+
rolloutState?: RAGRetrievalLanePromotionStateSummary;
|
|
4000
|
+
error?: string;
|
|
4001
|
+
};
|
|
4002
|
+
export type RAGRetrievalLaneHandoffDecisionListResponse = {
|
|
4003
|
+
ok: boolean;
|
|
4004
|
+
decisions?: RAGRetrievalLaneHandoffDecisionRecord[];
|
|
4005
|
+
error?: string;
|
|
4006
|
+
};
|
|
4007
|
+
export type RAGRetrievalLaneHandoffListResponse = {
|
|
4008
|
+
ok: boolean;
|
|
4009
|
+
handoffs?: RAGRetrievalReleaseLaneHandoffSummary[];
|
|
4010
|
+
error?: string;
|
|
4011
|
+
};
|
|
4012
|
+
export type RAGRetrievalReleaseGroupHistoryResponse = {
|
|
4013
|
+
ok: boolean;
|
|
4014
|
+
corpusGroupKey?: string;
|
|
4015
|
+
groupKey?: string;
|
|
4016
|
+
decisions?: RAGRetrievalReleaseDecisionRecord[];
|
|
4017
|
+
baselines?: RAGRetrievalBaselineRecord[];
|
|
4018
|
+
runs?: RAGRetrievalComparisonRun[];
|
|
4019
|
+
timeline?: RAGRetrievalReleaseTimelineSummary;
|
|
4020
|
+
presentation?: RAGRetrievalReleaseGroupHistoryPresentation;
|
|
4021
|
+
adaptiveNativePlannerBenchmark?: RAGAdaptiveNativePlannerBenchmarkRuntime;
|
|
4022
|
+
nativeBackendComparisonBenchmark?: RAGNativeBackendComparisonBenchmarkRuntime;
|
|
4023
|
+
error?: string;
|
|
4024
|
+
};
|
|
4025
|
+
export type RAGRetrievalPromotionCandidateListResponse = {
|
|
4026
|
+
ok: boolean;
|
|
4027
|
+
candidates?: RAGRetrievalPromotionCandidate[];
|
|
4028
|
+
error?: string;
|
|
4029
|
+
};
|
|
4030
|
+
export type RAGRetrievalComparisonLatestSummary = {
|
|
4031
|
+
id: string;
|
|
4032
|
+
label: string;
|
|
4033
|
+
suiteId: string;
|
|
4034
|
+
suiteLabel: string;
|
|
4035
|
+
corpusGroupKey?: string;
|
|
4036
|
+
groupKey?: string;
|
|
4037
|
+
tags?: string[];
|
|
4038
|
+
finishedAt: number;
|
|
4039
|
+
elapsedMs: number;
|
|
4040
|
+
bestByPassingRate?: string;
|
|
4041
|
+
bestByAverageF1?: string;
|
|
4042
|
+
fastest?: string;
|
|
4043
|
+
bestByMultivectorCollapsedCases?: string;
|
|
4044
|
+
bestByMultivectorLexicalHitCases?: string;
|
|
4045
|
+
bestByMultivectorVectorHitCases?: string;
|
|
4046
|
+
bestByEvidenceReconcileCases?: string;
|
|
4047
|
+
bestByOfficeEvidenceReconcileCases?: string;
|
|
4048
|
+
bestByPDFEvidenceReconcileCases?: string;
|
|
4049
|
+
bestByLowestRuntimeCandidateBudgetExhaustedCases?: string;
|
|
4050
|
+
bestByLowestRuntimeUnderfilledTopKCases?: string;
|
|
4051
|
+
decisionSummary?: RAGRetrievalComparisonDecisionSummary;
|
|
4052
|
+
releaseVerdict?: RAGRetrievalReleaseVerdict;
|
|
4053
|
+
};
|
|
4054
|
+
export type RAGRetrievalComparisonWinnerTrend = {
|
|
4055
|
+
retrievalId: string;
|
|
4056
|
+
runCount: number;
|
|
4057
|
+
latestFinishedAt: number;
|
|
4058
|
+
};
|
|
4059
|
+
export type RAGRetrievalComparisonAlert = {
|
|
4060
|
+
kind: 'stable_winner_changed' | 'baseline_regression' | 'baseline_gate_failed' | 'handoff_auto_complete_policy_drift' | 'handoff_auto_complete_stale_approval' | 'handoff_auto_complete_source_lane_missing' | 'handoff_auto_complete_gate_blocked' | 'handoff_auto_complete_approval_missing';
|
|
4061
|
+
severity: 'info' | 'warning';
|
|
4062
|
+
message: string;
|
|
4063
|
+
latestRunId: string;
|
|
4064
|
+
retrievalId?: string;
|
|
4065
|
+
corpusGroupKey?: string;
|
|
4066
|
+
groupKey?: string;
|
|
4067
|
+
tag?: string;
|
|
4068
|
+
baselineRetrievalId?: string;
|
|
4069
|
+
candidateRetrievalId?: string;
|
|
4070
|
+
delta?: RAGRetrievalComparisonDecisionDelta;
|
|
4071
|
+
gate?: RAGRetrievalComparisonGateResult;
|
|
4072
|
+
classification?: 'general' | 'multivector' | 'runtime' | 'evidence';
|
|
4073
|
+
};
|
|
4074
|
+
export type RAGRetrievalComparisonRuntime = {
|
|
4075
|
+
configured: boolean;
|
|
4076
|
+
recentRuns?: RAGRetrievalComparisonRun[];
|
|
4077
|
+
latest?: RAGRetrievalComparisonLatestSummary;
|
|
4078
|
+
adaptiveNativePlannerBenchmark?: RAGAdaptiveNativePlannerBenchmarkRuntime;
|
|
4079
|
+
nativeBackendComparisonBenchmark?: RAGNativeBackendComparisonBenchmarkRuntime;
|
|
4080
|
+
stableWinnerByPassingRate?: RAGRetrievalComparisonWinnerTrend;
|
|
4081
|
+
alerts?: RAGRetrievalComparisonAlert[];
|
|
4082
|
+
activeBaselines?: RAGRetrievalBaselineRecord[];
|
|
4083
|
+
baselineHistory?: RAGRetrievalBaselineRecord[];
|
|
4084
|
+
recentDecisions?: RAGRetrievalReleaseDecisionRecord[];
|
|
4085
|
+
latestRejectedCandidate?: RAGRetrievalReleaseDecisionRecord;
|
|
4086
|
+
readyToPromote?: RAGRetrievalPromotionReadiness;
|
|
4087
|
+
readyToPromoteByLane?: RAGRetrievalPromotionReadiness[];
|
|
4088
|
+
promotionCandidates?: RAGRetrievalPromotionCandidate[];
|
|
4089
|
+
releaseGroups?: RAGRetrievalReleaseGroupSummary[];
|
|
4090
|
+
releasePolicies?: RAGRetrievalReleasePolicySummary[];
|
|
4091
|
+
releaseLanePolicies?: RAGRetrievalReleaseLanePolicySummary[];
|
|
4092
|
+
releaseGatePolicies?: RAGRetrievalBaselineGatePolicySummary[];
|
|
4093
|
+
releaseTimelines?: RAGRetrievalReleaseTimelineSummary[];
|
|
4094
|
+
releaseLaneTimelines?: RAGRetrievalReleaseLaneTimelineSummary[];
|
|
4095
|
+
releaseLaneDecisions?: RAGRetrievalReleaseLaneDecisionSummary[];
|
|
4096
|
+
approvalScopes?: RAGRetrievalReleaseApprovalScopeSummary[];
|
|
4097
|
+
releaseLaneEscalationPolicies?: RAGRetrievalReleaseLaneEscalationPolicySummary[];
|
|
4098
|
+
releaseLaneAudits?: RAGRetrievalReleaseLaneAuditSummary[];
|
|
4099
|
+
releaseLaneRecommendations?: RAGRetrievalReleaseLaneRecommendationSummary[];
|
|
4100
|
+
releaseLaneIncidentSummaries?: RAGRetrievalReleaseLaneIncidentSummary[];
|
|
4101
|
+
releaseLaneHandoffs?: RAGRetrievalReleaseLaneHandoffSummary[];
|
|
4102
|
+
recentLaneHandoffDecisions?: RAGRetrievalLaneHandoffDecisionRecord[];
|
|
4103
|
+
recentLaneHandoffIncidents?: RAGRetrievalLaneHandoffIncidentRecord[];
|
|
4104
|
+
handoffFreshnessWindows?: RAGRetrievalLaneHandoffFreshnessWindow[];
|
|
4105
|
+
handoffAutoComplete?: RAGRetrievalLaneHandoffAutoCompleteSummary[];
|
|
4106
|
+
handoffAutoCompletePolicies?: RAGRetrievalLaneHandoffAutoCompletePolicySummary[];
|
|
4107
|
+
handoffAutoCompleteSafety?: RAGRetrievalLaneAutoCompleteSafetySummary[];
|
|
4108
|
+
handoffDriftRollups?: RAGRetrievalLaneHandoffDriftRollup[];
|
|
4109
|
+
handoffDriftCountsByLane?: RAGRetrievalLaneHandoffDriftCountByLane[];
|
|
4110
|
+
recentHandoffAutoCompletePolicyHistory?: RAGRetrievalLaneHandoffAutoCompletePolicyHistoryRecord[];
|
|
4111
|
+
recentReleaseLanePolicyHistory?: RAGRetrievalReleaseLanePolicyHistoryRecord[];
|
|
4112
|
+
recentBaselineGatePolicyHistory?: RAGRetrievalBaselineGatePolicyHistoryRecord[];
|
|
4113
|
+
recentReleaseLaneEscalationPolicyHistory?: RAGRetrievalReleaseLaneEscalationPolicyHistoryRecord[];
|
|
4114
|
+
recentLaneHandoffIncidentHistory?: RAGRetrievalLaneHandoffIncidentHistoryRecord[];
|
|
4115
|
+
recentIncidents?: RAGRetrievalReleaseIncidentRecord[];
|
|
4116
|
+
recentIncidentRemediationDecisions?: RAGRetrievalIncidentRemediationDecisionRecord[];
|
|
4117
|
+
recentIncidentRemediationExecutions?: RAGRetrievalIncidentRemediationExecutionHistoryRecord[];
|
|
4118
|
+
incidentRemediationExecutionSummary?: RAGRetrievalIncidentRemediationExecutionSummary;
|
|
4119
|
+
incidentSummary?: RAGRetrievalReleaseIncidentSummary;
|
|
4120
|
+
relatedSearchTraces?: RAGSearchTraceStats;
|
|
4121
|
+
relatedPruneRun?: RAGSearchTracePruneRun;
|
|
4122
|
+
};
|
|
4123
|
+
export type RAGCollection = {
|
|
4124
|
+
store: RAGVectorStore;
|
|
4125
|
+
search: (input: RAGCollectionSearchParams) => Promise<RAGQueryResult[]>;
|
|
4126
|
+
searchWithTrace: (input: RAGCollectionSearchParams) => Promise<RAGCollectionSearchResult>;
|
|
4127
|
+
ingest: (input: RAGUpsertInput) => Promise<void>;
|
|
4128
|
+
clear?: () => Promise<void> | void;
|
|
4129
|
+
getStatus?: () => RAGVectorStoreStatus;
|
|
4130
|
+
getCapabilities?: () => RAGBackendCapabilities;
|
|
4131
|
+
};
|
|
4132
|
+
export type RAGIndexManager = {
|
|
4133
|
+
listDocuments: (input?: {
|
|
4134
|
+
kind?: string;
|
|
4135
|
+
}) => Promise<RAGIndexedDocument[]> | RAGIndexedDocument[];
|
|
4136
|
+
createDocument?: (input: RAGIngestDocument) => Promise<RAGMutationResponse> | RAGMutationResponse;
|
|
4137
|
+
getDocumentChunks: (id: string) => Promise<RAGDocumentChunkPreview | null> | RAGDocumentChunkPreview | null;
|
|
4138
|
+
deleteDocument?: (id: string) => Promise<boolean> | boolean;
|
|
4139
|
+
reindexDocument?: (id: string) => Promise<RAGMutationResponse | void> | RAGMutationResponse | void;
|
|
4140
|
+
reindexSource?: (source: string) => Promise<RAGMutationResponse | void> | RAGMutationResponse | void;
|
|
4141
|
+
listSyncSources?: () => Promise<RAGSyncSourceRecord[]> | RAGSyncSourceRecord[];
|
|
4142
|
+
syncSource?: (id: string, options?: RAGSyncRunOptions) => Promise<RAGSyncResponse | void> | RAGSyncResponse | void;
|
|
4143
|
+
syncAllSources?: (options?: RAGSyncRunOptions) => Promise<RAGSyncResponse | void> | RAGSyncResponse | void;
|
|
4144
|
+
reseed?: () => Promise<RAGMutationResponse | void> | RAGMutationResponse | void;
|
|
4145
|
+
reset?: () => Promise<RAGMutationResponse | void> | RAGMutationResponse | void;
|
|
4146
|
+
listBackends?: () => Promise<Omit<RAGBackendsResponse, 'ok'> | RAGBackendDescriptor[]> | Omit<RAGBackendsResponse, 'ok'> | RAGBackendDescriptor[];
|
|
4147
|
+
};
|
|
4148
|
+
export type AITextChunk = {
|
|
4149
|
+
type: 'text';
|
|
4150
|
+
content: string;
|
|
4151
|
+
};
|
|
4152
|
+
export type AIToolUseChunk = {
|
|
4153
|
+
type: 'tool_use';
|
|
4154
|
+
id: string;
|
|
4155
|
+
name: string;
|
|
4156
|
+
input: unknown;
|
|
4157
|
+
};
|
|
4158
|
+
export type AIDoneChunk = {
|
|
4159
|
+
type: 'done';
|
|
4160
|
+
usage?: AIUsage;
|
|
4161
|
+
};
|
|
4162
|
+
export type AIThinkingChunk = {
|
|
4163
|
+
type: 'thinking';
|
|
4164
|
+
content: string;
|
|
4165
|
+
signature?: string;
|
|
4166
|
+
};
|
|
4167
|
+
export type AIImageChunk = {
|
|
4168
|
+
type: 'image';
|
|
4169
|
+
data: string;
|
|
4170
|
+
format: string;
|
|
4171
|
+
isPartial: boolean;
|
|
4172
|
+
revisedPrompt?: string;
|
|
4173
|
+
imageId?: string;
|
|
4174
|
+
};
|
|
4175
|
+
export type AIChunk = AITextChunk | AIThinkingChunk | AIToolUseChunk | AIImageChunk | AIDoneChunk;
|
|
4176
|
+
export type AIProviderStreamParams = {
|
|
4177
|
+
model: string;
|
|
4178
|
+
messages: AIProviderMessage[];
|
|
4179
|
+
tools?: AIProviderToolDefinition[];
|
|
4180
|
+
systemPrompt?: string;
|
|
4181
|
+
thinking?: {
|
|
4182
|
+
type: string;
|
|
4183
|
+
budget_tokens: number;
|
|
4184
|
+
};
|
|
4185
|
+
signal?: AbortSignal;
|
|
4186
|
+
};
|
|
4187
|
+
export type AIProviderMessage = {
|
|
4188
|
+
role: 'user' | 'assistant' | 'system';
|
|
4189
|
+
content: string | AIProviderContentBlock[];
|
|
4190
|
+
};
|
|
4191
|
+
export type AIImageSource = {
|
|
4192
|
+
type: 'base64';
|
|
4193
|
+
data: string;
|
|
4194
|
+
media_type: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
|
|
4195
|
+
};
|
|
4196
|
+
export type AIDocumentSource = {
|
|
4197
|
+
type: 'base64';
|
|
4198
|
+
data: string;
|
|
4199
|
+
media_type: 'application/pdf';
|
|
4200
|
+
};
|
|
4201
|
+
export type AIProviderContentBlock = {
|
|
4202
|
+
type: 'text';
|
|
4203
|
+
content: string;
|
|
4204
|
+
} | {
|
|
4205
|
+
type: 'thinking';
|
|
4206
|
+
thinking: string;
|
|
4207
|
+
signature?: string;
|
|
4208
|
+
} | {
|
|
4209
|
+
type: 'image';
|
|
4210
|
+
source: AIImageSource;
|
|
4211
|
+
} | {
|
|
4212
|
+
type: 'document';
|
|
4213
|
+
source: AIDocumentSource;
|
|
4214
|
+
name?: string;
|
|
4215
|
+
} | {
|
|
4216
|
+
type: 'tool_use';
|
|
4217
|
+
id: string;
|
|
4218
|
+
name: string;
|
|
4219
|
+
input: unknown;
|
|
4220
|
+
} | {
|
|
4221
|
+
type: 'tool_result';
|
|
4222
|
+
tool_use_id: string;
|
|
4223
|
+
content: string;
|
|
4224
|
+
};
|
|
4225
|
+
export type AIProviderToolDefinition = {
|
|
4226
|
+
name: string;
|
|
4227
|
+
description: string;
|
|
4228
|
+
input_schema: Record<string, unknown>;
|
|
4229
|
+
};
|
|
4230
|
+
export type AIProviderConfig = {
|
|
4231
|
+
stream: (params: AIProviderStreamParams) => AsyncIterable<AIChunk>;
|
|
4232
|
+
};
|
|
4233
|
+
export type AIToolDefinition = {
|
|
4234
|
+
description: string;
|
|
4235
|
+
input: Record<string, unknown>;
|
|
4236
|
+
handler: (input: unknown) => Promise<string> | string;
|
|
4237
|
+
};
|
|
4238
|
+
export type AIToolMap = Record<string, AIToolDefinition>;
|
|
4239
|
+
export type AIAttachment = {
|
|
4240
|
+
data: string;
|
|
4241
|
+
media_type: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'application/pdf';
|
|
4242
|
+
name?: string;
|
|
4243
|
+
};
|
|
4244
|
+
export type AIMessageRequest = {
|
|
4245
|
+
type: 'message';
|
|
4246
|
+
content: string;
|
|
4247
|
+
conversationId?: string;
|
|
4248
|
+
attachments?: AIAttachment[];
|
|
4249
|
+
};
|
|
4250
|
+
export type AICancelRequest = {
|
|
4251
|
+
type: 'cancel';
|
|
4252
|
+
conversationId: string;
|
|
4253
|
+
};
|
|
4254
|
+
export type AIBranchRequest = {
|
|
4255
|
+
type: 'branch';
|
|
4256
|
+
messageId: string;
|
|
4257
|
+
content: string;
|
|
4258
|
+
conversationId: string;
|
|
4259
|
+
};
|
|
4260
|
+
export type AIClientMessage = AIMessageRequest | AICancelRequest | AIBranchRequest;
|
|
4261
|
+
export type AIChunkMessage = {
|
|
4262
|
+
type: 'chunk';
|
|
4263
|
+
content: string;
|
|
4264
|
+
messageId: string;
|
|
4265
|
+
conversationId: string;
|
|
4266
|
+
};
|
|
4267
|
+
export type AIThinkingMessage = {
|
|
4268
|
+
type: 'thinking';
|
|
4269
|
+
content: string;
|
|
4270
|
+
messageId: string;
|
|
4271
|
+
conversationId: string;
|
|
4272
|
+
};
|
|
4273
|
+
export type AIToolStatusMessage = {
|
|
4274
|
+
type: 'tool_status';
|
|
4275
|
+
name: string;
|
|
4276
|
+
status: 'running' | 'complete';
|
|
4277
|
+
input?: unknown;
|
|
4278
|
+
result?: string;
|
|
4279
|
+
messageId: string;
|
|
4280
|
+
conversationId: string;
|
|
4281
|
+
};
|
|
4282
|
+
export type AICompleteMessage = {
|
|
4283
|
+
type: 'complete';
|
|
4284
|
+
durationMs?: number;
|
|
4285
|
+
messageId: string;
|
|
4286
|
+
model?: string;
|
|
4287
|
+
conversationId: string;
|
|
4288
|
+
usage?: AIUsage;
|
|
4289
|
+
sources?: RAGSource[];
|
|
4290
|
+
};
|
|
4291
|
+
export type StreamAICompleteMetadata = {
|
|
4292
|
+
sources?: RAGSource[];
|
|
4293
|
+
};
|
|
4294
|
+
export type AIImageMessage = {
|
|
4295
|
+
type: 'image';
|
|
4296
|
+
data: string;
|
|
4297
|
+
format: string;
|
|
4298
|
+
isPartial: boolean;
|
|
4299
|
+
revisedPrompt?: string;
|
|
4300
|
+
imageId?: string;
|
|
4301
|
+
messageId: string;
|
|
4302
|
+
conversationId: string;
|
|
4303
|
+
};
|
|
4304
|
+
export type AIErrorMessage = {
|
|
4305
|
+
type: 'error';
|
|
4306
|
+
message: string;
|
|
4307
|
+
messageId?: string;
|
|
4308
|
+
conversationId?: string;
|
|
4309
|
+
};
|
|
4310
|
+
export type AIRetrievingMessage = {
|
|
4311
|
+
type: 'rag_retrieving';
|
|
4312
|
+
conversationId: string;
|
|
4313
|
+
messageId: string;
|
|
4314
|
+
retrievalStartedAt: number;
|
|
4315
|
+
};
|
|
4316
|
+
export type AIRetrievedMessage = {
|
|
4317
|
+
type: 'rag_retrieved';
|
|
4318
|
+
conversationId: string;
|
|
4319
|
+
messageId: string;
|
|
4320
|
+
retrievalStartedAt?: number;
|
|
4321
|
+
retrievedAt: number;
|
|
4322
|
+
retrievalDurationMs?: number;
|
|
4323
|
+
sources: RAGSource[];
|
|
4324
|
+
trace?: RAGRetrievalTrace;
|
|
4325
|
+
};
|
|
4326
|
+
export type AIServerMessage = AIChunkMessage | AIThinkingMessage | AIToolStatusMessage | AIImageMessage | AICompleteMessage | AIRetrievingMessage | AIRetrievedMessage | AIErrorMessage;
|
|
4327
|
+
export type AIRole = 'user' | 'assistant' | 'system';
|
|
4328
|
+
export type AIToolCall = {
|
|
4329
|
+
id: string;
|
|
4330
|
+
name: string;
|
|
4331
|
+
input: unknown;
|
|
4332
|
+
result?: string;
|
|
4333
|
+
};
|
|
4334
|
+
export type AIImageData = {
|
|
4335
|
+
data: string;
|
|
4336
|
+
format: string;
|
|
4337
|
+
isPartial: boolean;
|
|
4338
|
+
revisedPrompt?: string;
|
|
4339
|
+
imageId?: string;
|
|
4340
|
+
};
|
|
4341
|
+
export type AIMessage = {
|
|
4342
|
+
id: string;
|
|
4343
|
+
role: AIRole;
|
|
4344
|
+
content: string;
|
|
4345
|
+
conversationId: string;
|
|
4346
|
+
parentId?: string;
|
|
4347
|
+
attachments?: AIAttachment[];
|
|
4348
|
+
thinking?: string;
|
|
4349
|
+
toolCalls?: AIToolCall[];
|
|
4350
|
+
images?: AIImageData[];
|
|
4351
|
+
isStreaming?: boolean;
|
|
4352
|
+
model?: string;
|
|
4353
|
+
usage?: AIUsage;
|
|
4354
|
+
sources?: RAGSource[];
|
|
4355
|
+
retrievalStartedAt?: number;
|
|
4356
|
+
retrievedAt?: number;
|
|
4357
|
+
retrievalDurationMs?: number;
|
|
4358
|
+
retrievalTrace?: RAGRetrievalTrace;
|
|
4359
|
+
durationMs?: number;
|
|
4360
|
+
timestamp: number;
|
|
4361
|
+
};
|
|
4362
|
+
export type AIConversation = {
|
|
4363
|
+
id: string;
|
|
4364
|
+
title?: string;
|
|
4365
|
+
messages: AIMessage[];
|
|
4366
|
+
activeStreamAbort?: AbortController;
|
|
4367
|
+
createdAt: number;
|
|
4368
|
+
lastMessageAt?: number;
|
|
4369
|
+
};
|
|
4370
|
+
export type AIConversationSummary = {
|
|
4371
|
+
id: string;
|
|
4372
|
+
title: string;
|
|
4373
|
+
messageCount: number;
|
|
4374
|
+
createdAt: number;
|
|
4375
|
+
lastMessageAt?: number;
|
|
4376
|
+
};
|
|
4377
|
+
export type StreamAIOptions = {
|
|
4378
|
+
provider: AIProviderConfig;
|
|
4379
|
+
model: string;
|
|
4380
|
+
messages?: AIProviderMessage[];
|
|
4381
|
+
systemPrompt?: string;
|
|
4382
|
+
tools?: AIToolMap;
|
|
4383
|
+
thinking?: boolean | {
|
|
4384
|
+
budgetTokens: number;
|
|
4385
|
+
};
|
|
4386
|
+
onChunk?: (chunk: AITextChunk) => AITextChunk | void;
|
|
4387
|
+
onComplete?: (fullResponse: string, usage?: AIUsage, metadata?: StreamAICompleteMetadata) => void;
|
|
4388
|
+
onToolUse?: (name: string, input: unknown, result: string) => void;
|
|
4389
|
+
onImage?: (imageData: AIImageData) => void;
|
|
4390
|
+
maxTurns?: number;
|
|
4391
|
+
signal?: AbortSignal;
|
|
4392
|
+
completeMeta?: StreamAICompleteMetadata;
|
|
4393
|
+
};
|
|
4394
|
+
export type AIStreamState = {
|
|
4395
|
+
conversations: Map<string, AIConversation>;
|
|
4396
|
+
activeConversationId: string | null;
|
|
4397
|
+
isStreaming: boolean;
|
|
4398
|
+
error: string | null;
|
|
4399
|
+
};
|
|
4400
|
+
export type AIStoreAction = {
|
|
4401
|
+
type: 'chunk';
|
|
4402
|
+
conversationId: string;
|
|
4403
|
+
messageId: string;
|
|
4404
|
+
content: string;
|
|
4405
|
+
} | {
|
|
4406
|
+
type: 'thinking';
|
|
4407
|
+
conversationId: string;
|
|
4408
|
+
messageId: string;
|
|
4409
|
+
content: string;
|
|
4410
|
+
} | {
|
|
4411
|
+
type: 'tool_status';
|
|
4412
|
+
conversationId: string;
|
|
4413
|
+
messageId: string;
|
|
4414
|
+
name: string;
|
|
4415
|
+
status: 'running' | 'complete';
|
|
4416
|
+
input?: unknown;
|
|
4417
|
+
result?: string;
|
|
4418
|
+
} | {
|
|
4419
|
+
type: 'complete';
|
|
4420
|
+
conversationId: string;
|
|
4421
|
+
durationMs?: number;
|
|
4422
|
+
messageId: string;
|
|
4423
|
+
model?: string;
|
|
4424
|
+
usage?: AIUsage;
|
|
4425
|
+
sources?: RAGSource[];
|
|
4426
|
+
} | {
|
|
4427
|
+
type: 'image';
|
|
4428
|
+
conversationId: string;
|
|
4429
|
+
messageId: string;
|
|
4430
|
+
data: string;
|
|
4431
|
+
format: string;
|
|
4432
|
+
isPartial: boolean;
|
|
4433
|
+
revisedPrompt?: string;
|
|
4434
|
+
imageId?: string;
|
|
4435
|
+
} | {
|
|
4436
|
+
type: 'error';
|
|
4437
|
+
message: string;
|
|
4438
|
+
} | {
|
|
4439
|
+
type: 'rag_retrieving';
|
|
4440
|
+
conversationId: string;
|
|
4441
|
+
messageId: string;
|
|
4442
|
+
retrievalStartedAt: number;
|
|
4443
|
+
} | {
|
|
4444
|
+
type: 'rag_retrieved';
|
|
4445
|
+
conversationId: string;
|
|
4446
|
+
messageId: string;
|
|
4447
|
+
retrievalStartedAt?: number;
|
|
4448
|
+
retrievedAt: number;
|
|
4449
|
+
retrievalDurationMs?: number;
|
|
4450
|
+
sources: RAGSource[];
|
|
4451
|
+
trace?: RAGRetrievalTrace;
|
|
4452
|
+
} | {
|
|
4453
|
+
type: 'send';
|
|
4454
|
+
content: string;
|
|
4455
|
+
conversationId: string;
|
|
4456
|
+
messageId: string;
|
|
4457
|
+
attachments?: AIAttachment[];
|
|
4458
|
+
} | {
|
|
4459
|
+
type: 'cancel';
|
|
4460
|
+
} | {
|
|
4461
|
+
type: 'branch';
|
|
4462
|
+
oldConversationId: string;
|
|
4463
|
+
newConversationId: string;
|
|
4464
|
+
fromMessageId: string;
|
|
4465
|
+
} | {
|
|
4466
|
+
type: 'set_conversation';
|
|
4467
|
+
conversationId: string;
|
|
4468
|
+
};
|
|
4469
|
+
export type AIWebSocket = {
|
|
4470
|
+
send(data: string): void;
|
|
4471
|
+
readyState: number;
|
|
4472
|
+
};
|
|
4473
|
+
export type AIConversationStore = SessionStore<AIConversation, AIConversationSummary>;
|
|
4474
|
+
export type AIHTMXRenderConfig = {
|
|
4475
|
+
messageStart?: (input: {
|
|
4476
|
+
conversationId: string;
|
|
4477
|
+
messageId: string;
|
|
4478
|
+
content: string;
|
|
4479
|
+
sseUrl: string;
|
|
4480
|
+
cancelUrl: string;
|
|
4481
|
+
}) => string;
|
|
4482
|
+
chunk?: (text: string, fullContent: string) => string;
|
|
4483
|
+
thinking?: (text: string) => string;
|
|
4484
|
+
toolRunning?: (name: string, input: unknown) => string;
|
|
4485
|
+
toolComplete?: (name: string, result: string) => string;
|
|
4486
|
+
image?: (data: string, format: string, revisedPrompt?: string) => string;
|
|
4487
|
+
ragRetrieving?: (input?: {
|
|
4488
|
+
conversationId: string;
|
|
4489
|
+
messageId: string;
|
|
4490
|
+
retrievalStartedAt?: number;
|
|
4491
|
+
}) => string;
|
|
4492
|
+
complete?: (usage?: AIUsage, durationMs?: number, model?: string) => string;
|
|
4493
|
+
ragRetrieved?: (sources: RAGSource[], input?: {
|
|
4494
|
+
conversationId: string;
|
|
4495
|
+
messageId: string;
|
|
4496
|
+
retrievalStartedAt?: number;
|
|
4497
|
+
retrievedAt?: number;
|
|
4498
|
+
retrievalDurationMs?: number;
|
|
4499
|
+
trace?: RAGRetrievalTrace;
|
|
4500
|
+
}) => string;
|
|
4501
|
+
canceled?: () => string;
|
|
4502
|
+
error?: (message: string) => string;
|
|
4503
|
+
};
|
|
4504
|
+
export type RAGHTMXWorkflowRenderConfig = {
|
|
4505
|
+
status?: (input: {
|
|
4506
|
+
admin?: RAGAdminCapabilities;
|
|
4507
|
+
adminActions?: RAGAdminActionRecord[];
|
|
4508
|
+
adminJobs?: RAGAdminJobRecord[];
|
|
4509
|
+
maintenance?: RAGBackendMaintenanceSummary;
|
|
4510
|
+
retrievalComparisons?: RAGOperationsResponse['retrievalComparisons'];
|
|
4511
|
+
path?: string;
|
|
4512
|
+
status?: RAGVectorStoreStatus;
|
|
4513
|
+
capabilities?: RAGBackendCapabilities;
|
|
4514
|
+
documents?: RAGDocumentSummary;
|
|
4515
|
+
}) => string;
|
|
4516
|
+
maintenance?: (input: {
|
|
4517
|
+
admin?: RAGAdminCapabilities;
|
|
4518
|
+
adminActions?: RAGAdminActionRecord[];
|
|
4519
|
+
adminJobs?: RAGAdminJobRecord[];
|
|
4520
|
+
maintenance?: RAGBackendMaintenanceSummary;
|
|
4521
|
+
path?: string;
|
|
4522
|
+
status?: RAGVectorStoreStatus;
|
|
4523
|
+
}) => string;
|
|
4524
|
+
searchResults?: (input: {
|
|
4525
|
+
query: string;
|
|
4526
|
+
results: RAGSource[];
|
|
4527
|
+
trace?: RAGRetrievalTrace;
|
|
4528
|
+
}) => string;
|
|
4529
|
+
searchResultItem?: (source: RAGSource, index: number) => string;
|
|
4530
|
+
documents?: (input: {
|
|
4531
|
+
documents: RAGIndexedDocument[];
|
|
4532
|
+
}) => string;
|
|
4533
|
+
documentItem?: (document: RAGIndexedDocument, index: number) => string;
|
|
4534
|
+
chunkPreview?: (input: RAGDocumentChunkPreview) => string;
|
|
4535
|
+
evaluateResult?: (input: {
|
|
4536
|
+
cases: RAGEvaluationCaseResult[];
|
|
4537
|
+
summary: RAGEvaluationSummary;
|
|
4538
|
+
}) => string;
|
|
4539
|
+
adaptiveNativePlannerBenchmark?: (input: RAGAdaptiveNativePlannerBenchmarkResponse) => string;
|
|
4540
|
+
nativeBackendComparisonBenchmark?: (input: RAGNativeBackendComparisonBenchmarkResponse) => string;
|
|
4541
|
+
adaptiveNativePlannerBenchmarkSnapshot?: (input: RAGAdaptiveNativePlannerBenchmarkSnapshotResponse) => string;
|
|
4542
|
+
nativeBackendComparisonBenchmarkSnapshot?: (input: RAGNativeBackendComparisonBenchmarkSnapshotResponse) => string;
|
|
4543
|
+
mutationResult?: (input: RAGMutationResponse) => string;
|
|
4544
|
+
emptyState?: (kind: 'documents' | 'searchResults' | 'chunkPreview' | 'status' | 'evaluation') => string;
|
|
4545
|
+
error?: (message: string) => string;
|
|
4546
|
+
};
|
|
4547
|
+
export type RAGHTMXConfig = {
|
|
4548
|
+
render?: AIHTMXRenderConfig;
|
|
4549
|
+
workflowRender?: RAGHTMXWorkflowRenderConfig;
|
|
4550
|
+
/** @deprecated Use workflowRender instead. */
|
|
4551
|
+
workflow?: {
|
|
4552
|
+
render?: RAGHTMXWorkflowRenderConfig;
|
|
4553
|
+
};
|
|
4554
|
+
};
|
|
4555
|
+
export type AIChatPluginConfig = {
|
|
4556
|
+
path?: string;
|
|
4557
|
+
provider: (providerName: string) => AIProviderConfig;
|
|
4558
|
+
model?: string | ((providerName: string) => string);
|
|
4559
|
+
tools?: AIToolMap | ((providerName: string, model: string) => AIToolMap | undefined);
|
|
4560
|
+
thinking?: boolean | {
|
|
4561
|
+
budgetTokens: number;
|
|
4562
|
+
} | ((providerName: string, model: string) => boolean | {
|
|
4563
|
+
budgetTokens: number;
|
|
4564
|
+
} | undefined);
|
|
4565
|
+
systemPrompt?: string;
|
|
4566
|
+
maxTurns?: number;
|
|
4567
|
+
parseProvider?: (content: string) => {
|
|
4568
|
+
content: string;
|
|
4569
|
+
model?: string;
|
|
4570
|
+
providerName: string;
|
|
4571
|
+
};
|
|
4572
|
+
onComplete?: (conversationId: string, fullResponse: string, usage?: AIUsage) => void;
|
|
4573
|
+
store?: AIConversationStore;
|
|
4574
|
+
htmx?: boolean | {
|
|
4575
|
+
render?: AIHTMXRenderConfig;
|
|
4576
|
+
};
|
|
4577
|
+
};
|
|
4578
|
+
export type RAGChatPluginConfig = AIChatPluginConfig & {
|
|
4579
|
+
path?: string;
|
|
4580
|
+
ragStore?: RAGVectorStore;
|
|
4581
|
+
collection?: RAGCollection;
|
|
4582
|
+
jobStateStore?: RAGJobStateStore;
|
|
4583
|
+
evaluationSuiteSnapshotHistoryStore?: RAGEvaluationSuiteSnapshotHistoryStore;
|
|
4584
|
+
authorizeRAGAction?: RAGAuthorizationProvider;
|
|
4585
|
+
resolveRAGAccessScope?: RAGAccessScopeProvider;
|
|
4586
|
+
jobHistoryRetention?: RAGJobHistoryRetention;
|
|
4587
|
+
searchTraceStore?: RAGSearchTraceStore;
|
|
4588
|
+
searchTraceRetention?: RAGSearchTracePruneInput;
|
|
4589
|
+
searchTraceRetentionSchedule?: RAGSearchTraceRetentionSchedule;
|
|
4590
|
+
searchTracePruneHistoryStore?: RAGSearchTracePruneHistoryStore;
|
|
4591
|
+
retrievalComparisonHistoryStore?: RAGRetrievalComparisonHistoryStore;
|
|
4592
|
+
retrievalBaselineStore?: RAGRetrievalBaselineStore;
|
|
4593
|
+
retrievalReleaseDecisionStore?: RAGRetrievalReleaseDecisionStore;
|
|
4594
|
+
retrievalLaneHandoffDecisionStore?: RAGRetrievalLaneHandoffDecisionStore;
|
|
4595
|
+
retrievalLaneHandoffIncidentStore?: RAGRetrievalLaneHandoffIncidentStore;
|
|
4596
|
+
retrievalLaneHandoffIncidentHistoryStore?: RAGRetrievalLaneHandoffIncidentHistoryStore;
|
|
4597
|
+
retrievalLaneHandoffAutoCompletePolicyHistoryStore?: RAGRetrievalLaneHandoffAutoCompletePolicyHistoryStore;
|
|
4598
|
+
retrievalReleaseLanePolicyHistoryStore?: RAGRetrievalReleaseLanePolicyHistoryStore;
|
|
4599
|
+
retrievalBaselineGatePolicyHistoryStore?: RAGRetrievalBaselineGatePolicyHistoryStore;
|
|
4600
|
+
retrievalReleaseLaneEscalationPolicyHistoryStore?: RAGRetrievalReleaseLaneEscalationPolicyHistoryStore;
|
|
4601
|
+
retrievalReleaseIncidentStore?: RAGRetrievalReleaseIncidentStore;
|
|
4602
|
+
retrievalIncidentRemediationDecisionStore?: RAGRetrievalIncidentRemediationDecisionStore;
|
|
4603
|
+
retrievalIncidentRemediationExecutionHistoryStore?: RAGRetrievalIncidentRemediationExecutionHistoryStore;
|
|
4604
|
+
retrievalLaneHandoffAutoCompletePoliciesByGroupAndTargetRolloutLabel?: Record<string, Partial<Record<Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>, RAGRetrievalLaneHandoffAutoCompletePolicy>>>;
|
|
4605
|
+
retrievalReleasePolicies?: Record<string, RAGRetrievalReleasePolicy>;
|
|
4606
|
+
retrievalReleasePoliciesByRolloutLabel?: Partial<Record<Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>, RAGRetrievalReleasePolicy>>;
|
|
4607
|
+
retrievalReleasePoliciesByGroupAndRolloutLabel?: Record<string, Partial<Record<Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>, RAGRetrievalReleasePolicy>>>;
|
|
4608
|
+
retrievalBaselineGatePoliciesByRolloutLabel?: Partial<Record<Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>, RAGRetrievalBaselineGatePolicy>>;
|
|
4609
|
+
retrievalBaselineGatePoliciesByGroup?: Record<string, RAGRetrievalBaselineGatePolicy>;
|
|
4610
|
+
retrievalBaselineGatePoliciesByGroupAndRolloutLabel?: Record<string, Partial<Record<Exclude<RAGRetrievalBaselineRecord['rolloutLabel'], undefined>, RAGRetrievalBaselineGatePolicy>>>;
|
|
4611
|
+
onRetrievalReleaseEvent?: (event: RAGRetrievalReleaseEvent) => void | Promise<void>;
|
|
4612
|
+
extractors?: RAGFileExtractor[];
|
|
4613
|
+
embedding?: RAGEmbeddingProviderLike;
|
|
4614
|
+
embeddingModel?: string;
|
|
4615
|
+
readinessProviderName?: string;
|
|
4616
|
+
rerank?: RAGRerankerProviderLike;
|
|
4617
|
+
indexManager?: RAGIndexManager;
|
|
4618
|
+
topK?: number;
|
|
4619
|
+
scoreThreshold?: number;
|
|
4620
|
+
staleAfterMs?: number;
|
|
4621
|
+
ragCompleteSources?: boolean;
|
|
4622
|
+
systemPrompt?: string;
|
|
4623
|
+
htmx?: boolean | RAGHTMXConfig;
|
|
4624
|
+
onComplete?: (conversationId: string, fullResponse: string, usage?: AIUsage, sources?: RAGSource[]) => void;
|
|
4625
|
+
};
|
|
4626
|
+
export type AIConnectionOptions = {
|
|
4627
|
+
protocols?: string[];
|
|
4628
|
+
reconnect?: boolean;
|
|
4629
|
+
pingInterval?: number;
|
|
4630
|
+
maxReconnectAttempts?: number;
|
|
4631
|
+
};
|