@ontos-ai/knowhere-sdk 0.7.0 → 0.8.0
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 +12 -4
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +2 -5
- package/dist/index.mjs +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,6 +147,10 @@ For granular control over the job lifecycle:
|
|
|
147
147
|
const job = await client.jobs.create({
|
|
148
148
|
sourceType: 'file',
|
|
149
149
|
fileName: 'document.pdf',
|
|
150
|
+
documentMetadata: {
|
|
151
|
+
createdByClient: 'cli',
|
|
152
|
+
sourceFileName: 'document.pdf',
|
|
153
|
+
},
|
|
150
154
|
parsingParams: { model: 'advanced', ocrEnabled: true },
|
|
151
155
|
});
|
|
152
156
|
|
|
@@ -168,19 +172,23 @@ const result = await client.jobs.load(jobResult);
|
|
|
168
172
|
### Retrieval and Document Lifecycle
|
|
169
173
|
|
|
170
174
|
Published documents are queryable through the retrieval API after a job
|
|
171
|
-
finishes. `client.jobs.create(...)`
|
|
172
|
-
|
|
173
|
-
archive the same document later.
|
|
175
|
+
finishes. `client.jobs.create(...)` may return a planned `documentId`; persist
|
|
176
|
+
`jobResult.documentId` after publication as the canonical value if you need to
|
|
177
|
+
update or archive the same document later.
|
|
174
178
|
|
|
175
179
|
```typescript
|
|
176
180
|
const job = await client.jobs.create({
|
|
177
181
|
sourceType: 'url',
|
|
178
182
|
sourceUrl: 'https://example.com/manual.pdf',
|
|
179
183
|
namespace: 'support-center',
|
|
184
|
+
documentMetadata: {
|
|
185
|
+
createdByClient: 'notebook',
|
|
186
|
+
title: 'Support manual',
|
|
187
|
+
},
|
|
180
188
|
});
|
|
181
189
|
|
|
182
190
|
const jobResult = await client.jobs.wait(job.jobId);
|
|
183
|
-
const documentId = jobResult.documentId;
|
|
191
|
+
const documentId = jobResult.documentId ?? job.documentId;
|
|
184
192
|
|
|
185
193
|
if (!documentId) {
|
|
186
194
|
throw new Error('Expected documentId after successful publication.');
|
package/dist/index.d.mts
CHANGED
|
@@ -46,6 +46,8 @@ interface Job {
|
|
|
46
46
|
dataId?: string;
|
|
47
47
|
/** Retrieval namespace for the canonical document */
|
|
48
48
|
namespace?: string;
|
|
49
|
+
/** Planned stable document identifier for this job, when returned by the API */
|
|
50
|
+
documentId?: string;
|
|
49
51
|
/** Job creation timestamp */
|
|
50
52
|
createdAt: Date;
|
|
51
53
|
/** Presigned URL for file upload (if sourceType is 'file') */
|
|
@@ -154,6 +156,10 @@ interface WebhookConfig {
|
|
|
154
156
|
/** Webhook URL to notify on job completion */
|
|
155
157
|
url: string;
|
|
156
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Client-provided display metadata copied onto the published document.
|
|
161
|
+
*/
|
|
162
|
+
type DocumentMetadata = Record<string, unknown>;
|
|
157
163
|
/**
|
|
158
164
|
* Job creation parameters
|
|
159
165
|
*/
|
|
@@ -170,6 +176,8 @@ interface CreateJobParams {
|
|
|
170
176
|
namespace?: string;
|
|
171
177
|
/** Existing document identifier when updating a published document */
|
|
172
178
|
documentId?: string;
|
|
179
|
+
/** Display metadata to copy onto the published document */
|
|
180
|
+
documentMetadata?: DocumentMetadata;
|
|
173
181
|
/** Parsing configuration */
|
|
174
182
|
parsingParams?: ParsingParams;
|
|
175
183
|
/** Webhook configuration */
|
|
@@ -236,6 +244,8 @@ interface ParseParams {
|
|
|
236
244
|
namespace?: string;
|
|
237
245
|
/** Existing document identifier when updating a published document */
|
|
238
246
|
documentId?: string;
|
|
247
|
+
/** Display metadata to copy onto the published document */
|
|
248
|
+
documentMetadata?: DocumentMetadata;
|
|
239
249
|
/** Additional fragment description */
|
|
240
250
|
addFragDesc?: string;
|
|
241
251
|
/** Knowledge base directory */
|
|
@@ -780,6 +790,8 @@ interface Document {
|
|
|
780
790
|
currentJobResultId?: string;
|
|
781
791
|
/** Original source file name */
|
|
782
792
|
sourceFileName?: string;
|
|
793
|
+
/** Client-provided display metadata copied from the publishing job */
|
|
794
|
+
documentMetadata?: Record<string, unknown>;
|
|
783
795
|
/** Document creation timestamp */
|
|
784
796
|
createdAt?: Date;
|
|
785
797
|
/** Last update timestamp */
|
|
@@ -1330,4 +1342,4 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1330
1342
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1331
1343
|
}
|
|
1332
1344
|
|
|
1333
|
-
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 DocumentListResponse, 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 KnowledgeCacheJobResultParams, type KnowledgeChunkType, 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 };
|
|
1345
|
+
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 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 KnowledgeCacheJobResultParams, type KnowledgeChunkType, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ interface Job {
|
|
|
46
46
|
dataId?: string;
|
|
47
47
|
/** Retrieval namespace for the canonical document */
|
|
48
48
|
namespace?: string;
|
|
49
|
+
/** Planned stable document identifier for this job, when returned by the API */
|
|
50
|
+
documentId?: string;
|
|
49
51
|
/** Job creation timestamp */
|
|
50
52
|
createdAt: Date;
|
|
51
53
|
/** Presigned URL for file upload (if sourceType is 'file') */
|
|
@@ -154,6 +156,10 @@ interface WebhookConfig {
|
|
|
154
156
|
/** Webhook URL to notify on job completion */
|
|
155
157
|
url: string;
|
|
156
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Client-provided display metadata copied onto the published document.
|
|
161
|
+
*/
|
|
162
|
+
type DocumentMetadata = Record<string, unknown>;
|
|
157
163
|
/**
|
|
158
164
|
* Job creation parameters
|
|
159
165
|
*/
|
|
@@ -170,6 +176,8 @@ interface CreateJobParams {
|
|
|
170
176
|
namespace?: string;
|
|
171
177
|
/** Existing document identifier when updating a published document */
|
|
172
178
|
documentId?: string;
|
|
179
|
+
/** Display metadata to copy onto the published document */
|
|
180
|
+
documentMetadata?: DocumentMetadata;
|
|
173
181
|
/** Parsing configuration */
|
|
174
182
|
parsingParams?: ParsingParams;
|
|
175
183
|
/** Webhook configuration */
|
|
@@ -236,6 +244,8 @@ interface ParseParams {
|
|
|
236
244
|
namespace?: string;
|
|
237
245
|
/** Existing document identifier when updating a published document */
|
|
238
246
|
documentId?: string;
|
|
247
|
+
/** Display metadata to copy onto the published document */
|
|
248
|
+
documentMetadata?: DocumentMetadata;
|
|
239
249
|
/** Additional fragment description */
|
|
240
250
|
addFragDesc?: string;
|
|
241
251
|
/** Knowledge base directory */
|
|
@@ -780,6 +790,8 @@ interface Document {
|
|
|
780
790
|
currentJobResultId?: string;
|
|
781
791
|
/** Original source file name */
|
|
782
792
|
sourceFileName?: string;
|
|
793
|
+
/** Client-provided display metadata copied from the publishing job */
|
|
794
|
+
documentMetadata?: Record<string, unknown>;
|
|
783
795
|
/** Document creation timestamp */
|
|
784
796
|
createdAt?: Date;
|
|
785
797
|
/** Last update timestamp */
|
|
@@ -1330,4 +1342,4 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1330
1342
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1331
1343
|
}
|
|
1332
1344
|
|
|
1333
|
-
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 DocumentListResponse, 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 KnowledgeCacheJobResultParams, type KnowledgeChunkType, 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 };
|
|
1345
|
+
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 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 KnowledgeCacheJobResultParams, type KnowledgeChunkType, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1322,11 +1322,7 @@ var Jobs = class extends BaseResource {
|
|
|
1322
1322
|
* Create a new parsing job
|
|
1323
1323
|
*/
|
|
1324
1324
|
async create(params) {
|
|
1325
|
-
const job = await this.httpClient.post(
|
|
1326
|
-
"/v1/jobs",
|
|
1327
|
-
params
|
|
1328
|
-
);
|
|
1329
|
-
delete job.documentId;
|
|
1325
|
+
const job = await this.httpClient.post("/v1/jobs", params);
|
|
1330
1326
|
if (job.uploadUrl) {
|
|
1331
1327
|
this.pendingUploadJobs.set(job.jobId, job);
|
|
1332
1328
|
}
|
|
@@ -2343,6 +2339,7 @@ var Knowhere = class {
|
|
|
2343
2339
|
dataId: params.dataId,
|
|
2344
2340
|
namespace: params.namespace,
|
|
2345
2341
|
documentId: params.documentId,
|
|
2342
|
+
documentMetadata: params.documentMetadata,
|
|
2346
2343
|
parsingParams: buildParsingParams(params),
|
|
2347
2344
|
webhook
|
|
2348
2345
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1262,11 +1262,7 @@ var Jobs = class extends BaseResource {
|
|
|
1262
1262
|
* Create a new parsing job
|
|
1263
1263
|
*/
|
|
1264
1264
|
async create(params) {
|
|
1265
|
-
const job = await this.httpClient.post(
|
|
1266
|
-
"/v1/jobs",
|
|
1267
|
-
params
|
|
1268
|
-
);
|
|
1269
|
-
delete job.documentId;
|
|
1265
|
+
const job = await this.httpClient.post("/v1/jobs", params);
|
|
1270
1266
|
if (job.uploadUrl) {
|
|
1271
1267
|
this.pendingUploadJobs.set(job.jobId, job);
|
|
1272
1268
|
}
|
|
@@ -2283,6 +2279,7 @@ var Knowhere = class {
|
|
|
2283
2279
|
dataId: params.dataId,
|
|
2284
2280
|
namespace: params.namespace,
|
|
2285
2281
|
documentId: params.documentId,
|
|
2282
|
+
documentMetadata: params.documentMetadata,
|
|
2286
2283
|
parsingParams: buildParsingParams(params),
|
|
2287
2284
|
webhook
|
|
2288
2285
|
});
|