@absolutejs/rag 0.0.27 → 0.0.29

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.
@@ -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";
@@ -0,0 +1,2 @@
1
+ import type { CreateRAGCollectionOptions, RAGCollection } from "../types";
2
+ export declare const manifest: import("@absolutejs/manifest").PackageManifest<CreateRAGCollectionOptions, RAGCollection>;
@@ -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>;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/rag",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "homepage": "https://github.com/absolutejs/rag",
5
5
  "bugs": {
6
6
  "url": "https://github.com/absolutejs/rag/issues"
@@ -54,12 +54,22 @@
54
54
  "./angular": {
55
55
  "import": "./dist/angular/index.js",
56
56
  "types": "./dist/src/angular/index.d.ts"
57
- }
57
+ },
58
+ "./manifest": {
59
+ "import": "./dist/manifest.js",
60
+ "types": "./dist/src/manifest.d.ts"
61
+ },
62
+ "./manifest.json": "./dist/manifest.json"
63
+ },
64
+ "absolutejs": {
65
+ "manifestContract": 1
58
66
  },
59
67
  "dependencies": {
60
68
  "@absolutejs/ai": "^0.0.19",
61
69
  "@absolutejs/linked-providers": "0.0.2",
62
- "@absolutejs/sync": "^1.8.1"
70
+ "@absolutejs/manifest": "^0.1.0",
71
+ "@absolutejs/sync": "^1.8.1",
72
+ "@sinclair/typebox": "^0.34.0"
63
73
  },
64
74
  "peerDependencies": {
65
75
  "@angular/core": "^21.0.0",
@@ -104,7 +114,7 @@
104
114
  "vue": "3.5.27"
105
115
  },
106
116
  "scripts": {
107
- "build": "bun run scripts/build.ts",
117
+ "build": "bun run scripts/build.ts && absolute-manifest emit",
108
118
  "config": "absolute config",
109
119
  "typecheck": "tsc --noEmit --project tsconfig.json",
110
120
  "lint": "eslint . --max-warnings 0",
@@ -143,6 +153,9 @@
143
153
  ],
144
154
  "angular": [
145
155
  "dist/src/angular/index.d.ts"
156
+ ],
157
+ "manifest": [
158
+ "dist/src/manifest.d.ts"
146
159
  ]
147
160
  }
148
161
  }