@ontos-ai/knowhere-sdk 2.3.0 → 2.4.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 CHANGED
@@ -311,12 +311,13 @@ const response = await client.retrieval.query({
311
311
 
312
312
  console.log(response.answerText); // LLM-generated answer
313
313
  console.log(response.referencedChunks); // cited evidence chunks
314
- console.log(response.evidenceText); // rendered evidence context, when returned
314
+ console.log(response.evidence); // composed parts to consume (text/HTML and inline images)
315
+ console.log(response.evidenceText); // text projection of those parts
315
316
  console.log(response.stopReason); // agentic termination reason, when returned
316
317
  console.log(response.failureReason); // no-answer reason, when returned
317
318
 
318
319
  for (const result of response.results) {
319
- console.log(result.content);
320
+ console.log(result.content); // raw path chunk for debug
320
321
  console.log(result.contentSource);
321
322
  console.log(result.score);
322
323
  console.log(result.metadata?.pageNums);
package/dist/index.d.mts CHANGED
@@ -883,13 +883,24 @@ interface RetrievalSource {
883
883
  /** Human-readable section path */
884
884
  sectionPath?: string | null;
885
885
  }
886
+ /**
887
+ * One composed evidence part. Tables stay in text as HTML; images are inline bytes.
888
+ */
889
+ type RetrievalEvidencePart = {
890
+ type: 'text';
891
+ text: string;
892
+ } | {
893
+ type: 'image';
894
+ mediaType: string;
895
+ data: string;
896
+ };
886
897
  /**
887
898
  * Canonical chunk result returned by retrieval query.
888
899
  */
889
900
  interface RetrievalResult {
890
901
  /** Parser-provided chunk identifier when included by the API */
891
902
  chunkId?: string;
892
- /** Knowledge content to use directly in the caller's answer */
903
+ /** Raw chunk body for debug. Placeholders stay intact. */
893
904
  content: string;
894
905
  /** Chunk type, for example text, image, table, or page */
895
906
  chunkType: string;
@@ -936,8 +947,10 @@ interface RetrievalReferencedChunk {
936
947
  /**
937
948
  * Response from POST /v2/retrieval/query.
938
949
  *
939
- * Three PRIMARY output fields for downstream agent consumption:
940
- * - `evidenceText`: hierarchical evidence tree for LLM context
950
+ * Downstream agents consume:
951
+ * - `evidence`: composed parts (text/HTML and inline images)
952
+ * - `evidenceText`: text projection of those parts
953
+ * - `results`: raw path chunks for debug
941
954
  * - `decisionTrace`: per-step navigation decisions (includes stop/failure)
942
955
  * - `referencedChunks`: structured chunk citations for follow-up queries
943
956
  */
@@ -948,11 +961,13 @@ interface RetrievalQueryResponse {
948
961
  query: string;
949
962
  /** Retrieval router path used by the API for this query */
950
963
  routerUsed: string;
964
+ /** Composed evidence parts in result order */
965
+ evidence?: RetrievalEvidencePart[];
951
966
  /** LLM-generated natural-language answer, or null when no answer was produced */
952
967
  answerText: string | null;
953
968
  /** Cited evidence chunks with asset URLs when available */
954
969
  referencedChunks: RetrievalReferencedChunk[];
955
- /** Tree-structured evidence text rendered by the agentic navigator */
970
+ /** Text projection of evidence. Tables stay as HTML; images are data URLs. */
956
971
  evidenceText?: string | null;
957
972
  /** Reason why the agentic run stopped (e.g. answer_done, not_found) */
958
973
  stopReason?: string | null;
@@ -1389,6 +1404,7 @@ interface KnowledgeSearchReference {
1389
1404
  interface KnowledgeSearchResponse {
1390
1405
  namespace?: string;
1391
1406
  query: string;
1407
+ evidence?: RetrievalEvidencePart[];
1392
1408
  evidenceText?: string | null;
1393
1409
  references: KnowledgeSearchReference[];
1394
1410
  results: KnowledgeSearchResult[];
@@ -1728,4 +1744,4 @@ declare class JobFailedError extends KnowhereError {
1728
1744
  constructor(message: string, code: string, jobResult: JobResult);
1729
1745
  }
1730
1746
 
1731
- 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, 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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
1747
+ 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, 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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalEvidencePart, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
package/dist/index.d.ts CHANGED
@@ -883,13 +883,24 @@ interface RetrievalSource {
883
883
  /** Human-readable section path */
884
884
  sectionPath?: string | null;
885
885
  }
886
+ /**
887
+ * One composed evidence part. Tables stay in text as HTML; images are inline bytes.
888
+ */
889
+ type RetrievalEvidencePart = {
890
+ type: 'text';
891
+ text: string;
892
+ } | {
893
+ type: 'image';
894
+ mediaType: string;
895
+ data: string;
896
+ };
886
897
  /**
887
898
  * Canonical chunk result returned by retrieval query.
888
899
  */
889
900
  interface RetrievalResult {
890
901
  /** Parser-provided chunk identifier when included by the API */
891
902
  chunkId?: string;
892
- /** Knowledge content to use directly in the caller's answer */
903
+ /** Raw chunk body for debug. Placeholders stay intact. */
893
904
  content: string;
894
905
  /** Chunk type, for example text, image, table, or page */
895
906
  chunkType: string;
@@ -936,8 +947,10 @@ interface RetrievalReferencedChunk {
936
947
  /**
937
948
  * Response from POST /v2/retrieval/query.
938
949
  *
939
- * Three PRIMARY output fields for downstream agent consumption:
940
- * - `evidenceText`: hierarchical evidence tree for LLM context
950
+ * Downstream agents consume:
951
+ * - `evidence`: composed parts (text/HTML and inline images)
952
+ * - `evidenceText`: text projection of those parts
953
+ * - `results`: raw path chunks for debug
941
954
  * - `decisionTrace`: per-step navigation decisions (includes stop/failure)
942
955
  * - `referencedChunks`: structured chunk citations for follow-up queries
943
956
  */
@@ -948,11 +961,13 @@ interface RetrievalQueryResponse {
948
961
  query: string;
949
962
  /** Retrieval router path used by the API for this query */
950
963
  routerUsed: string;
964
+ /** Composed evidence parts in result order */
965
+ evidence?: RetrievalEvidencePart[];
951
966
  /** LLM-generated natural-language answer, or null when no answer was produced */
952
967
  answerText: string | null;
953
968
  /** Cited evidence chunks with asset URLs when available */
954
969
  referencedChunks: RetrievalReferencedChunk[];
955
- /** Tree-structured evidence text rendered by the agentic navigator */
970
+ /** Text projection of evidence. Tables stay as HTML; images are data URLs. */
956
971
  evidenceText?: string | null;
957
972
  /** Reason why the agentic run stopped (e.g. answer_done, not_found) */
958
973
  stopReason?: string | null;
@@ -1389,6 +1404,7 @@ interface KnowledgeSearchReference {
1389
1404
  interface KnowledgeSearchResponse {
1390
1405
  namespace?: string;
1391
1406
  query: string;
1407
+ evidence?: RetrievalEvidencePart[];
1392
1408
  evidenceText?: string | null;
1393
1409
  references: KnowledgeSearchReference[];
1394
1410
  results: KnowledgeSearchResult[];
@@ -1728,4 +1744,4 @@ declare class JobFailedError extends KnowhereError {
1728
1744
  constructor(message: string, code: string, jobResult: JobResult);
1729
1745
  }
1730
1746
 
1731
- 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, 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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
1747
+ 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, 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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalEvidencePart, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
package/dist/index.js CHANGED
@@ -2637,6 +2637,7 @@ var Knowledge = class _Knowledge {
2637
2637
  return {
2638
2638
  namespace: rawResponse.namespace,
2639
2639
  query: rawResponse.query,
2640
+ evidence: rawResponse.evidence ?? [],
2640
2641
  evidenceText: rawResponse.evidenceText,
2641
2642
  references: [
2642
2643
  ...rawResponse.referencedChunks.map(
package/dist/index.mjs CHANGED
@@ -2572,6 +2572,7 @@ var Knowledge = class _Knowledge {
2572
2572
  return {
2573
2573
  namespace: rawResponse.namespace,
2574
2574
  query: rawResponse.query,
2575
+ evidence: rawResponse.evidence ?? [],
2575
2576
  evidenceText: rawResponse.evidenceText,
2576
2577
  references: [
2577
2578
  ...rawResponse.referencedChunks.map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontos-ai/knowhere-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Official Node.js SDK for Knowhere document parsing API",
5
5
  "keywords": [
6
6
  "knowhere",