@ontos-ai/knowhere-sdk 0.10.0 → 2.1.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 +119 -25
- package/dist/index.d.mts +756 -390
- package/dist/index.d.ts +756 -390
- package/dist/index.js +2057 -56
- package/dist/index.mjs +2053 -55
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -118,176 +118,6 @@ interface JobResult {
|
|
|
118
118
|
readonly isFailed: boolean;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* Parsing model options
|
|
123
|
-
*/
|
|
124
|
-
type ParsingModel = 'base' | 'advanced';
|
|
125
|
-
/**
|
|
126
|
-
* Document type options
|
|
127
|
-
*/
|
|
128
|
-
type DocType = 'auto' | 'pdf' | 'docx' | 'txt' | 'md';
|
|
129
|
-
/**
|
|
130
|
-
* Parsing configuration parameters
|
|
131
|
-
*/
|
|
132
|
-
interface ParsingParams {
|
|
133
|
-
/** Parsing model to use (default: 'base') */
|
|
134
|
-
model?: ParsingModel;
|
|
135
|
-
/** Enable OCR for scanned documents (default: false) */
|
|
136
|
-
ocrEnabled?: boolean;
|
|
137
|
-
/** Knowledge base directory */
|
|
138
|
-
kbDir?: string;
|
|
139
|
-
/** Document type hint (default: 'auto') */
|
|
140
|
-
docType?: DocType;
|
|
141
|
-
/** Enable smart title parsing (default: false) */
|
|
142
|
-
smartTitleParse?: boolean;
|
|
143
|
-
/** Generate image summaries (default: false) */
|
|
144
|
-
summaryImage?: boolean;
|
|
145
|
-
/** Generate table summaries (default: false) */
|
|
146
|
-
summaryTable?: boolean;
|
|
147
|
-
/** Generate text summaries (default: false) */
|
|
148
|
-
summaryTxt?: boolean;
|
|
149
|
-
/** Additional fragment description */
|
|
150
|
-
addFragDesc?: string;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Webhook configuration
|
|
154
|
-
*/
|
|
155
|
-
interface WebhookConfig {
|
|
156
|
-
/** Webhook URL to notify on job completion */
|
|
157
|
-
url: string;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Client-provided display metadata copied onto the published document.
|
|
161
|
-
*/
|
|
162
|
-
type DocumentMetadata = Record<string, unknown>;
|
|
163
|
-
/**
|
|
164
|
-
* Job creation parameters
|
|
165
|
-
*/
|
|
166
|
-
interface CreateJobParams {
|
|
167
|
-
/** Source type: 'file' for upload, 'url' for remote document */
|
|
168
|
-
sourceType: 'file' | 'url';
|
|
169
|
-
/** Source URL (required if sourceType is 'url') */
|
|
170
|
-
sourceUrl?: string;
|
|
171
|
-
/** File name (required if sourceType is 'file') */
|
|
172
|
-
fileName?: string;
|
|
173
|
-
/** Optional custom data identifier */
|
|
174
|
-
dataId?: string;
|
|
175
|
-
/** Retrieval namespace for the canonical document */
|
|
176
|
-
namespace?: string;
|
|
177
|
-
/** Existing document identifier when updating a published document */
|
|
178
|
-
documentId?: string;
|
|
179
|
-
/** Display metadata to copy onto the published document */
|
|
180
|
-
documentMetadata?: DocumentMetadata;
|
|
181
|
-
/** Parsing configuration */
|
|
182
|
-
parsingParams?: ParsingParams;
|
|
183
|
-
/** Webhook configuration */
|
|
184
|
-
webhook?: WebhookConfig;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* File upload parameters
|
|
188
|
-
*/
|
|
189
|
-
interface UploadParams {
|
|
190
|
-
/** File to upload (path, Buffer, Stream, or Uint8Array) */
|
|
191
|
-
file: string | Buffer | ReadStream | Uint8Array;
|
|
192
|
-
/** Upload progress callback */
|
|
193
|
-
onProgress?: (progress: UploadProgress) => void;
|
|
194
|
-
/** Abort signal for cancellation */
|
|
195
|
-
signal?: AbortSignal;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Wait options for polling
|
|
199
|
-
*/
|
|
200
|
-
interface WaitOptions {
|
|
201
|
-
/** Polling interval in milliseconds (default: 10000) */
|
|
202
|
-
pollInterval?: number;
|
|
203
|
-
/** Maximum wait time in milliseconds (default: 1800000 = 30 minutes) */
|
|
204
|
-
pollTimeout?: number;
|
|
205
|
-
/** Progress callback */
|
|
206
|
-
onProgress?: (status: PollProgress) => void;
|
|
207
|
-
/** Abort signal for cancellation */
|
|
208
|
-
signal?: AbortSignal;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Load options for result parsing
|
|
212
|
-
*/
|
|
213
|
-
interface LoadOptions {
|
|
214
|
-
/** Whether to verify ZIP checksum (default: true) */
|
|
215
|
-
verifyChecksum?: boolean;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* High-level parse parameters
|
|
219
|
-
*/
|
|
220
|
-
interface ParseParams {
|
|
221
|
-
/** Source URL (mutually exclusive with file) */
|
|
222
|
-
url?: string;
|
|
223
|
-
/** File to parse (path, Buffer, Stream, or Uint8Array) */
|
|
224
|
-
file?: string | Buffer | ReadStream | Uint8Array;
|
|
225
|
-
/** File name (auto-inferred for file paths and fs.ReadStream with a path) */
|
|
226
|
-
fileName?: string;
|
|
227
|
-
/** Parsing model (default: 'base') */
|
|
228
|
-
model?: ParsingModel;
|
|
229
|
-
/** Enable OCR (default: false) */
|
|
230
|
-
ocr?: boolean;
|
|
231
|
-
/** Document type hint */
|
|
232
|
-
docType?: DocType;
|
|
233
|
-
/** Enable smart title parsing */
|
|
234
|
-
smartTitleParse?: boolean;
|
|
235
|
-
/** Generate image summaries */
|
|
236
|
-
summaryImage?: boolean;
|
|
237
|
-
/** Generate table summaries */
|
|
238
|
-
summaryTable?: boolean;
|
|
239
|
-
/** Generate text summaries */
|
|
240
|
-
summaryTxt?: boolean;
|
|
241
|
-
/** Custom data identifier */
|
|
242
|
-
dataId?: string;
|
|
243
|
-
/** Retrieval namespace for the canonical document */
|
|
244
|
-
namespace?: string;
|
|
245
|
-
/** Existing document identifier when updating a published document */
|
|
246
|
-
documentId?: string;
|
|
247
|
-
/** Display metadata to copy onto the published document */
|
|
248
|
-
documentMetadata?: DocumentMetadata;
|
|
249
|
-
/** Additional fragment description */
|
|
250
|
-
addFragDesc?: string;
|
|
251
|
-
/** Knowledge base directory */
|
|
252
|
-
kbDir?: string;
|
|
253
|
-
/** Polling interval in milliseconds */
|
|
254
|
-
pollInterval?: number;
|
|
255
|
-
/** Maximum wait time in milliseconds */
|
|
256
|
-
pollTimeout?: number;
|
|
257
|
-
/** Whether to verify ZIP checksum (default: true) */
|
|
258
|
-
verifyChecksum?: boolean;
|
|
259
|
-
/** Webhook configuration */
|
|
260
|
-
webhook?: WebhookConfig;
|
|
261
|
-
/** Upload progress callback */
|
|
262
|
-
onUploadProgress?: (progress: UploadProgress) => void;
|
|
263
|
-
/** Poll progress callback */
|
|
264
|
-
onPollProgress?: (status: PollProgress) => void;
|
|
265
|
-
/** Abort signal */
|
|
266
|
-
signal?: AbortSignal;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Upload progress information
|
|
270
|
-
*/
|
|
271
|
-
interface UploadProgress {
|
|
272
|
-
/** Bytes uploaded */
|
|
273
|
-
loaded: number;
|
|
274
|
-
/** Total bytes (may be undefined for streams) */
|
|
275
|
-
total?: number;
|
|
276
|
-
/** Upload percentage (0-100) */
|
|
277
|
-
percent: number;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Polling progress information
|
|
281
|
-
*/
|
|
282
|
-
interface PollProgress {
|
|
283
|
-
/** Current job status */
|
|
284
|
-
status: JobStatus;
|
|
285
|
-
/** Elapsed time in seconds */
|
|
286
|
-
elapsedSeconds: number;
|
|
287
|
-
/** Current job result */
|
|
288
|
-
jobResult: JobResult;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
121
|
/**
|
|
292
122
|
* Statistics about the parsed document
|
|
293
123
|
*/
|
|
@@ -300,6 +130,8 @@ interface Statistics {
|
|
|
300
130
|
imageChunks: number;
|
|
301
131
|
/** Number of table chunks */
|
|
302
132
|
tableChunks: number;
|
|
133
|
+
/** Number of page chunks */
|
|
134
|
+
pageChunks?: number;
|
|
303
135
|
/** Total number of pages (if applicable) */
|
|
304
136
|
totalPages?: number;
|
|
305
137
|
}
|
|
@@ -417,6 +249,7 @@ interface DocNav {
|
|
|
417
249
|
interface ChunkMetadata {
|
|
418
250
|
length?: number;
|
|
419
251
|
pageNums?: number[];
|
|
252
|
+
entities?: Record<string, unknown>[];
|
|
420
253
|
tokens?: string[];
|
|
421
254
|
keywords?: string[];
|
|
422
255
|
summary?: string;
|
|
@@ -435,7 +268,9 @@ interface BaseChunk {
|
|
|
435
268
|
/** Unique chunk identifier */
|
|
436
269
|
chunkId: string;
|
|
437
270
|
/** Chunk type */
|
|
438
|
-
type: 'text' | 'image' | 'table';
|
|
271
|
+
type: 'text' | 'image' | 'table' | 'page';
|
|
272
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
273
|
+
contentSource?: string;
|
|
439
274
|
/** Main content */
|
|
440
275
|
content: string;
|
|
441
276
|
/** Relative path in ZIP */
|
|
@@ -447,7 +282,7 @@ interface BaseChunk {
|
|
|
447
282
|
* Minimal chunk representation emitted in chunks_slim.json (legacy).
|
|
448
283
|
*/
|
|
449
284
|
interface SlimChunk {
|
|
450
|
-
type: 'text' | 'image' | 'table';
|
|
285
|
+
type: 'text' | 'image' | 'table' | 'page';
|
|
451
286
|
path: string;
|
|
452
287
|
content: string;
|
|
453
288
|
}
|
|
@@ -464,6 +299,8 @@ interface ImageChunk extends BaseChunk {
|
|
|
464
299
|
type: 'image';
|
|
465
300
|
/** Relative file path in ZIP */
|
|
466
301
|
filePath: string;
|
|
302
|
+
/** Application-owned or server-provided display URL for the image asset. */
|
|
303
|
+
assetUrl?: string;
|
|
467
304
|
/** Image data buffer */
|
|
468
305
|
data: Buffer;
|
|
469
306
|
/** Image format (derived from file extension) */
|
|
@@ -472,63 +309,581 @@ interface ImageChunk extends BaseChunk {
|
|
|
472
309
|
save(directory: string): Promise<string>;
|
|
473
310
|
}
|
|
474
311
|
/**
|
|
475
|
-
* Table chunk
|
|
312
|
+
* Table chunk
|
|
313
|
+
*/
|
|
314
|
+
interface TableChunk extends BaseChunk {
|
|
315
|
+
type: 'table';
|
|
316
|
+
/** Relative file path in ZIP */
|
|
317
|
+
filePath: string;
|
|
318
|
+
/** Application-owned or server-provided display URL for the table asset. */
|
|
319
|
+
assetUrl?: string;
|
|
320
|
+
/** HTML representation */
|
|
321
|
+
html: string;
|
|
322
|
+
/** Save table HTML to disk */
|
|
323
|
+
save(directory: string): Promise<string>;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Page chunk
|
|
327
|
+
*/
|
|
328
|
+
interface PageChunk extends BaseChunk {
|
|
329
|
+
type: 'page';
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Union type of all chunk types
|
|
333
|
+
*/
|
|
334
|
+
type Chunk = TextChunk | ImageChunk | TableChunk | PageChunk;
|
|
335
|
+
/**
|
|
336
|
+
* Complete parse result
|
|
337
|
+
*/
|
|
338
|
+
interface ParseResult {
|
|
339
|
+
/** Manifest metadata */
|
|
340
|
+
manifest: Manifest;
|
|
341
|
+
/** All chunks */
|
|
342
|
+
chunks: Chunk[];
|
|
343
|
+
/** Document navigation tree from doc_nav.json (current worker output) */
|
|
344
|
+
docNav?: DocNav;
|
|
345
|
+
/** Full document as Markdown (if available) */
|
|
346
|
+
fullMarkdown?: string;
|
|
347
|
+
/** Raw ZIP buffer */
|
|
348
|
+
rawZip: Buffer;
|
|
349
|
+
/** @deprecated Current worker no longer emits chunks_slim.json */
|
|
350
|
+
chunksSlim?: SlimChunk[];
|
|
351
|
+
/** @deprecated Current worker no longer emits hierarchy.json */
|
|
352
|
+
hierarchy?: unknown;
|
|
353
|
+
/** @deprecated Table-of-contents hierarchy hints (if available) */
|
|
354
|
+
tocHierarchies?: unknown;
|
|
355
|
+
/** @deprecated Knowledge-base CSV export (if available) */
|
|
356
|
+
kbCsv?: string;
|
|
357
|
+
/** @deprecated Pre-rendered hierarchy HTML view (if available) */
|
|
358
|
+
hierarchyViewHtml?: string;
|
|
359
|
+
/** Text chunks only */
|
|
360
|
+
readonly textChunks: TextChunk[];
|
|
361
|
+
/** Image chunks only */
|
|
362
|
+
readonly imageChunks: ImageChunk[];
|
|
363
|
+
/** Table chunks only */
|
|
364
|
+
readonly tableChunks: TableChunk[];
|
|
365
|
+
/** Page chunks only */
|
|
366
|
+
readonly pageChunks: PageChunk[];
|
|
367
|
+
/** Job ID */
|
|
368
|
+
readonly jobId: string;
|
|
369
|
+
/** Effective retrieval namespace when loaded from a job result */
|
|
370
|
+
namespace?: string;
|
|
371
|
+
/** Canonical document identifier when loaded from a job result */
|
|
372
|
+
documentId?: string;
|
|
373
|
+
/** Statistics */
|
|
374
|
+
readonly statistics: Statistics;
|
|
375
|
+
/** Find a specific chunk by ID */
|
|
376
|
+
getChunk(chunkId: string): Chunk | undefined;
|
|
377
|
+
/** Save all results to a directory */
|
|
378
|
+
save(directory: string): Promise<string>;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Canonical document state returned by document lifecycle endpoints.
|
|
383
|
+
*/
|
|
384
|
+
interface Document {
|
|
385
|
+
/** Stable document identifier */
|
|
386
|
+
documentId: string;
|
|
387
|
+
/** Retrieval namespace */
|
|
388
|
+
namespace: string;
|
|
389
|
+
/** Current lifecycle status */
|
|
390
|
+
status: string;
|
|
391
|
+
/** Current published job result identifier */
|
|
392
|
+
currentJobResultId?: string;
|
|
393
|
+
/** Original source file name */
|
|
394
|
+
sourceFileName?: string;
|
|
395
|
+
/** Client-provided display metadata copied from the publishing job */
|
|
396
|
+
documentMetadata?: Record<string, unknown>;
|
|
397
|
+
/** Document creation timestamp */
|
|
398
|
+
createdAt?: Date;
|
|
399
|
+
/** Last update timestamp */
|
|
400
|
+
updatedAt?: Date;
|
|
401
|
+
/** Archive timestamp, when archived */
|
|
402
|
+
archivedAt?: Date;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Pagination metadata returned by document list endpoints.
|
|
406
|
+
*/
|
|
407
|
+
interface DocumentListPagination {
|
|
408
|
+
/** Current page number */
|
|
409
|
+
page: number;
|
|
410
|
+
/** Number of items requested per page */
|
|
411
|
+
pageSize: number;
|
|
412
|
+
/** Total matching documents */
|
|
413
|
+
total: number;
|
|
414
|
+
/** Total number of pages */
|
|
415
|
+
totalPages: number;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Query parameters for GET /v2/documents.
|
|
419
|
+
*/
|
|
420
|
+
interface DocumentListParams {
|
|
421
|
+
/** Retrieval namespace */
|
|
422
|
+
namespace?: string;
|
|
423
|
+
/** Page number (default: 1) */
|
|
424
|
+
page?: number;
|
|
425
|
+
/** Items per page (default: 50, maximum: 200) */
|
|
426
|
+
pageSize?: number;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Response from GET /v2/documents.
|
|
430
|
+
*/
|
|
431
|
+
interface DocumentListResponse {
|
|
432
|
+
/** Namespace listed by the API */
|
|
433
|
+
namespace: string;
|
|
434
|
+
/** Documents visible in the namespace */
|
|
435
|
+
documents: Document[];
|
|
436
|
+
/** Pagination metadata */
|
|
437
|
+
pagination: DocumentListPagination;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Document chunk types supported by document chunk endpoints.
|
|
441
|
+
*/
|
|
442
|
+
type DocumentChunkType = 'text' | 'image' | 'table' | 'page';
|
|
443
|
+
/**
|
|
444
|
+
* Pagination metadata returned by chunk list endpoints.
|
|
445
|
+
*/
|
|
446
|
+
interface DocumentChunkPagination {
|
|
447
|
+
/** Current page number */
|
|
448
|
+
page: number;
|
|
449
|
+
/** Number of items requested per page */
|
|
450
|
+
pageSize: number;
|
|
451
|
+
/** Total matching chunks */
|
|
452
|
+
total: number;
|
|
453
|
+
/** Total number of pages */
|
|
454
|
+
totalPages: number;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Query parameters for GET /v2/documents/{document_id}/chunks.
|
|
458
|
+
*/
|
|
459
|
+
interface DocumentChunkListParams {
|
|
460
|
+
/** Page number (default: 1) */
|
|
461
|
+
page?: number;
|
|
462
|
+
/** Items per page (default: 50, maximum: 200) */
|
|
463
|
+
pageSize?: number;
|
|
464
|
+
/** Optional chunk type filter */
|
|
465
|
+
chunkType?: DocumentChunkType;
|
|
466
|
+
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
467
|
+
includeAssetUrls?: boolean;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
471
|
+
*/
|
|
472
|
+
interface DocumentChunkGetParams {
|
|
473
|
+
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
474
|
+
includeAssetUrls?: boolean;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* One current-revision document chunk.
|
|
478
|
+
*/
|
|
479
|
+
interface DocumentChunk {
|
|
480
|
+
/** Stable document chunk row identifier */
|
|
481
|
+
id: string;
|
|
482
|
+
/** Parser-provided chunk identifier */
|
|
483
|
+
chunkId: string;
|
|
484
|
+
/** Chunk content type */
|
|
485
|
+
chunkType: DocumentChunkType;
|
|
486
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
487
|
+
contentSource?: string | null;
|
|
488
|
+
/** Chunk text or generated summary content */
|
|
489
|
+
content?: string | null;
|
|
490
|
+
/** Parent section identifier */
|
|
491
|
+
sectionId?: string | null;
|
|
492
|
+
/** Parent section path */
|
|
493
|
+
sectionPath?: string | null;
|
|
494
|
+
/** Source path from the parser output */
|
|
495
|
+
sourceChunkPath?: string | null;
|
|
496
|
+
/** Generated artifact file path for media chunks */
|
|
497
|
+
filePath?: string | null;
|
|
498
|
+
/** Sort order within the document revision */
|
|
499
|
+
sortOrder: number;
|
|
500
|
+
/** Chunk metadata returned by the API */
|
|
501
|
+
metadata: Record<string, unknown>;
|
|
502
|
+
/** 7-day asset URL for media or page citation assets when available */
|
|
503
|
+
assetUrl?: string | null;
|
|
504
|
+
/** Chunk creation timestamp */
|
|
505
|
+
createdAt?: Date;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Response from GET /v2/documents/{document_id}/files/page-citation-source.
|
|
509
|
+
*/
|
|
510
|
+
interface DocumentPageCitationSource {
|
|
511
|
+
documentId: string;
|
|
512
|
+
namespace?: string;
|
|
513
|
+
jobId?: string;
|
|
514
|
+
jobResultId?: string;
|
|
515
|
+
variant?: string;
|
|
516
|
+
fileName: string;
|
|
517
|
+
contentType: string;
|
|
518
|
+
url: string;
|
|
519
|
+
expiresAt?: Date;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Response from GET /v2/documents/{document_id}/chunks.
|
|
523
|
+
*/
|
|
524
|
+
interface DocumentChunkListResponse {
|
|
525
|
+
/** Stable document identifier */
|
|
526
|
+
documentId: string;
|
|
527
|
+
/** Retrieval namespace */
|
|
528
|
+
namespace: string;
|
|
529
|
+
/** Current published job result identifier */
|
|
530
|
+
jobResultId?: string | null;
|
|
531
|
+
/** Current published job identifier */
|
|
532
|
+
jobId?: string | null;
|
|
533
|
+
/** Current-revision chunks */
|
|
534
|
+
chunks: DocumentChunk[];
|
|
535
|
+
/** Pagination metadata */
|
|
536
|
+
pagination: DocumentChunkPagination;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Response from GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
540
|
+
*/
|
|
541
|
+
interface DocumentChunkResponse {
|
|
542
|
+
/** Stable document identifier */
|
|
543
|
+
documentId: string;
|
|
544
|
+
/** Retrieval namespace */
|
|
545
|
+
namespace: string;
|
|
546
|
+
/** Current published job result identifier */
|
|
547
|
+
jobResultId?: string | null;
|
|
548
|
+
/** Current published job identifier */
|
|
549
|
+
jobId?: string | null;
|
|
550
|
+
/** Requested current-revision chunk */
|
|
551
|
+
chunk: DocumentChunk;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
type KnowhereAssetStorageBody = Uint8Array;
|
|
555
|
+
interface KnowhereAssetStorageObject {
|
|
556
|
+
readonly key: string;
|
|
557
|
+
readonly body: KnowhereAssetStorageBody;
|
|
558
|
+
readonly contentType: string;
|
|
559
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
560
|
+
}
|
|
561
|
+
interface KnowhereAssetStorageHead {
|
|
562
|
+
readonly key: string;
|
|
563
|
+
readonly contentType?: string;
|
|
564
|
+
readonly contentLength?: number;
|
|
565
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
566
|
+
readonly url?: string;
|
|
567
|
+
}
|
|
568
|
+
interface KnowhereAssetStorageWriteResult {
|
|
569
|
+
readonly key: string;
|
|
570
|
+
readonly url?: string;
|
|
571
|
+
}
|
|
572
|
+
interface KnowhereAssetStorageAdapter {
|
|
573
|
+
writeObject(input: KnowhereAssetStorageObject): Promise<KnowhereAssetStorageWriteResult>;
|
|
574
|
+
headObject?(key: string): Promise<KnowhereAssetStorageHead | null>;
|
|
575
|
+
getObjectUrl?(key: string): Promise<string | null>;
|
|
576
|
+
}
|
|
577
|
+
interface KnowhereAssetStorageOptions {
|
|
578
|
+
readonly adapter: KnowhereAssetStorageAdapter;
|
|
579
|
+
readonly keyPrefix: string;
|
|
580
|
+
readonly skipExisting?: boolean;
|
|
581
|
+
readonly chunkPageSize?: number;
|
|
582
|
+
readonly revisionKey?: string;
|
|
583
|
+
}
|
|
584
|
+
interface KnowhereParsedSnapshotChunk {
|
|
585
|
+
readonly id: string;
|
|
586
|
+
readonly chunkId: string;
|
|
587
|
+
readonly chunkType: string;
|
|
588
|
+
readonly contentSource?: string;
|
|
589
|
+
readonly content: string;
|
|
590
|
+
readonly sectionPath?: string;
|
|
591
|
+
readonly sourceChunkPath: string;
|
|
592
|
+
readonly filePath?: string;
|
|
593
|
+
readonly sortOrder: number;
|
|
594
|
+
readonly metadata: Record<string, unknown>;
|
|
595
|
+
readonly assetUrl?: string;
|
|
596
|
+
}
|
|
597
|
+
interface KnowhereParsedSnapshotChunkPage {
|
|
598
|
+
readonly version: 1;
|
|
599
|
+
readonly jobId: string;
|
|
600
|
+
readonly revisionKey?: string;
|
|
601
|
+
readonly documentId?: string;
|
|
602
|
+
readonly namespace?: string;
|
|
603
|
+
readonly sourceFileName: string;
|
|
604
|
+
readonly page: number;
|
|
605
|
+
readonly pageSize: number;
|
|
606
|
+
readonly total: number;
|
|
607
|
+
readonly totalPages: number;
|
|
608
|
+
readonly chunks: readonly KnowhereParsedSnapshotChunk[];
|
|
609
|
+
}
|
|
610
|
+
interface KnowhereParsedSnapshotChunkPageReference {
|
|
611
|
+
readonly page: number;
|
|
612
|
+
readonly pageSize: number;
|
|
613
|
+
readonly chunkCount: number;
|
|
614
|
+
readonly key: string;
|
|
615
|
+
readonly url?: string;
|
|
616
|
+
}
|
|
617
|
+
interface KnowhereParsedSnapshotManifest {
|
|
618
|
+
readonly version: 1;
|
|
619
|
+
readonly kind: 'knowhere-parsed-result-snapshot';
|
|
620
|
+
readonly jobId: string;
|
|
621
|
+
readonly revisionKey?: string;
|
|
622
|
+
readonly documentId?: string;
|
|
623
|
+
readonly namespace?: string;
|
|
624
|
+
readonly sourceFileName: string;
|
|
625
|
+
readonly totalChunks: number;
|
|
626
|
+
readonly typeCounts?: Readonly<Partial<Record<DocumentChunkType, number>>>;
|
|
627
|
+
readonly chunkPageSize: number;
|
|
628
|
+
readonly chunkPages: readonly KnowhereParsedSnapshotChunkPageReference[];
|
|
629
|
+
readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
|
|
630
|
+
readonly createdAt: string;
|
|
631
|
+
}
|
|
632
|
+
interface KnowhereParsedSnapshot {
|
|
633
|
+
readonly manifest: KnowhereParsedSnapshotManifest;
|
|
634
|
+
readonly manifestKey: string;
|
|
635
|
+
readonly manifestUrl?: string;
|
|
636
|
+
readonly indexKey: string;
|
|
637
|
+
readonly indexUrl?: string;
|
|
638
|
+
readonly chunkPageUrlsByPage: Readonly<Record<number, string>>;
|
|
639
|
+
}
|
|
640
|
+
interface KnowhereAssetStorageResult {
|
|
641
|
+
readonly result: ParseResult;
|
|
642
|
+
readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
|
|
643
|
+
readonly snapshot?: KnowhereParsedSnapshot;
|
|
644
|
+
}
|
|
645
|
+
type ParsedDocumentAssetUrlPolicy = 'none' | 'durable';
|
|
646
|
+
interface ParsedDocumentStorageDocument {
|
|
647
|
+
readonly documentId: string;
|
|
648
|
+
readonly revisionKey: string;
|
|
649
|
+
}
|
|
650
|
+
type ParsedDocumentStorageManifestParams = ParsedDocumentStorageDocument;
|
|
651
|
+
interface ParsedDocumentStorageChunkPageParams extends ParsedDocumentStorageDocument {
|
|
652
|
+
readonly page: number;
|
|
653
|
+
readonly chunkType?: DocumentChunkType;
|
|
654
|
+
}
|
|
655
|
+
interface ParsedDocumentStorageAsset {
|
|
656
|
+
readonly sourcePath: string;
|
|
657
|
+
readonly body: KnowhereAssetStorageBody;
|
|
658
|
+
readonly contentType: string;
|
|
659
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
660
|
+
}
|
|
661
|
+
interface ParsedDocumentStorageAssetParams extends ParsedDocumentStorageDocument {
|
|
662
|
+
readonly sourcePath: string;
|
|
663
|
+
}
|
|
664
|
+
interface ParsedDocumentSyncProgress {
|
|
665
|
+
readonly documentId: string;
|
|
666
|
+
readonly revisionKey: string;
|
|
667
|
+
readonly nextChunkPage: number;
|
|
668
|
+
readonly nextAssetIndex: number;
|
|
669
|
+
readonly status: 'running' | 'completed' | 'failed';
|
|
670
|
+
readonly updatedAt: string;
|
|
671
|
+
readonly error?: string;
|
|
672
|
+
}
|
|
673
|
+
interface ParsedDocumentStorage {
|
|
674
|
+
readManifest(params: ParsedDocumentStorageManifestParams): Promise<KnowhereParsedSnapshotManifest | null>;
|
|
675
|
+
writeManifest(params: {
|
|
676
|
+
readonly documentId: string;
|
|
677
|
+
readonly revisionKey: string;
|
|
678
|
+
readonly manifest: KnowhereParsedSnapshotManifest;
|
|
679
|
+
}): Promise<void>;
|
|
680
|
+
readChunkPage(params: ParsedDocumentStorageChunkPageParams): Promise<KnowhereParsedSnapshotChunkPage | null>;
|
|
681
|
+
writeChunkPage(params: {
|
|
682
|
+
readonly documentId: string;
|
|
683
|
+
readonly revisionKey: string;
|
|
684
|
+
readonly page: KnowhereParsedSnapshotChunkPage;
|
|
685
|
+
}): Promise<void>;
|
|
686
|
+
writeAsset(params: ParsedDocumentStorageDocument & ParsedDocumentStorageAsset): Promise<{
|
|
687
|
+
readonly sourcePath: string;
|
|
688
|
+
readonly url?: string;
|
|
689
|
+
}>;
|
|
690
|
+
getAssetUrl(params: ParsedDocumentStorageAssetParams): Promise<string | null>;
|
|
691
|
+
readSyncProgress(params: ParsedDocumentStorageDocument): Promise<ParsedDocumentSyncProgress | null>;
|
|
692
|
+
writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
|
|
693
|
+
}
|
|
694
|
+
interface ParsedDocumentSyncScheduler {
|
|
695
|
+
schedule(task: () => Promise<void>): void | Promise<void>;
|
|
696
|
+
}
|
|
697
|
+
interface ParsedDocumentStorageLimits {
|
|
698
|
+
readonly chunkPageSize?: number;
|
|
699
|
+
readonly remotePageSize?: number;
|
|
700
|
+
readonly maxPagesPerSync?: number;
|
|
701
|
+
readonly maxAssetsPerSync?: number;
|
|
702
|
+
readonly syncDeadlineMs?: number;
|
|
703
|
+
readonly grepMaxPages?: number;
|
|
704
|
+
readonly grepDeadlineMs?: number;
|
|
705
|
+
readonly outlineMaxPages?: number;
|
|
706
|
+
readonly outlineDeadlineMs?: number;
|
|
707
|
+
}
|
|
708
|
+
interface ParsedDocumentStorageConfig {
|
|
709
|
+
readonly storage: ParsedDocumentStorage;
|
|
710
|
+
readonly scheduler?: ParsedDocumentSyncScheduler;
|
|
711
|
+
readonly limits?: ParsedDocumentStorageLimits;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Parsing model options
|
|
716
|
+
*/
|
|
717
|
+
type ParsingModel = 'base' | 'advanced';
|
|
718
|
+
/**
|
|
719
|
+
* Document type options
|
|
720
|
+
*/
|
|
721
|
+
type DocType = 'auto' | 'pdf' | 'docx' | 'txt' | 'md';
|
|
722
|
+
/**
|
|
723
|
+
* Parsing configuration parameters
|
|
724
|
+
*/
|
|
725
|
+
interface ParsingParams {
|
|
726
|
+
/** Parsing model to use (default: 'base') */
|
|
727
|
+
model?: ParsingModel;
|
|
728
|
+
/** Enable OCR for scanned documents (default: false) */
|
|
729
|
+
ocrEnabled?: boolean;
|
|
730
|
+
/** Knowledge base directory */
|
|
731
|
+
kbDir?: string;
|
|
732
|
+
/** Document type hint (default: 'auto') */
|
|
733
|
+
docType?: DocType;
|
|
734
|
+
/** Enable smart title parsing (default: false) */
|
|
735
|
+
smartTitleParse?: boolean;
|
|
736
|
+
/** Generate image summaries (default: false) */
|
|
737
|
+
summaryImage?: boolean;
|
|
738
|
+
/** Generate table summaries (default: false) */
|
|
739
|
+
summaryTable?: boolean;
|
|
740
|
+
/** Generate text summaries (default: false) */
|
|
741
|
+
summaryTxt?: boolean;
|
|
742
|
+
/** Additional fragment description */
|
|
743
|
+
addFragDesc?: string;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Webhook configuration
|
|
747
|
+
*/
|
|
748
|
+
interface WebhookConfig {
|
|
749
|
+
/** Webhook URL to notify on job completion */
|
|
750
|
+
url: string;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Client-provided display metadata copied onto the published document.
|
|
754
|
+
*/
|
|
755
|
+
type DocumentMetadata = Record<string, unknown>;
|
|
756
|
+
/**
|
|
757
|
+
* Job creation parameters
|
|
758
|
+
*/
|
|
759
|
+
interface CreateJobParams {
|
|
760
|
+
/** Source type: 'file' for upload, 'url' for remote document */
|
|
761
|
+
sourceType: 'file' | 'url';
|
|
762
|
+
/** Source URL (required if sourceType is 'url') */
|
|
763
|
+
sourceUrl?: string;
|
|
764
|
+
/** File name (required if sourceType is 'file') */
|
|
765
|
+
fileName?: string;
|
|
766
|
+
/** Optional custom data identifier */
|
|
767
|
+
dataId?: string;
|
|
768
|
+
/** Retrieval namespace for the canonical document */
|
|
769
|
+
namespace?: string;
|
|
770
|
+
/** Existing document identifier when updating a published document */
|
|
771
|
+
documentId?: string;
|
|
772
|
+
/** Display metadata to copy onto the published document */
|
|
773
|
+
documentMetadata?: DocumentMetadata;
|
|
774
|
+
/** Parsing configuration */
|
|
775
|
+
parsingParams?: ParsingParams;
|
|
776
|
+
/** Webhook configuration */
|
|
777
|
+
webhook?: WebhookConfig;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* File upload parameters
|
|
781
|
+
*/
|
|
782
|
+
interface UploadParams {
|
|
783
|
+
/** File to upload (path, Buffer, Stream, or Uint8Array) */
|
|
784
|
+
file: string | Buffer | ReadStream | Uint8Array;
|
|
785
|
+
/** Upload progress callback */
|
|
786
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
787
|
+
/** Abort signal for cancellation */
|
|
788
|
+
signal?: AbortSignal;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Wait options for polling
|
|
792
|
+
*/
|
|
793
|
+
interface WaitOptions {
|
|
794
|
+
/** Polling interval in milliseconds (default: 10000) */
|
|
795
|
+
pollInterval?: number;
|
|
796
|
+
/** Maximum wait time in milliseconds (default: 1800000 = 30 minutes) */
|
|
797
|
+
pollTimeout?: number;
|
|
798
|
+
/** Progress callback */
|
|
799
|
+
onProgress?: (status: PollProgress) => void;
|
|
800
|
+
/** Abort signal for cancellation */
|
|
801
|
+
signal?: AbortSignal;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Load options for result parsing
|
|
805
|
+
*/
|
|
806
|
+
interface LoadOptions {
|
|
807
|
+
/** Whether to verify ZIP checksum (default: true) */
|
|
808
|
+
verifyChecksum?: boolean;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* High-level parse parameters
|
|
812
|
+
*/
|
|
813
|
+
interface ParseParams {
|
|
814
|
+
/** Source URL (mutually exclusive with file) */
|
|
815
|
+
url?: string;
|
|
816
|
+
/** File to parse (path, Buffer, Stream, or Uint8Array) */
|
|
817
|
+
file?: string | Buffer | ReadStream | Uint8Array;
|
|
818
|
+
/** File name (auto-inferred for file paths and fs.ReadStream with a path) */
|
|
819
|
+
fileName?: string;
|
|
820
|
+
/** Parsing model (default: 'base') */
|
|
821
|
+
model?: ParsingModel;
|
|
822
|
+
/** Enable OCR (default: false) */
|
|
823
|
+
ocr?: boolean;
|
|
824
|
+
/** Document type hint */
|
|
825
|
+
docType?: DocType;
|
|
826
|
+
/** Enable smart title parsing */
|
|
827
|
+
smartTitleParse?: boolean;
|
|
828
|
+
/** Generate image summaries */
|
|
829
|
+
summaryImage?: boolean;
|
|
830
|
+
/** Generate table summaries */
|
|
831
|
+
summaryTable?: boolean;
|
|
832
|
+
/** Generate text summaries */
|
|
833
|
+
summaryTxt?: boolean;
|
|
834
|
+
/** Custom data identifier */
|
|
835
|
+
dataId?: string;
|
|
836
|
+
/** Retrieval namespace for the canonical document */
|
|
837
|
+
namespace?: string;
|
|
838
|
+
/** Existing document identifier when updating a published document */
|
|
839
|
+
documentId?: string;
|
|
840
|
+
/** Display metadata to copy onto the published document */
|
|
841
|
+
documentMetadata?: DocumentMetadata;
|
|
842
|
+
/** Additional fragment description */
|
|
843
|
+
addFragDesc?: string;
|
|
844
|
+
/** Knowledge base directory */
|
|
845
|
+
kbDir?: string;
|
|
846
|
+
/** Polling interval in milliseconds */
|
|
847
|
+
pollInterval?: number;
|
|
848
|
+
/** Maximum wait time in milliseconds */
|
|
849
|
+
pollTimeout?: number;
|
|
850
|
+
/** Whether to verify ZIP checksum (default: true) */
|
|
851
|
+
verifyChecksum?: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Optional asset storage adapter used to copy parsed media and page citation
|
|
854
|
+
* assets into application-owned storage before the result is returned.
|
|
855
|
+
*/
|
|
856
|
+
storageAdapter?: KnowhereAssetStorageOptions;
|
|
857
|
+
/** Webhook configuration */
|
|
858
|
+
webhook?: WebhookConfig;
|
|
859
|
+
/** Upload progress callback */
|
|
860
|
+
onUploadProgress?: (progress: UploadProgress) => void;
|
|
861
|
+
/** Poll progress callback */
|
|
862
|
+
onPollProgress?: (status: PollProgress) => void;
|
|
863
|
+
/** Abort signal */
|
|
864
|
+
signal?: AbortSignal;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Upload progress information
|
|
476
868
|
*/
|
|
477
|
-
interface
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
save(directory: string): Promise<string>;
|
|
869
|
+
interface UploadProgress {
|
|
870
|
+
/** Bytes uploaded */
|
|
871
|
+
loaded: number;
|
|
872
|
+
/** Total bytes (may be undefined for streams) */
|
|
873
|
+
total?: number;
|
|
874
|
+
/** Upload percentage (0-100) */
|
|
875
|
+
percent: number;
|
|
485
876
|
}
|
|
486
877
|
/**
|
|
487
|
-
*
|
|
488
|
-
*/
|
|
489
|
-
type Chunk = TextChunk | ImageChunk | TableChunk;
|
|
490
|
-
/**
|
|
491
|
-
* Complete parse result
|
|
878
|
+
* Polling progress information
|
|
492
879
|
*/
|
|
493
|
-
interface
|
|
494
|
-
/**
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
|
|
500
|
-
/** Full document as Markdown (if available) */
|
|
501
|
-
fullMarkdown?: string;
|
|
502
|
-
/** Raw ZIP buffer */
|
|
503
|
-
rawZip: Buffer;
|
|
504
|
-
/** @deprecated Current worker no longer emits chunks_slim.json */
|
|
505
|
-
chunksSlim?: SlimChunk[];
|
|
506
|
-
/** @deprecated Current worker no longer emits hierarchy.json */
|
|
507
|
-
hierarchy?: unknown;
|
|
508
|
-
/** @deprecated Table-of-contents hierarchy hints (if available) */
|
|
509
|
-
tocHierarchies?: unknown;
|
|
510
|
-
/** @deprecated Knowledge-base CSV export (if available) */
|
|
511
|
-
kbCsv?: string;
|
|
512
|
-
/** @deprecated Pre-rendered hierarchy HTML view (if available) */
|
|
513
|
-
hierarchyViewHtml?: string;
|
|
514
|
-
/** Text chunks only */
|
|
515
|
-
readonly textChunks: TextChunk[];
|
|
516
|
-
/** Image chunks only */
|
|
517
|
-
readonly imageChunks: ImageChunk[];
|
|
518
|
-
/** Table chunks only */
|
|
519
|
-
readonly tableChunks: TableChunk[];
|
|
520
|
-
/** Job ID */
|
|
521
|
-
readonly jobId: string;
|
|
522
|
-
/** Effective retrieval namespace when loaded from a job result */
|
|
523
|
-
namespace?: string;
|
|
524
|
-
/** Canonical document identifier when loaded from a job result */
|
|
525
|
-
documentId?: string;
|
|
526
|
-
/** Statistics */
|
|
527
|
-
readonly statistics: Statistics;
|
|
528
|
-
/** Find a specific chunk by ID */
|
|
529
|
-
getChunk(chunkId: string): Chunk | undefined;
|
|
530
|
-
/** Save all results to a directory */
|
|
531
|
-
save(directory: string): Promise<string>;
|
|
880
|
+
interface PollProgress {
|
|
881
|
+
/** Current job status */
|
|
882
|
+
status: JobStatus;
|
|
883
|
+
/** Elapsed time in seconds */
|
|
884
|
+
elapsedSeconds: number;
|
|
885
|
+
/** Current job result */
|
|
886
|
+
jobResult: JobResult;
|
|
532
887
|
}
|
|
533
888
|
|
|
534
889
|
interface HttpClientOptions {
|
|
@@ -602,6 +957,7 @@ declare class HttpClient {
|
|
|
602
957
|
declare abstract class BaseResource {
|
|
603
958
|
protected httpClient: HttpClient;
|
|
604
959
|
constructor(httpClient: HttpClient);
|
|
960
|
+
protected endpoint(path: string): string;
|
|
605
961
|
}
|
|
606
962
|
|
|
607
963
|
/**
|
|
@@ -651,6 +1007,7 @@ type RetrievalChannel = 'path' | 'content' | 'term';
|
|
|
651
1007
|
* Path filtering mode for retrieval queries.
|
|
652
1008
|
*/
|
|
653
1009
|
type RetrievalFilterMode = 'delete' | 'keep';
|
|
1010
|
+
type RetrievalChunkType = 'text' | 'image' | 'table' | 'page';
|
|
654
1011
|
/**
|
|
655
1012
|
* Retrieval query parameters.
|
|
656
1013
|
*/
|
|
@@ -669,8 +1026,10 @@ interface RetrievalQueryParams {
|
|
|
669
1026
|
* - ``undefined`` / omitted — server default
|
|
670
1027
|
*/
|
|
671
1028
|
useAgentic?: boolean;
|
|
672
|
-
/** Chunk type filter: 1=all, 2=text, 3=image, 4=table, 5=text+image, 6=text+table */
|
|
673
|
-
dataType?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
1029
|
+
/** Chunk type filter: 1=all, 2=text, 3=image, 4=table, 5=text+image, 6=text+table, 7=page, 8=text+image+table */
|
|
1030
|
+
dataType?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
1031
|
+
/** Allowed chunk types. Overrides dataType when provided. */
|
|
1032
|
+
chunkTypes?: RetrievalChunkType[];
|
|
674
1033
|
/** Path keywords for include/exclude filtering */
|
|
675
1034
|
signalPaths?: string[];
|
|
676
1035
|
/** Signal path filter mode */
|
|
@@ -705,14 +1064,24 @@ interface RetrievalSource {
|
|
|
705
1064
|
* Canonical chunk result returned by retrieval query.
|
|
706
1065
|
*/
|
|
707
1066
|
interface RetrievalResult {
|
|
1067
|
+
/** Parser-provided chunk identifier when included by the API */
|
|
1068
|
+
chunkId?: string;
|
|
708
1069
|
/** Knowledge content to use directly in the caller's answer */
|
|
709
1070
|
content: string;
|
|
710
|
-
/** Chunk type, for example text, image, or
|
|
1071
|
+
/** Chunk type, for example text, image, table, or page */
|
|
711
1072
|
chunkType: string;
|
|
1073
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
1074
|
+
contentSource?: string;
|
|
712
1075
|
/** Retrieval score returned by the API. Null when no score is available (agentic navigation-only results). */
|
|
713
1076
|
score: number | null;
|
|
714
1077
|
/** Presigned asset URL for media chunks when available */
|
|
715
1078
|
assetUrl?: string;
|
|
1079
|
+
/** Source chunk path when returned by the API */
|
|
1080
|
+
sourceChunkPath?: string | null;
|
|
1081
|
+
/** Generated artifact file path for media chunks */
|
|
1082
|
+
filePath?: string | null;
|
|
1083
|
+
/** Chunk metadata returned by the API */
|
|
1084
|
+
metadata?: Record<string, unknown>;
|
|
716
1085
|
/** Source reference for this result */
|
|
717
1086
|
source: RetrievalSource;
|
|
718
1087
|
}
|
|
@@ -724,19 +1093,25 @@ interface RetrievalReferencedChunk {
|
|
|
724
1093
|
chunkId: string;
|
|
725
1094
|
/** Stable document identifier */
|
|
726
1095
|
documentId: string;
|
|
727
|
-
/** Chunk type, for example text, image, or
|
|
1096
|
+
/** Chunk type, for example text, image, table, or page */
|
|
728
1097
|
chunkType: string;
|
|
1098
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
1099
|
+
contentSource?: string | null;
|
|
729
1100
|
/** Human-readable section path */
|
|
730
1101
|
sectionPath: string;
|
|
1102
|
+
/** Source chunk path when returned by the API */
|
|
1103
|
+
sourceChunkPath?: string | null;
|
|
731
1104
|
/** Generated artifact file path for media chunks */
|
|
732
1105
|
filePath?: string | null;
|
|
733
1106
|
/** Published job identifier for the referenced chunk */
|
|
734
1107
|
jobId?: string | null;
|
|
735
1108
|
/** Presigned asset URL for media chunks when available */
|
|
736
1109
|
assetUrl?: string | null;
|
|
1110
|
+
/** Chunk metadata returned by the API */
|
|
1111
|
+
metadata?: Record<string, unknown>;
|
|
737
1112
|
}
|
|
738
1113
|
/**
|
|
739
|
-
* Response from POST /
|
|
1114
|
+
* Response from POST /v2/retrieval/query.
|
|
740
1115
|
*
|
|
741
1116
|
* Three PRIMARY output fields for downstream agent consumption:
|
|
742
1117
|
* - `evidenceText`: hierarchical evidence tree for LLM context
|
|
@@ -776,163 +1151,6 @@ declare class Retrieval extends BaseResource {
|
|
|
776
1151
|
query(params: RetrievalQueryParams): Promise<RetrievalQueryResponse>;
|
|
777
1152
|
}
|
|
778
1153
|
|
|
779
|
-
/**
|
|
780
|
-
* Canonical document state returned by document lifecycle endpoints.
|
|
781
|
-
*/
|
|
782
|
-
interface Document {
|
|
783
|
-
/** Stable document identifier */
|
|
784
|
-
documentId: string;
|
|
785
|
-
/** Retrieval namespace */
|
|
786
|
-
namespace: string;
|
|
787
|
-
/** Current lifecycle status */
|
|
788
|
-
status: string;
|
|
789
|
-
/** Current published job result identifier */
|
|
790
|
-
currentJobResultId?: string;
|
|
791
|
-
/** Original source file name */
|
|
792
|
-
sourceFileName?: string;
|
|
793
|
-
/** Client-provided display metadata copied from the publishing job */
|
|
794
|
-
documentMetadata?: Record<string, unknown>;
|
|
795
|
-
/** Document creation timestamp */
|
|
796
|
-
createdAt?: Date;
|
|
797
|
-
/** Last update timestamp */
|
|
798
|
-
updatedAt?: Date;
|
|
799
|
-
/** Archive timestamp, when archived */
|
|
800
|
-
archivedAt?: Date;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Pagination metadata returned by document list endpoints.
|
|
804
|
-
*/
|
|
805
|
-
interface DocumentListPagination {
|
|
806
|
-
/** Current page number */
|
|
807
|
-
page: number;
|
|
808
|
-
/** Number of items requested per page */
|
|
809
|
-
pageSize: number;
|
|
810
|
-
/** Total matching documents */
|
|
811
|
-
total: number;
|
|
812
|
-
/** Total number of pages */
|
|
813
|
-
totalPages: number;
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Query parameters for GET /v1/documents.
|
|
817
|
-
*/
|
|
818
|
-
interface DocumentListParams {
|
|
819
|
-
/** Retrieval namespace */
|
|
820
|
-
namespace?: string;
|
|
821
|
-
/** Page number (default: 1) */
|
|
822
|
-
page?: number;
|
|
823
|
-
/** Items per page (default: 50, maximum: 200) */
|
|
824
|
-
pageSize?: number;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Response from GET /v1/documents.
|
|
828
|
-
*/
|
|
829
|
-
interface DocumentListResponse {
|
|
830
|
-
/** Namespace listed by the API */
|
|
831
|
-
namespace: string;
|
|
832
|
-
/** Documents visible in the namespace */
|
|
833
|
-
documents: Document[];
|
|
834
|
-
/** Pagination metadata */
|
|
835
|
-
pagination: DocumentListPagination;
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Document chunk types supported by document chunk endpoints.
|
|
839
|
-
*/
|
|
840
|
-
type DocumentChunkType = 'text' | 'image' | 'table';
|
|
841
|
-
/**
|
|
842
|
-
* Pagination metadata returned by chunk list endpoints.
|
|
843
|
-
*/
|
|
844
|
-
interface DocumentChunkPagination {
|
|
845
|
-
/** Current page number */
|
|
846
|
-
page: number;
|
|
847
|
-
/** Number of items requested per page */
|
|
848
|
-
pageSize: number;
|
|
849
|
-
/** Total matching chunks */
|
|
850
|
-
total: number;
|
|
851
|
-
/** Total number of pages */
|
|
852
|
-
totalPages: number;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Query parameters for GET /v1/documents/{document_id}/chunks.
|
|
856
|
-
*/
|
|
857
|
-
interface DocumentChunkListParams {
|
|
858
|
-
/** Page number (default: 1) */
|
|
859
|
-
page?: number;
|
|
860
|
-
/** Items per page (default: 50, maximum: 200) */
|
|
861
|
-
pageSize?: number;
|
|
862
|
-
/** Optional chunk type filter */
|
|
863
|
-
chunkType?: DocumentChunkType;
|
|
864
|
-
/** Set true to include 7-day asset URLs for media chunks */
|
|
865
|
-
includeAssetUrls?: boolean;
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
* Query parameters for GET /v1/documents/{document_id}/chunks/{document_chunk_id}.
|
|
869
|
-
*/
|
|
870
|
-
interface DocumentChunkGetParams {
|
|
871
|
-
/** Set true to include 7-day asset URLs for media chunks */
|
|
872
|
-
includeAssetUrls?: boolean;
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* One current-revision document chunk.
|
|
876
|
-
*/
|
|
877
|
-
interface DocumentChunk {
|
|
878
|
-
/** Stable document chunk row identifier */
|
|
879
|
-
id: string;
|
|
880
|
-
/** Parser-provided chunk identifier */
|
|
881
|
-
chunkId: string;
|
|
882
|
-
/** Chunk content type */
|
|
883
|
-
chunkType: DocumentChunkType;
|
|
884
|
-
/** Chunk text or generated summary content */
|
|
885
|
-
content?: string | null;
|
|
886
|
-
/** Parent section identifier */
|
|
887
|
-
sectionId?: string | null;
|
|
888
|
-
/** Parent section path */
|
|
889
|
-
sectionPath?: string | null;
|
|
890
|
-
/** Source path from the parser output */
|
|
891
|
-
sourceChunkPath?: string | null;
|
|
892
|
-
/** Generated artifact file path for media chunks */
|
|
893
|
-
filePath?: string | null;
|
|
894
|
-
/** Sort order within the document revision */
|
|
895
|
-
sortOrder: number;
|
|
896
|
-
/** Chunk metadata returned by the API */
|
|
897
|
-
metadata: Record<string, unknown>;
|
|
898
|
-
/** 7-day asset URL for media chunks when available */
|
|
899
|
-
assetUrl?: string | null;
|
|
900
|
-
/** Chunk creation timestamp */
|
|
901
|
-
createdAt?: Date;
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Response from GET /v1/documents/{document_id}/chunks.
|
|
905
|
-
*/
|
|
906
|
-
interface DocumentChunkListResponse {
|
|
907
|
-
/** Stable document identifier */
|
|
908
|
-
documentId: string;
|
|
909
|
-
/** Retrieval namespace */
|
|
910
|
-
namespace: string;
|
|
911
|
-
/** Current published job result identifier */
|
|
912
|
-
jobResultId?: string | null;
|
|
913
|
-
/** Current published job identifier */
|
|
914
|
-
jobId?: string | null;
|
|
915
|
-
/** Current-revision chunks */
|
|
916
|
-
chunks: DocumentChunk[];
|
|
917
|
-
/** Pagination metadata */
|
|
918
|
-
pagination: DocumentChunkPagination;
|
|
919
|
-
}
|
|
920
|
-
/**
|
|
921
|
-
* Response from GET /v1/documents/{document_id}/chunks/{document_chunk_id}.
|
|
922
|
-
*/
|
|
923
|
-
interface DocumentChunkResponse {
|
|
924
|
-
/** Stable document identifier */
|
|
925
|
-
documentId: string;
|
|
926
|
-
/** Retrieval namespace */
|
|
927
|
-
namespace: string;
|
|
928
|
-
/** Current published job result identifier */
|
|
929
|
-
jobResultId?: string | null;
|
|
930
|
-
/** Current published job identifier */
|
|
931
|
-
jobId?: string | null;
|
|
932
|
-
/** Requested current-revision chunk */
|
|
933
|
-
chunk: DocumentChunk;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
1154
|
/**
|
|
937
1155
|
* Resource for canonical document lifecycle operations.
|
|
938
1156
|
*/
|
|
@@ -953,6 +1171,10 @@ declare class Documents extends BaseResource {
|
|
|
953
1171
|
* Get one current-revision chunk for one canonical document.
|
|
954
1172
|
*/
|
|
955
1173
|
getChunk(documentId: string, documentChunkId: string, params?: DocumentChunkGetParams): Promise<DocumentChunkResponse>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Get a signed normalized source-file URL for compatibility and debugging.
|
|
1176
|
+
*/
|
|
1177
|
+
getPageCitationSource(documentId: string): Promise<DocumentPageCitationSource>;
|
|
956
1178
|
/**
|
|
957
1179
|
* Archive one canonical document by ID.
|
|
958
1180
|
*/
|
|
@@ -963,6 +1185,18 @@ declare class Documents extends BaseResource {
|
|
|
963
1185
|
private createChunkGetRequestConfig;
|
|
964
1186
|
}
|
|
965
1187
|
|
|
1188
|
+
type PageCitationAssetContentType = 'image/png' | 'image/jpeg';
|
|
1189
|
+
type PageCitationAssetSource = 'knowhere-rendered-page-citation-source';
|
|
1190
|
+
interface PageCitationAsset {
|
|
1191
|
+
pageNum: number;
|
|
1192
|
+
artifactRef: string;
|
|
1193
|
+
assetUrl?: string;
|
|
1194
|
+
contentType: PageCitationAssetContentType;
|
|
1195
|
+
width?: number;
|
|
1196
|
+
height?: number;
|
|
1197
|
+
source: PageCitationAssetSource;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
966
1200
|
type KnowledgeChunkType = DocumentChunkType;
|
|
967
1201
|
interface KnowledgeParseParams extends ParseParams {
|
|
968
1202
|
/** Optional stable local identifier for this parsed result copy. */
|
|
@@ -993,6 +1227,8 @@ interface LocalKnowledgeDocument {
|
|
|
993
1227
|
interface LocalKnowledgeParseResponse {
|
|
994
1228
|
document: LocalKnowledgeDocument;
|
|
995
1229
|
result: ParseResult;
|
|
1230
|
+
assetUrlsByFilePath?: Readonly<Record<string, string>>;
|
|
1231
|
+
parsedSnapshot?: KnowhereParsedSnapshot;
|
|
996
1232
|
}
|
|
997
1233
|
interface KnowledgeAsyncParseParams extends ParseParams {
|
|
998
1234
|
/** Optional stable local identifier to use when this job result is cached later. */
|
|
@@ -1017,11 +1253,21 @@ interface KnowledgeStartupRecoveryResponse {
|
|
|
1017
1253
|
checkedJobs: number;
|
|
1018
1254
|
results: KnowledgeAsyncJobStatusResponse[];
|
|
1019
1255
|
}
|
|
1020
|
-
interface
|
|
1256
|
+
interface KnowledgeLoadJobResultParams {
|
|
1021
1257
|
jobId: string;
|
|
1022
|
-
localDocumentId?: string;
|
|
1023
1258
|
verifyChecksum?: boolean;
|
|
1259
|
+
storageAdapter?: KnowhereAssetStorageOptions;
|
|
1260
|
+
}
|
|
1261
|
+
interface KnowledgeImportJobResultParams extends KnowledgeLoadJobResultParams {
|
|
1262
|
+
localDocumentId?: string;
|
|
1263
|
+
}
|
|
1264
|
+
interface KnowledgeJobResultResponse {
|
|
1265
|
+
result: ParseResult;
|
|
1266
|
+
assetUrlsByFilePath?: Readonly<Record<string, string>>;
|
|
1267
|
+
parsedSnapshot?: KnowhereParsedSnapshot;
|
|
1024
1268
|
}
|
|
1269
|
+
/** @deprecated Use KnowledgeImportJobResultParams with importJobResult instead. */
|
|
1270
|
+
type KnowledgeCacheJobResultParams = KnowledgeImportJobResultParams;
|
|
1025
1271
|
interface KnowledgeCacheDocumentParams {
|
|
1026
1272
|
/** Canonical Knowhere document identifier from published retrieval results. */
|
|
1027
1273
|
documentId: string;
|
|
@@ -1035,6 +1281,16 @@ interface KnowledgeDocumentReference {
|
|
|
1035
1281
|
documentId?: string;
|
|
1036
1282
|
/** Server parse job identifier whose completed result should be cached before reading. */
|
|
1037
1283
|
jobId?: string;
|
|
1284
|
+
/** Current parsed revision key when the caller already has it. */
|
|
1285
|
+
revisionKey?: string;
|
|
1286
|
+
}
|
|
1287
|
+
type KnowledgeParsedStorageOptions = ParsedDocumentStorageConfig;
|
|
1288
|
+
type KnowledgeSyncParsedDocumentParams = KnowledgeDocumentReference;
|
|
1289
|
+
interface KnowledgeSyncParsedDocumentResponse {
|
|
1290
|
+
documentId: string;
|
|
1291
|
+
revisionKey: string;
|
|
1292
|
+
completed: boolean;
|
|
1293
|
+
manifest?: KnowhereParsedSnapshotManifest;
|
|
1038
1294
|
}
|
|
1039
1295
|
interface KnowledgeSection {
|
|
1040
1296
|
sectionPath: string;
|
|
@@ -1053,32 +1309,48 @@ interface KnowledgeOutline {
|
|
|
1053
1309
|
typeCounts: Record<KnowledgeChunkType, number>;
|
|
1054
1310
|
sections: KnowledgeSection[];
|
|
1055
1311
|
sectionTree: KnowledgeSection[];
|
|
1312
|
+
truncated?: boolean;
|
|
1313
|
+
continuationCursor?: string;
|
|
1056
1314
|
}
|
|
1057
1315
|
interface KnowledgeReadParams extends KnowledgeDocumentReference {
|
|
1316
|
+
page?: number;
|
|
1317
|
+
pageSize?: number;
|
|
1058
1318
|
sectionPath?: string;
|
|
1059
1319
|
startChunk?: number;
|
|
1060
1320
|
endChunk?: number;
|
|
1061
1321
|
chunkId?: string;
|
|
1062
1322
|
chunkType?: KnowledgeChunkType;
|
|
1063
1323
|
limit?: number;
|
|
1324
|
+
assetUrlPolicy?: ParsedDocumentAssetUrlPolicy;
|
|
1064
1325
|
}
|
|
1065
1326
|
interface KnowledgeReadChunk {
|
|
1066
1327
|
position: number;
|
|
1067
1328
|
chunkId: string;
|
|
1068
1329
|
chunkType: KnowledgeChunkType;
|
|
1330
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
1331
|
+
contentSource?: string;
|
|
1069
1332
|
content: string;
|
|
1333
|
+
/** Display-safe text. For page chunks this prefers metadata.summary. */
|
|
1334
|
+
readableContent: string;
|
|
1070
1335
|
sectionPath: string;
|
|
1071
1336
|
sourceChunkPath: string;
|
|
1072
1337
|
filePath?: string;
|
|
1338
|
+
assetUrl?: string;
|
|
1339
|
+
pageNumbers?: number[];
|
|
1073
1340
|
metadata: Record<string, unknown>;
|
|
1074
1341
|
}
|
|
1075
1342
|
interface KnowledgeReadResponse {
|
|
1076
1343
|
document: LocalKnowledgeDocument;
|
|
1077
1344
|
chunks: KnowledgeReadChunk[];
|
|
1078
1345
|
nextChunk?: number;
|
|
1346
|
+
page?: number;
|
|
1347
|
+
pageSize?: number;
|
|
1348
|
+
totalChunks?: number;
|
|
1349
|
+
totalPages?: number;
|
|
1079
1350
|
}
|
|
1080
1351
|
interface KnowledgeGrepParams extends KnowledgeDocumentReference {
|
|
1081
1352
|
pattern: string;
|
|
1353
|
+
continuationCursor?: string;
|
|
1082
1354
|
isRegex?: boolean;
|
|
1083
1355
|
isCaseSensitive?: boolean;
|
|
1084
1356
|
maxResults?: number;
|
|
@@ -1102,6 +1374,7 @@ interface KnowledgeGrepResponse {
|
|
|
1102
1374
|
matches: KnowledgeGrepMatch[];
|
|
1103
1375
|
scannedChunks: number;
|
|
1104
1376
|
truncated: boolean;
|
|
1377
|
+
continuationCursor?: string;
|
|
1105
1378
|
}
|
|
1106
1379
|
interface KnowledgeSearchParams {
|
|
1107
1380
|
query: string;
|
|
@@ -1140,15 +1413,27 @@ interface KnowledgeSearchResult {
|
|
|
1140
1413
|
declare class Knowledge {
|
|
1141
1414
|
private readonly client;
|
|
1142
1415
|
private readonly store;
|
|
1416
|
+
private readonly cacheDirectory;
|
|
1417
|
+
private readonly parsedStorageConfig;
|
|
1143
1418
|
constructor(client: Knowhere, options?: {
|
|
1144
1419
|
cacheDirectory?: string;
|
|
1420
|
+
parsedStorage?: ParsedDocumentStorageConfig;
|
|
1145
1421
|
});
|
|
1146
1422
|
withCacheDirectory(cacheDirectory: string): Knowledge;
|
|
1423
|
+
withParsedStorage(parsedStorage: KnowledgeParsedStorageOptions): Knowledge;
|
|
1424
|
+
parseToLocalCache(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
|
|
1425
|
+
/** @deprecated Use parseToLocalCache for local cache imports or the top-level client.parse for server-safe parsing. */
|
|
1147
1426
|
parse(params: KnowledgeParseParams): Promise<LocalKnowledgeParseResponse>;
|
|
1148
1427
|
startParse(params: KnowledgeAsyncParseParams): Promise<KnowledgeAsyncParseResponse>;
|
|
1149
1428
|
getJobStatus(jobId: string): Promise<KnowledgeAsyncJobStatusResponse>;
|
|
1150
1429
|
recoverPendingAsyncParseJobs(): Promise<KnowledgeStartupRecoveryResponse>;
|
|
1430
|
+
loadJobResult(params: KnowledgeLoadJobResultParams): Promise<KnowledgeJobResultResponse>;
|
|
1431
|
+
importJobResult(params: KnowledgeImportJobResultParams): Promise<LocalKnowledgeParseResponse>;
|
|
1432
|
+
/** @deprecated Use importJobResult for local cache imports or loadJobResult for server-safe loads. */
|
|
1151
1433
|
cacheJobResult(params: KnowledgeCacheJobResultParams): Promise<LocalKnowledgeParseResponse>;
|
|
1434
|
+
syncParsedDocument(params: KnowledgeSyncParsedDocumentParams): Promise<KnowledgeSyncParsedDocumentResponse>;
|
|
1435
|
+
private syncParseResultToConfiguredStorage;
|
|
1436
|
+
private parseWithoutClientStorageAdapter;
|
|
1152
1437
|
cacheDocument(params: KnowledgeCacheDocumentParams): Promise<LocalKnowledgeParseResponse>;
|
|
1153
1438
|
private resolveAsyncCache;
|
|
1154
1439
|
listDocuments(): Promise<LocalKnowledgeDocument[]>;
|
|
@@ -1158,6 +1443,20 @@ declare class Knowledge {
|
|
|
1158
1443
|
search(params: KnowledgeSearchParams): Promise<KnowledgeSearchResponse>;
|
|
1159
1444
|
private resolveSearchDocuments;
|
|
1160
1445
|
private loadReadableResult;
|
|
1446
|
+
private readRemoteDocumentChunks;
|
|
1447
|
+
private scanRemoteDocumentChunks;
|
|
1448
|
+
private grepRemoteDocumentChunks;
|
|
1449
|
+
private getRemoteDocumentOutline;
|
|
1450
|
+
private tryReadChunksFromParsedStorage;
|
|
1451
|
+
private tryGrepChunksFromParsedStorage;
|
|
1452
|
+
private tryReadOutlineFromParsedStorage;
|
|
1453
|
+
private readFreshParsedStorageManifest;
|
|
1454
|
+
private readStoredSnapshotChunks;
|
|
1455
|
+
private toRemoteReadChunks;
|
|
1456
|
+
private hardenReadChunkAssetUrls;
|
|
1457
|
+
private scheduleParsedStorageSync;
|
|
1458
|
+
private syncRemoteDocumentToParsedStorage;
|
|
1459
|
+
private requireParsedStorageConfig;
|
|
1161
1460
|
private findLocalDocumentByRemoteId;
|
|
1162
1461
|
private getPublishedDocumentJobId;
|
|
1163
1462
|
}
|
|
@@ -1255,6 +1554,73 @@ declare class Knowhere {
|
|
|
1255
1554
|
|
|
1256
1555
|
declare const VERSION = "0.1.0";
|
|
1257
1556
|
|
|
1557
|
+
declare function storeParseResultAssets(result: ParseResult, options?: KnowhereAssetStorageOptions): Promise<KnowhereAssetStorageResult>;
|
|
1558
|
+
|
|
1559
|
+
declare class DiskParsedDocumentStorage implements ParsedDocumentStorage {
|
|
1560
|
+
private readonly rootDirectory;
|
|
1561
|
+
constructor(rootDirectory: string);
|
|
1562
|
+
readManifest(params: {
|
|
1563
|
+
readonly documentId: string;
|
|
1564
|
+
readonly revisionKey: string;
|
|
1565
|
+
}): Promise<KnowhereParsedSnapshotManifest | null>;
|
|
1566
|
+
writeManifest(params: {
|
|
1567
|
+
readonly documentId: string;
|
|
1568
|
+
readonly revisionKey: string;
|
|
1569
|
+
readonly manifest: KnowhereParsedSnapshotManifest;
|
|
1570
|
+
}): Promise<void>;
|
|
1571
|
+
readChunkPage(params: {
|
|
1572
|
+
readonly documentId: string;
|
|
1573
|
+
readonly revisionKey: string;
|
|
1574
|
+
readonly page: number;
|
|
1575
|
+
}): Promise<KnowhereParsedSnapshotChunkPage | null>;
|
|
1576
|
+
writeChunkPage(params: {
|
|
1577
|
+
readonly documentId: string;
|
|
1578
|
+
readonly revisionKey: string;
|
|
1579
|
+
readonly page: KnowhereParsedSnapshotChunkPage;
|
|
1580
|
+
}): Promise<void>;
|
|
1581
|
+
writeAsset(params: {
|
|
1582
|
+
readonly documentId: string;
|
|
1583
|
+
readonly revisionKey: string;
|
|
1584
|
+
readonly sourcePath: string;
|
|
1585
|
+
readonly body: Uint8Array;
|
|
1586
|
+
readonly contentType: string;
|
|
1587
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
1588
|
+
}): Promise<{
|
|
1589
|
+
readonly sourcePath: string;
|
|
1590
|
+
readonly url?: string;
|
|
1591
|
+
}>;
|
|
1592
|
+
getAssetUrl(params: {
|
|
1593
|
+
readonly documentId: string;
|
|
1594
|
+
readonly revisionKey: string;
|
|
1595
|
+
readonly sourcePath: string;
|
|
1596
|
+
}): Promise<string | null>;
|
|
1597
|
+
readSyncProgress(params: {
|
|
1598
|
+
readonly documentId: string;
|
|
1599
|
+
readonly revisionKey: string;
|
|
1600
|
+
}): Promise<ParsedDocumentSyncProgress | null>;
|
|
1601
|
+
writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
|
|
1602
|
+
private getManifestPath;
|
|
1603
|
+
private getChunkPagePath;
|
|
1604
|
+
private getProgressPath;
|
|
1605
|
+
private getAssetPath;
|
|
1606
|
+
private getRevisionDirectory;
|
|
1607
|
+
private readOptionalJson;
|
|
1608
|
+
private writeJson;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
declare function syncParseResultToParsedDocumentStorage(params: {
|
|
1612
|
+
readonly result: ParseResult;
|
|
1613
|
+
readonly storage: ParsedDocumentStorage;
|
|
1614
|
+
readonly documentId?: string;
|
|
1615
|
+
readonly revisionKey?: string;
|
|
1616
|
+
readonly chunkPageSize?: number;
|
|
1617
|
+
}): Promise<{
|
|
1618
|
+
readonly result: ParseResult;
|
|
1619
|
+
readonly snapshot?: KnowhereParsedSnapshot;
|
|
1620
|
+
readonly documentId: string;
|
|
1621
|
+
readonly revisionKey: string;
|
|
1622
|
+
}>;
|
|
1623
|
+
|
|
1258
1624
|
/**
|
|
1259
1625
|
* Base error class for all Knowhere SDK errors
|
|
1260
1626
|
*/
|
|
@@ -1384,4 +1750,4 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1384
1750
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1385
1751
|
}
|
|
1386
1752
|
|
|
1387
|
-
export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, KnowhereError, type KnowhereOptions, Knowledge, type KnowledgeAsyncJobStatusResponse, type KnowledgeAsyncParseParams, type KnowledgeAsyncParseResponse, type KnowledgeCacheDocumentParams, type KnowledgeCacheJobResultParams, type KnowledgeChunkType, type KnowledgeDocumentReference, type KnowledgeGrepMatch, type KnowledgeGrepParams, type KnowledgeGrepResponse, type KnowledgeOutline, type KnowledgeParseParams, type KnowledgeReadChunk, type KnowledgeReadParams, type KnowledgeReadResponse, type KnowledgeSearchParams, type KnowledgeSearchReference, type KnowledgeSearchResponse, type KnowledgeSearchResult, type KnowledgeSection, type KnowledgeStartupRecoveryResponse, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NetworkError, NotFoundError, type ParseParams, type ParseResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalFilterMode, type RetrievalQueryParams, type RetrievalQueryResponse, type RetrievalReferencedChunk, type RetrievalResult, type RetrievalSectionExclusion, type RetrievalSource, ServiceUnavailableError, type Statistics, type TableChunk, type TextChunk, TimeoutError, type UploadParams, type UploadProgress, VERSION, ValidationError, type WaitOptions, type WebhookConfig, Knowhere as default };
|
|
1753
|
+
export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, DiskParsedDocumentStorage, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, type DocumentPageCitationSource, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, type KnowhereAssetStorageAdapter, type KnowhereAssetStorageBody, type KnowhereAssetStorageHead, type KnowhereAssetStorageObject, type KnowhereAssetStorageOptions, type KnowhereAssetStorageResult, type KnowhereAssetStorageWriteResult, KnowhereError, type KnowhereOptions, type KnowhereParsedSnapshot, type KnowhereParsedSnapshotChunk, type KnowhereParsedSnapshotChunkPage, type KnowhereParsedSnapshotChunkPageReference, type KnowhereParsedSnapshotManifest, Knowledge, type KnowledgeAsyncJobStatusResponse, type KnowledgeAsyncParseParams, type KnowledgeAsyncParseResponse, type KnowledgeCacheDocumentParams, type KnowledgeCacheJobResultParams, type KnowledgeChunkType, type KnowledgeDocumentReference, type KnowledgeGrepMatch, type KnowledgeGrepParams, type KnowledgeGrepResponse, type KnowledgeImportJobResultParams, type KnowledgeJobResultResponse, type KnowledgeLoadJobResultParams, type KnowledgeOutline, type KnowledgeParseParams, type KnowledgeParsedStorageOptions, type KnowledgeReadChunk, type KnowledgeReadParams, type KnowledgeReadResponse, type KnowledgeSearchParams, type KnowledgeSearchReference, type KnowledgeSearchResponse, type KnowledgeSearchResult, type KnowledgeSection, type KnowledgeStartupRecoveryResponse, type KnowledgeSyncParsedDocumentParams, type KnowledgeSyncParsedDocumentResponse, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentAssetUrlPolicy, type ParsedDocumentStorage, type ParsedDocumentStorageAsset, type ParsedDocumentStorageAssetParams, type ParsedDocumentStorageChunkPageParams, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentStorageManifestParams, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalFilterMode, type RetrievalQueryParams, type RetrievalQueryResponse, type RetrievalReferencedChunk, type RetrievalResult, type RetrievalSectionExclusion, type RetrievalSource, ServiceUnavailableError, type Statistics, type TableChunk, type TextChunk, TimeoutError, type UploadParams, type UploadProgress, VERSION, ValidationError, type WaitOptions, type WebhookConfig, Knowhere as default, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
|