@absolutejs/absolute 0.19.0-beta.527 → 0.19.0-beta.529
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/client/index.js +18 -3
- package/dist/ai/client/index.js.map +4 -4
- package/dist/ai/index.js +194 -20
- package/dist/ai/index.js.map +6 -6
- package/dist/ai-client/angular/ai/index.js +17 -2
- package/dist/ai-client/react/ai/index.js +17 -2
- package/dist/ai-client/vue/ai/index.js +17 -2
- package/dist/angular/ai/index.js +18 -3
- package/dist/angular/ai/index.js.map +4 -4
- package/dist/react/ai/index.js +18 -3
- package/dist/react/ai/index.js.map +4 -4
- package/dist/src/ai/client/ragClient.d.ts +6 -1
- package/dist/src/ai/rag/chat.d.ts +2 -6
- package/dist/src/ai/rag/presentation.d.ts +2 -1
- package/dist/src/vue/ai/useRAG.d.ts +2 -0
- package/dist/src/vue/ai/useRAGSearch.d.ts +2 -0
- package/dist/svelte/ai/index.js +18 -3
- package/dist/svelte/ai/index.js.map +4 -4
- package/dist/types/ai.d.ts +45 -1
- package/dist/vue/ai/index.js +18 -3
- package/dist/vue/ai/index.js.map +4 -4
- package/package.json +7 -7
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { RAGBackendsResponse, RAGDocumentChunksResponse, RAGEvaluationInput, RAGEvaluationResponse, RAGDocumentIngestInput, RAGDocumentChunk, RAGDocumentsResponse, RAGDocumentUrlIngestInput, RAGDocumentUploadIngestInput, RAGIngestResponse, RAGMutationResponse, RAGOperationsResponse, RAGSearchRequest, RAGSource, RAGStatusResponse, RAGSyncRunOptions, RAGSyncResponse } from '../../../types/ai';
|
|
1
|
+
import type { RAGBackendsResponse, RAGDocumentChunksResponse, RAGEvaluationInput, RAGEvaluationResponse, RAGDocumentIngestInput, RAGDocumentChunk, RAGDocumentsResponse, RAGDocumentUrlIngestInput, RAGDocumentUploadIngestInput, RAGIngestResponse, RAGMutationResponse, RAGOperationsResponse, RAGSearchRequest, RAGSearchResponse, RAGSource, RAGStatusResponse, RAGSyncRunOptions, RAGSyncResponse } from '../../../types/ai';
|
|
2
2
|
type FetchLike = typeof fetch;
|
|
3
3
|
export type RAGClientOptions = {
|
|
4
4
|
path: string;
|
|
5
5
|
fetch?: FetchLike;
|
|
6
6
|
};
|
|
7
|
+
export type RAGDetailedSearchResponse = {
|
|
8
|
+
results: RAGSource[];
|
|
9
|
+
trace?: RAGSearchResponse['trace'];
|
|
10
|
+
};
|
|
7
11
|
export declare const createRAGClient: (options: RAGClientOptions) => {
|
|
8
12
|
backends(): Promise<RAGBackendsResponse>;
|
|
9
13
|
clearIndex(): Promise<{
|
|
@@ -27,6 +31,7 @@ export declare const createRAGClient: (options: RAGClientOptions) => {
|
|
|
27
31
|
reseed(): Promise<RAGMutationResponse>;
|
|
28
32
|
reset(): Promise<RAGMutationResponse>;
|
|
29
33
|
search(input: RAGSearchRequest): Promise<RAGSource[]>;
|
|
34
|
+
searchDetailed(input: RAGSearchRequest): Promise<RAGDetailedSearchResponse>;
|
|
30
35
|
status(): Promise<RAGStatusResponse>;
|
|
31
36
|
};
|
|
32
37
|
export type RAGClient = ReturnType<typeof createRAGClient>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type { AIMessage, RAGEvaluationResponse, RAGBackendsResponse, RAGDocumentChunksResponse, RAGDocumentsResponse, RAGChatPluginConfig, RAGMutationResponse, RAGOperationsResponse,
|
|
2
|
+
import type { AIMessage, RAGEvaluationResponse, RAGBackendsResponse, RAGDocumentChunksResponse, RAGDocumentsResponse, RAGChatPluginConfig, RAGMutationResponse, RAGOperationsResponse, RAGSearchResponse, RAGSyncResponse } from '../../../types/ai';
|
|
3
3
|
export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {};
|
|
@@ -34,11 +34,7 @@ export declare const ragChat: (config: RAGChatPluginConfig) => Elysia<"", {
|
|
|
34
34
|
query: unknown;
|
|
35
35
|
headers: unknown;
|
|
36
36
|
response: {
|
|
37
|
-
200: Response |
|
|
38
|
-
ok: boolean;
|
|
39
|
-
results?: RAGSource[];
|
|
40
|
-
error?: string;
|
|
41
|
-
};
|
|
37
|
+
200: Response | RAGSearchResponse;
|
|
42
38
|
};
|
|
43
39
|
};
|
|
44
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AIMessage, RAGAnswerWorkflowState, RAGCitation, RAGCitationReferenceMap, RAGGroundedAnswer, RAGGroundingReference, RAGSourceSummary, RAGStreamStage, RAGSource, RAGSourceGroup } from '../../../types/ai';
|
|
1
|
+
import type { AIMessage, RAGAnswerWorkflowState, RAGCitation, RAGCitationReferenceMap, RAGGroundedAnswer, RAGGroundingReference, RAGRetrievalTrace, RAGSourceSummary, RAGStreamStage, RAGSource, RAGSourceGroup } from '../../../types/ai';
|
|
2
2
|
export declare const buildRAGCitationReferenceMap: (citations: RAGCitation[]) => RAGCitationReferenceMap;
|
|
3
3
|
export declare const buildRAGCitations: (sources: RAGSource[]) => RAGCitation[];
|
|
4
4
|
export declare const buildRAGGroundedAnswer: (content: string, sources: RAGSource[]) => RAGGroundedAnswer;
|
|
@@ -12,6 +12,7 @@ export declare const buildRAGRetrievedState: (messages: AIMessage[]) => {
|
|
|
12
12
|
retrievalDurationMs: number | undefined;
|
|
13
13
|
retrievalStartedAt: number | undefined;
|
|
14
14
|
retrievedAt: number | undefined;
|
|
15
|
+
trace: RAGRetrievalTrace | undefined;
|
|
15
16
|
sourceGroups: RAGSourceGroup[];
|
|
16
17
|
sourceSummaries: RAGSourceSummary[];
|
|
17
18
|
sources: RAGSource[];
|
|
@@ -908,6 +908,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
908
908
|
vectorWeight?: number | undefined;
|
|
909
909
|
} | undefined;
|
|
910
910
|
model?: string | undefined;
|
|
911
|
+
includeTrace?: boolean | undefined;
|
|
911
912
|
} | null, import("../..").RAGSearchRequest | {
|
|
912
913
|
filter?: Record<string, unknown> | undefined;
|
|
913
914
|
query: string;
|
|
@@ -928,6 +929,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
|
|
|
928
929
|
vectorWeight?: number | undefined;
|
|
929
930
|
} | undefined;
|
|
930
931
|
model?: string | undefined;
|
|
932
|
+
includeTrace?: boolean | undefined;
|
|
931
933
|
} | null>;
|
|
932
934
|
reset: () => void;
|
|
933
935
|
results: import("vue").Ref<{
|
|
@@ -23,6 +23,7 @@ export declare const useRAGSearch: (path: string) => {
|
|
|
23
23
|
vectorWeight?: number | undefined;
|
|
24
24
|
} | undefined;
|
|
25
25
|
model?: string | undefined;
|
|
26
|
+
includeTrace?: boolean | undefined;
|
|
26
27
|
} | null, RAGSearchRequest | {
|
|
27
28
|
filter?: Record<string, unknown> | undefined;
|
|
28
29
|
query: string;
|
|
@@ -43,6 +44,7 @@ export declare const useRAGSearch: (path: string) => {
|
|
|
43
44
|
vectorWeight?: number | undefined;
|
|
44
45
|
} | undefined;
|
|
45
46
|
model?: string | undefined;
|
|
47
|
+
includeTrace?: boolean | undefined;
|
|
46
48
|
} | null>;
|
|
47
49
|
reset: () => void;
|
|
48
50
|
results: import("vue").Ref<{
|
package/dist/svelte/ai/index.js
CHANGED
|
@@ -1032,8 +1032,12 @@ var createRAGClient = (options) => {
|
|
|
1032
1032
|
return parseJson(response);
|
|
1033
1033
|
},
|
|
1034
1034
|
async search(input) {
|
|
1035
|
+
const result = await this.searchDetailed(input);
|
|
1036
|
+
return result.results;
|
|
1037
|
+
},
|
|
1038
|
+
async searchDetailed(input) {
|
|
1035
1039
|
const response = await fetchImpl(`${basePath}/search`, {
|
|
1036
|
-
body: JSON.stringify(input),
|
|
1040
|
+
body: JSON.stringify({ ...input, includeTrace: true }),
|
|
1037
1041
|
headers: jsonHeaders,
|
|
1038
1042
|
method: "POST"
|
|
1039
1043
|
});
|
|
@@ -1044,7 +1048,10 @@ var createRAGClient = (options) => {
|
|
|
1044
1048
|
if (!payload.ok) {
|
|
1045
1049
|
throw new Error(payload.error ?? "RAG search failed");
|
|
1046
1050
|
}
|
|
1047
|
-
return
|
|
1051
|
+
return {
|
|
1052
|
+
results: payload.results ?? [],
|
|
1053
|
+
trace: payload.trace
|
|
1054
|
+
};
|
|
1048
1055
|
},
|
|
1049
1056
|
async status() {
|
|
1050
1057
|
const response = await fetchImpl(`${basePath}/status`);
|
|
@@ -1101,6 +1108,13 @@ var buildSourceGroupKey = (source) => source.source ?? source.title ?? source.ch
|
|
|
1101
1108
|
var buildSourceLabel = (source) => source.source ?? source.title ?? source.chunkId;
|
|
1102
1109
|
var getContextNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
1103
1110
|
var getContextString = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
1111
|
+
var isRAGRetrievalTrace = (value) => {
|
|
1112
|
+
if (!value || typeof value !== "object") {
|
|
1113
|
+
return false;
|
|
1114
|
+
}
|
|
1115
|
+
const candidate = value;
|
|
1116
|
+
return typeof candidate.query === "string" && typeof candidate.transformedQuery === "string" && Array.isArray(candidate.variantQueries) && Array.isArray(candidate.steps);
|
|
1117
|
+
};
|
|
1104
1118
|
var formatTimestampLabel = (value) => {
|
|
1105
1119
|
const timestamp = typeof value === "number" && Number.isFinite(value) ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
1106
1120
|
if (!Number.isFinite(timestamp)) {
|
|
@@ -1368,6 +1382,7 @@ var buildRAGRetrievedState = (messages) => {
|
|
|
1368
1382
|
retrievalDurationMs: message.retrievalDurationMs,
|
|
1369
1383
|
retrievalStartedAt: message.retrievalStartedAt,
|
|
1370
1384
|
retrievedAt: message.retrievedAt,
|
|
1385
|
+
trace: isRAGRetrievalTrace(message.retrievalTrace) ? message.retrievalTrace : undefined,
|
|
1371
1386
|
sourceGroups: buildRAGSourceGroups(sources),
|
|
1372
1387
|
sourceSummaries: buildRAGSourceSummaries(sources),
|
|
1373
1388
|
sources
|
|
@@ -3291,5 +3306,5 @@ export {
|
|
|
3291
3306
|
createAIStream
|
|
3292
3307
|
};
|
|
3293
3308
|
|
|
3294
|
-
//# debugId=
|
|
3309
|
+
//# debugId=53E52BBF03C706BF64756E2164756E21
|
|
3295
3310
|
//# sourceMappingURL=index.js.map
|