@absolutejs/rag 0.0.27 → 0.0.28
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/adapter-kit/index.js +119 -3
- package/dist/adapter-kit/index.js.map +3 -3
- package/dist/index.js +121 -3
- package/dist/index.js.map +3 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/retrieval/collection.d.ts +3 -1
- package/dist/types/engine.d.ts +82 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { buildRAGEvaluationLeaderboard, buildRAGEvaluationResponse, buildRAGEval
|
|
|
18
18
|
export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingEntityQualityPresentation, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkExcerpts, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGCorpusHealthPresentation, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationEntityQualityPresentation, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows, buildRAGEvaluationSuiteSnapshotHistoryPresentation, buildRAGEvaluationSuiteSnapshotPresentations, buildRAGEvaluationSuiteSnapshotRows, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGGroundingReferences, buildRAGQualityOverviewPresentation, buildRAGReadinessPresentation, buildRAGSourceLabels, buildRAGSectionRetrievalDiagnostics, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGRerankerOverviewPresentation, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalTracePresentation, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations, } from "./presentation/ui";
|
|
19
19
|
export { createRAGBunS3SyncClient, createRAGDirectorySyncSource, createRAGEmailSyncSource, createRAGFeedSyncSource, createRAGFileSyncStateStore, createRAGGitHubSyncSource, createRAGLinkedConnectorSyncSource, createRAGLinkedGmailEmailSyncSource, createRAGSiteDiscoverySyncSource, createRAGSitemapSyncSource, createRAGStaticEmailSyncClient, previewRAGSyncConflictResolutions, previewRAGSyncExtractionRecovery, resolveRAGSyncExtractionRecovery, resolveRAGSyncConflictResolutions, createRAGStorageSyncSource, createRAGSyncManager, createRAGSyncScheduler, createRAGUrlSyncSource, } from "./sync/sync";
|
|
20
20
|
export { createRAGFileJobStateStore } from "./internal/jobState";
|
|
21
|
-
export { createRAGCollection, ingestDocuments, ingestRAGDocuments, searchDocuments, } from "./retrieval/collection";
|
|
21
|
+
export { createRAGCollection, ingestDocuments, ingestRAGDocuments, ingestRAGSource, removeRAGSource, searchDocuments, } from "./retrieval/collection";
|
|
22
22
|
export { createInMemoryRAGStore } from "./adapters/inMemory";
|
|
23
23
|
export { createSyncRAGStore } from "./adapters/sync";
|
|
24
24
|
export type { SyncRAGStore } from "./adapters/sync";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { RAGCollection, RAGCollectionSearchParams, RAGDocumentIngestInput, RAGQueryResult, RAGUpsertInput } from "../../types/engine";
|
|
1
|
+
import type { RAGCollection, RAGCollectionSearchParams, RAGDocumentIngestInput, RAGIngestSourceInput, RAGIngestSourceResult, RAGQueryResult, RAGRemoveSourceInput, RAGRemoveSourceResult, RAGUpsertInput } from "../../types/engine";
|
|
2
2
|
import type { CreateRAGCollectionOptions } from "../../types/retrieval";
|
|
3
3
|
export declare const createRAGCollection: (options: CreateRAGCollectionOptions) => RAGCollection;
|
|
4
4
|
export declare const ingestDocuments: (collection: RAGCollection, input: RAGUpsertInput) => Promise<void>;
|
|
5
5
|
export declare const ingestRAGDocuments: (collection: RAGCollection, input: RAGDocumentIngestInput) => Promise<void>;
|
|
6
6
|
export declare const searchDocuments: (collection: RAGCollection, input: RAGCollectionSearchParams) => Promise<RAGQueryResult[]>;
|
|
7
|
+
export declare const ingestRAGSource: (collection: RAGCollection, input: RAGIngestSourceInput) => Promise<RAGIngestSourceResult>;
|
|
8
|
+
export declare const removeRAGSource: (collection: RAGCollection, input: RAGRemoveSourceInput) => Promise<RAGRemoveSourceResult>;
|
package/dist/types/engine.d.ts
CHANGED
|
@@ -277,10 +277,19 @@ export type RAGDocumentChunkEmbeddingVariant = {
|
|
|
277
277
|
metadata?: Record<string, unknown>;
|
|
278
278
|
embedding?: number[];
|
|
279
279
|
};
|
|
280
|
+
export type RAGEmbeddingKind = "query" | "passage";
|
|
280
281
|
export type RAGEmbeddingInput = {
|
|
281
282
|
text: string;
|
|
282
283
|
model?: string;
|
|
283
284
|
signal?: AbortSignal;
|
|
285
|
+
/**
|
|
286
|
+
* Asymmetric-embedding hint for providers that distinguish how the input is
|
|
287
|
+
* used (e.g. Pinecone Inference `input_type`, Cohere `input_type`, voyage
|
|
288
|
+
* `input_type`). The collection passes `"query"` when embedding a search
|
|
289
|
+
* query and `"passage"` when embedding a chunk/document for ingestion.
|
|
290
|
+
* Providers that do not support asymmetric embedding ignore this field.
|
|
291
|
+
*/
|
|
292
|
+
kind?: RAGEmbeddingKind;
|
|
284
293
|
};
|
|
285
294
|
export type RAGEmbeddingFunction = (input: RAGEmbeddingInput) => Promise<number[]>;
|
|
286
295
|
export type RAGEmbeddingProvider = {
|
|
@@ -4195,11 +4204,84 @@ export type RAGRetrievalComparisonRuntime = {
|
|
|
4195
4204
|
relatedSearchTraces?: RAGSearchTraceStats;
|
|
4196
4205
|
relatedPruneRun?: RAGSearchTracePruneRun;
|
|
4197
4206
|
};
|
|
4207
|
+
export type RAGIngestSourceInput = {
|
|
4208
|
+
/**
|
|
4209
|
+
* Stable identifier the consumer owns for this document/source. All chunk ids
|
|
4210
|
+
* are derived deterministically from it (`${sourceId}#${index}`) and it is
|
|
4211
|
+
* stamped into every chunk's metadata as `sourceId`, so the whole set can be
|
|
4212
|
+
* deleted or replaced later without the consumer tracking individual ids.
|
|
4213
|
+
*/
|
|
4214
|
+
sourceId: string;
|
|
4215
|
+
/** Ingest from in-memory file bytes (any extractor-supported type). */
|
|
4216
|
+
upload?: RAGDocumentUploadInput;
|
|
4217
|
+
/** Ingest from a URL (fetched + extracted by content type). */
|
|
4218
|
+
url?: RAGDocumentUrlInput;
|
|
4219
|
+
/** Ingest from an already-extracted text document. */
|
|
4220
|
+
document?: RAGIngestDocument;
|
|
4221
|
+
/** Extra metadata merged into every chunk (alongside `sourceId`). */
|
|
4222
|
+
metadata?: Record<string, unknown>;
|
|
4223
|
+
/** Chunking options applied to this source. */
|
|
4224
|
+
chunking?: RAGChunkingOptions;
|
|
4225
|
+
chunkingRegistry?: RAGChunkingRegistryLike;
|
|
4226
|
+
/** Custom file extractors (for upload/url ingest). */
|
|
4227
|
+
extractors?: RAGFileExtractor[];
|
|
4228
|
+
extractorRegistry?: RAGFileExtractorRegistryLike;
|
|
4229
|
+
/**
|
|
4230
|
+
* Override the embedding `kind` used for the chunks. Defaults to `"passage"`
|
|
4231
|
+
* so asymmetric embedders index document text with the document/passage
|
|
4232
|
+
* embedding while search continues to use the query embedding.
|
|
4233
|
+
*/
|
|
4234
|
+
embedKind?: RAGEmbeddingKind;
|
|
4235
|
+
/**
|
|
4236
|
+
* Whether to remove any existing chunks for this sourceId before ingesting
|
|
4237
|
+
* (idempotent replace). Defaults to `true`.
|
|
4238
|
+
*/
|
|
4239
|
+
replace?: boolean;
|
|
4240
|
+
/**
|
|
4241
|
+
* Chunk count from a prior ingest of this sourceId. Used when replacing on
|
|
4242
|
+
* stores that cannot metadata-filter-delete, so the previous deterministic id
|
|
4243
|
+
* set is removed even if the new ingest produces fewer chunks.
|
|
4244
|
+
*/
|
|
4245
|
+
previousChunkCount?: number;
|
|
4246
|
+
};
|
|
4247
|
+
export type RAGIngestSourceResult = {
|
|
4248
|
+
sourceId: string;
|
|
4249
|
+
chunkCount: number;
|
|
4250
|
+
chunkIds: string[];
|
|
4251
|
+
};
|
|
4252
|
+
export type RAGRemoveSourceInput = {
|
|
4253
|
+
sourceId: string;
|
|
4254
|
+
/**
|
|
4255
|
+
* Number of chunks the source produced (from `RAGIngestSourceResult`).
|
|
4256
|
+
* Required to delete by deterministic id on stores that cannot
|
|
4257
|
+
* metadata-filter-delete (e.g. Pinecone serverless).
|
|
4258
|
+
*/
|
|
4259
|
+
chunkCount?: number;
|
|
4260
|
+
/** Explicit chunk ids to delete (takes precedence over `chunkCount`). */
|
|
4261
|
+
chunkIds?: string[];
|
|
4262
|
+
/**
|
|
4263
|
+
* Also issue a metadata-filter delete on `{ sourceId }`. Defaults to `true`;
|
|
4264
|
+
* harmless (and cheap) on filter-capable stores, ignored when unsupported.
|
|
4265
|
+
*/
|
|
4266
|
+
filterDelete?: boolean;
|
|
4267
|
+
};
|
|
4268
|
+
export type RAGRemoveSourceResult = {
|
|
4269
|
+
sourceId: string;
|
|
4270
|
+
deleted: number;
|
|
4271
|
+
};
|
|
4198
4272
|
export type RAGCollection = {
|
|
4199
4273
|
store: RAGVectorStore;
|
|
4200
4274
|
search: (input: RAGCollectionSearchParams) => Promise<RAGQueryResult[]>;
|
|
4201
4275
|
searchWithTrace: (input: RAGCollectionSearchParams) => Promise<RAGCollectionSearchResult>;
|
|
4202
4276
|
ingest: (input: RAGUpsertInput) => Promise<void>;
|
|
4277
|
+
/**
|
|
4278
|
+
* Ingest a single document as a tracked source: extract → chunk → embed with
|
|
4279
|
+
* the passage/document kind → upsert with deterministic, source-derived chunk
|
|
4280
|
+
* ids. Returns the ids/count so the set is deletable via `removeSource`.
|
|
4281
|
+
*/
|
|
4282
|
+
ingestSource: (input: RAGIngestSourceInput) => Promise<RAGIngestSourceResult>;
|
|
4283
|
+
/** Delete every chunk previously ingested under `sourceId`. */
|
|
4284
|
+
removeSource: (input: RAGRemoveSourceInput) => Promise<RAGRemoveSourceResult>;
|
|
4203
4285
|
clear?: () => Promise<void> | void;
|
|
4204
4286
|
getStatus?: () => RAGVectorStoreStatus;
|
|
4205
4287
|
getCapabilities?: () => RAGBackendCapabilities;
|