@absolutejs/rag 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/index.js +73 -1
- package/dist/angular/index.js.map +4 -4
- package/dist/client/index.js +91 -14
- package/dist/client/index.js.map +4 -4
- package/dist/client/ui.js +19 -14
- package/dist/client/ui.js.map +3 -3
- package/dist/index.js +99 -15
- package/dist/index.js.map +4 -4
- package/dist/presentation/ui.js +19 -14
- package/dist/presentation/ui.js.map +3 -3
- package/dist/quality/quality.js +19 -14
- package/dist/quality/quality.js.map +3 -3
- package/dist/react/index.js +103 -1
- package/dist/react/index.js.map +5 -5
- package/dist/src/chat/chat.d.ts +30 -2
- package/dist/src/client/ragClient.d.ts +12 -1
- package/dist/src/quality/quality.d.ts +6 -1
- package/dist/src/react/useRAG.d.ts +12 -0
- package/dist/src/react/useRAGEvaluate.d.ts +13 -1
- package/dist/svelte/index.js +73 -1
- package/dist/svelte/index.js.map +4 -4
- package/dist/vue/index.js +73 -1
- package/dist/vue/index.js.map +4 -4
- package/package.json +1 -1
package/dist/src/chat/chat.d.ts
CHANGED
|
@@ -1014,6 +1014,34 @@ export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
};
|
|
1016
1016
|
};
|
|
1017
|
+
} & {
|
|
1018
|
+
[x: string]: {
|
|
1019
|
+
evaluate: {
|
|
1020
|
+
stream: {
|
|
1021
|
+
post: {
|
|
1022
|
+
body: unknown;
|
|
1023
|
+
params: {};
|
|
1024
|
+
query: unknown;
|
|
1025
|
+
headers: unknown;
|
|
1026
|
+
response: {
|
|
1027
|
+
200: AsyncGenerator<{
|
|
1028
|
+
readonly data: string;
|
|
1029
|
+
readonly event: "error";
|
|
1030
|
+
} | {
|
|
1031
|
+
readonly data: string;
|
|
1032
|
+
readonly event: "start";
|
|
1033
|
+
} | {
|
|
1034
|
+
readonly data: string;
|
|
1035
|
+
readonly event: "case";
|
|
1036
|
+
} | {
|
|
1037
|
+
readonly data: string;
|
|
1038
|
+
readonly event: "result";
|
|
1039
|
+
}, void, unknown>;
|
|
1040
|
+
};
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
};
|
|
1017
1045
|
} & {
|
|
1018
1046
|
[x: string]: {
|
|
1019
1047
|
status: {
|
|
@@ -1226,7 +1254,7 @@ export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
|
1226
1254
|
};
|
|
1227
1255
|
};
|
|
1228
1256
|
};
|
|
1229
|
-
} & {
|
|
1257
|
+
} & ({
|
|
1230
1258
|
[x: string]: {
|
|
1231
1259
|
status: {
|
|
1232
1260
|
handoffs: {
|
|
@@ -1261,7 +1289,7 @@ export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
|
1261
1289
|
};
|
|
1262
1290
|
};
|
|
1263
1291
|
};
|
|
1264
|
-
} &
|
|
1292
|
+
} & {
|
|
1265
1293
|
[x: string]: {
|
|
1266
1294
|
ops: {
|
|
1267
1295
|
get: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RAGBackendsResponse, RAGDocumentChunksResponse, RAGEvaluationInput, RAGEvaluationResponse, RAGRetrievalBaselinePromotionFromRunRequest, RAGRetrievalBaselinePromotionRequest, RAGRetrievalBaselineRevertRequest, RAGRetrievalReleaseIncidentAcknowledgeRequest, RAGRetrievalReleaseDecisionActionRequest, RAGRetrievalBaselineResponse, RAGRetrievalLaneHandoffDecisionRequest, RAGRetrievalLaneHandoffDecisionResponse, RAGRetrievalLaneHandoffIncidentStatusResponse, RAGRetrievalLaneHandoffStatusResponse, RAGRetrievalIncidentRemediationDecisionRequest, RAGRetrievalIncidentRemediationBulkExecutionRequest, RAGRetrievalIncidentRemediationExecutionRequest, RAGRetrievalIncidentRemediationExecutionResponse, RAGRetrievalIncidentRemediationStatusResponse, RAGRetrievalReleaseGroupHistoryResponse, RAGRetrievalReleaseIncidentStatusResponse, RAGRetrievalReleaseDriftStatusResponse, RAGRetrievalComparisonRequest, RAGAdaptiveNativePlannerBenchmarkResponse, RAGAdaptiveNativePlannerBenchmarkSnapshotResponse, RAGDocumentIngestInput, RAGDocumentChunk, RAGDocumentsResponse, RAGDocumentUrlIngestInput, RAGDocumentUploadIngestInput, RAGIngestResponse, RAGMutationResponse, RAGOperationsResponse, RAGSearchRequest, RAGSearchTracePruneResponse, RAGSource, RAGStatusResponse, RAGSyncRunOptions, RAGSyncResponse } from "@absolutejs/ai";
|
|
1
|
+
import type { RAGBackendsResponse, RAGDocumentChunksResponse, RAGEvaluationCaseResult, RAGEvaluationInput, RAGEvaluationResponse, RAGRetrievalBaselinePromotionFromRunRequest, RAGRetrievalBaselinePromotionRequest, RAGRetrievalBaselineRevertRequest, RAGRetrievalReleaseIncidentAcknowledgeRequest, RAGRetrievalReleaseDecisionActionRequest, RAGRetrievalBaselineResponse, RAGRetrievalLaneHandoffDecisionRequest, RAGRetrievalLaneHandoffDecisionResponse, RAGRetrievalLaneHandoffIncidentStatusResponse, RAGRetrievalLaneHandoffStatusResponse, RAGRetrievalIncidentRemediationDecisionRequest, RAGRetrievalIncidentRemediationBulkExecutionRequest, RAGRetrievalIncidentRemediationExecutionRequest, RAGRetrievalIncidentRemediationExecutionResponse, RAGRetrievalIncidentRemediationStatusResponse, RAGRetrievalReleaseGroupHistoryResponse, RAGRetrievalReleaseIncidentStatusResponse, RAGRetrievalReleaseDriftStatusResponse, RAGRetrievalComparisonRequest, RAGAdaptiveNativePlannerBenchmarkResponse, RAGAdaptiveNativePlannerBenchmarkSnapshotResponse, RAGDocumentIngestInput, RAGDocumentChunk, RAGDocumentsResponse, RAGDocumentUrlIngestInput, RAGDocumentUploadIngestInput, RAGIngestResponse, RAGMutationResponse, RAGOperationsResponse, RAGSearchRequest, RAGSearchTracePruneResponse, RAGSource, RAGStatusResponse, RAGSyncRunOptions, RAGSyncResponse } from "@absolutejs/ai";
|
|
2
2
|
import type { RAGClientOptions, RAGDetailedSearchResponse, RAGMaintenanceOverview, RAGMaintenancePayload } from "../../types/client";
|
|
3
3
|
export declare const buildRAGMaintenanceOverview: (payload: RAGMaintenancePayload) => RAGMaintenanceOverview;
|
|
4
4
|
export declare const createRAGClient: (options: RAGClientOptions) => {
|
|
@@ -11,6 +11,17 @@ export declare const createRAGClient: (options: RAGClientOptions) => {
|
|
|
11
11
|
documentChunks(id: string): Promise<RAGDocumentChunksResponse>;
|
|
12
12
|
documents(kind?: string): Promise<RAGDocumentsResponse>;
|
|
13
13
|
evaluate(input: RAGEvaluationInput): Promise<RAGEvaluationResponse>;
|
|
14
|
+
evaluateStream(input: RAGEvaluationInput, options?: {
|
|
15
|
+
onStart?: (event: {
|
|
16
|
+
total: number;
|
|
17
|
+
}) => void;
|
|
18
|
+
onCase?: (event: {
|
|
19
|
+
caseIndex: number;
|
|
20
|
+
total: number;
|
|
21
|
+
caseResult: RAGEvaluationCaseResult;
|
|
22
|
+
}) => void;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): Promise<RAGEvaluationResponse>;
|
|
14
25
|
compareRetrievals(input: RAGRetrievalComparisonRequest): Promise<import("@absolutejs/ai").RAGRetrievalComparison>;
|
|
15
26
|
retrievalComparisonHistory(input?: {
|
|
16
27
|
limit?: number;
|
|
@@ -461,11 +461,16 @@ export declare const buildRAGEvaluationSuiteSnapshotDiff: ({ current, previous,
|
|
|
461
461
|
current: RAGEvaluationSuiteSnapshot;
|
|
462
462
|
previous?: RAGEvaluationSuiteSnapshot;
|
|
463
463
|
}) => RAGEvaluationSuiteSnapshotDiff;
|
|
464
|
-
export declare const evaluateRAGCollection: ({ collection, input, defaultTopK, rerank, }: {
|
|
464
|
+
export declare const evaluateRAGCollection: ({ collection, input, defaultTopK, rerank, onCaseSettled, }: {
|
|
465
465
|
collection: RAGCollection;
|
|
466
466
|
input: RAGEvaluationInput;
|
|
467
467
|
defaultTopK?: number;
|
|
468
468
|
rerank?: RAGRerankerProviderLike;
|
|
469
|
+
onCaseSettled?: (event: {
|
|
470
|
+
caseIndex: number;
|
|
471
|
+
total: number;
|
|
472
|
+
caseResult: RAGEvaluationCaseResult;
|
|
473
|
+
}) => void;
|
|
469
474
|
}) => Promise<RAGEvaluationResponse>;
|
|
470
475
|
export declare const executeDryRunRAGEvaluation: (input: RAGEvaluationInput, defaultTopK?: number) => RAGEvaluationCaseResult[];
|
|
471
476
|
export declare const runRAGEvaluationSuite: ({ suite, evaluate, overrides, artifacts, }: {
|
|
@@ -42,6 +42,14 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
42
42
|
clearRuns: () => void;
|
|
43
43
|
error: string | null;
|
|
44
44
|
evaluate: (input: import("@absolutejs/ai").RAGEvaluationInput) => Promise<import("@absolutejs/ai").RAGEvaluationResponse>;
|
|
45
|
+
evaluateStream: (input: import("@absolutejs/ai").RAGEvaluationInput, options?: {
|
|
46
|
+
onCase?: (event: {
|
|
47
|
+
caseIndex: number;
|
|
48
|
+
total: number;
|
|
49
|
+
caseResult: import("@absolutejs/ai").RAGEvaluationCaseResult;
|
|
50
|
+
}) => void;
|
|
51
|
+
signal?: AbortSignal;
|
|
52
|
+
}) => Promise<import("@absolutejs/ai").RAGEvaluationResponse>;
|
|
45
53
|
isEvaluating: boolean;
|
|
46
54
|
lastRequest: import("@absolutejs/ai").RAGEvaluationInput | null;
|
|
47
55
|
lastResponse: import("@absolutejs/ai").RAGEvaluationResponse | null;
|
|
@@ -61,6 +69,10 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
61
69
|
traceSummary: import("@absolutejs/ai").RAGRetrievalTraceComparisonSummary | undefined;
|
|
62
70
|
}>;
|
|
63
71
|
saveSuite: (suite: import("@absolutejs/ai").RAGEvaluationSuite) => import("@absolutejs/ai").RAGEvaluationSuite;
|
|
72
|
+
streamProgress: {
|
|
73
|
+
done: number;
|
|
74
|
+
total: number;
|
|
75
|
+
} | null;
|
|
64
76
|
suiteRuns: import("@absolutejs/ai").RAGEvaluationSuiteRun[];
|
|
65
77
|
suites: import("@absolutejs/ai").RAGEvaluationSuite[];
|
|
66
78
|
};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type { RAGEvaluationInput, RAGEvaluationResponse, RAGEvaluationSuite, RAGEvaluationSuiteRun } from "@absolutejs/ai";
|
|
1
|
+
import type { RAGEvaluationCaseResult, RAGEvaluationInput, RAGEvaluationResponse, RAGEvaluationSuite, RAGEvaluationSuiteRun } from "@absolutejs/ai";
|
|
2
2
|
export declare const useRAGEvaluate: (path: string) => {
|
|
3
3
|
clearRuns: () => void;
|
|
4
4
|
error: string | null;
|
|
5
5
|
evaluate: (input: RAGEvaluationInput) => Promise<RAGEvaluationResponse>;
|
|
6
|
+
evaluateStream: (input: RAGEvaluationInput, options?: {
|
|
7
|
+
onCase?: (event: {
|
|
8
|
+
caseIndex: number;
|
|
9
|
+
total: number;
|
|
10
|
+
caseResult: RAGEvaluationCaseResult;
|
|
11
|
+
}) => void;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}) => Promise<RAGEvaluationResponse>;
|
|
6
14
|
isEvaluating: boolean;
|
|
7
15
|
lastRequest: RAGEvaluationInput | null;
|
|
8
16
|
lastResponse: RAGEvaluationResponse | null;
|
|
@@ -22,6 +30,10 @@ export declare const useRAGEvaluate: (path: string) => {
|
|
|
22
30
|
traceSummary: import("@absolutejs/ai").RAGRetrievalTraceComparisonSummary | undefined;
|
|
23
31
|
}>;
|
|
24
32
|
saveSuite: (suite: RAGEvaluationSuite) => RAGEvaluationSuite;
|
|
33
|
+
streamProgress: {
|
|
34
|
+
done: number;
|
|
35
|
+
total: number;
|
|
36
|
+
} | null;
|
|
25
37
|
suiteRuns: RAGEvaluationSuiteRun[];
|
|
26
38
|
suites: RAGEvaluationSuite[];
|
|
27
39
|
};
|
package/dist/svelte/index.js
CHANGED
|
@@ -194,6 +194,78 @@ var createRAGClient = (options) => {
|
|
|
194
194
|
}
|
|
195
195
|
return parseJson(response);
|
|
196
196
|
},
|
|
197
|
+
async evaluateStream(input, options2) {
|
|
198
|
+
const response = await fetchImpl(`${basePath}/evaluate/stream`, {
|
|
199
|
+
body: JSON.stringify(input),
|
|
200
|
+
headers: jsonHeaders,
|
|
201
|
+
method: "POST",
|
|
202
|
+
signal: options2?.signal
|
|
203
|
+
});
|
|
204
|
+
if (!response.ok || !response.body) {
|
|
205
|
+
throw new Error(await toErrorMessage(response));
|
|
206
|
+
}
|
|
207
|
+
const reader = response.body.getReader();
|
|
208
|
+
const decoder = new TextDecoder;
|
|
209
|
+
let buffer = "";
|
|
210
|
+
let result = null;
|
|
211
|
+
let streamError = null;
|
|
212
|
+
const handleEvent = (rawEvent) => {
|
|
213
|
+
let eventName = "message";
|
|
214
|
+
const dataLines = [];
|
|
215
|
+
for (const line of rawEvent.split(`
|
|
216
|
+
`)) {
|
|
217
|
+
if (line.startsWith("event:")) {
|
|
218
|
+
eventName = line.slice("event:".length).trim();
|
|
219
|
+
} else if (line.startsWith("data:")) {
|
|
220
|
+
dataLines.push(line.slice("data:".length).trim());
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (dataLines.length === 0) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const payload = JSON.parse(dataLines.join(`
|
|
227
|
+
`));
|
|
228
|
+
if (eventName === "start") {
|
|
229
|
+
options2?.onStart?.(payload);
|
|
230
|
+
} else if (eventName === "case") {
|
|
231
|
+
options2?.onCase?.(payload);
|
|
232
|
+
} else if (eventName === "result") {
|
|
233
|
+
result = payload;
|
|
234
|
+
} else if (eventName === "error") {
|
|
235
|
+
streamError = payload.error ?? "RAG evaluation stream failed";
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
for (;; ) {
|
|
239
|
+
const { done, value } = await reader.read();
|
|
240
|
+
if (done) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
buffer += decoder.decode(value, { stream: true });
|
|
244
|
+
let separator = buffer.indexOf(`
|
|
245
|
+
|
|
246
|
+
`);
|
|
247
|
+
while (separator !== -1) {
|
|
248
|
+
const rawEvent = buffer.slice(0, separator);
|
|
249
|
+
buffer = buffer.slice(separator + 2);
|
|
250
|
+
if (rawEvent.trim().length > 0) {
|
|
251
|
+
handleEvent(rawEvent);
|
|
252
|
+
}
|
|
253
|
+
separator = buffer.indexOf(`
|
|
254
|
+
|
|
255
|
+
`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (buffer.trim().length > 0) {
|
|
259
|
+
handleEvent(buffer);
|
|
260
|
+
}
|
|
261
|
+
if (streamError) {
|
|
262
|
+
throw new Error(streamError);
|
|
263
|
+
}
|
|
264
|
+
if (!result) {
|
|
265
|
+
throw new Error("RAG evaluation stream ended without a result");
|
|
266
|
+
}
|
|
267
|
+
return result;
|
|
268
|
+
},
|
|
197
269
|
async compareRetrievals(input) {
|
|
198
270
|
const response = await fetchImpl(`${basePath}/compare/retrieval`, {
|
|
199
271
|
body: JSON.stringify(input),
|
|
@@ -4929,5 +5001,5 @@ export {
|
|
|
4929
5001
|
createRAG
|
|
4930
5002
|
};
|
|
4931
5003
|
|
|
4932
|
-
//# debugId=
|
|
5004
|
+
//# debugId=0C820FFEEA16A64064756E2164756E21
|
|
4933
5005
|
//# sourceMappingURL=index.js.map
|