From c47e6a2ac680be600ed73289c3a2e3f699c838eb Mon Sep 17 00:00:00 2001 From: chengke <404835780@qq.com> Date: Fri, 16 Oct 2026 10:35:30 +0800 Subject: [PATCH 1/2] feat(types): align ConnectTo relations with embedded_by schema Add embedded_by and reserved relation values, targetDocumentId, and position. Remove unused score/keywords fields the API no longer emits. Co-authored-by: Cursor --- .changeset/connect-to-embedded-by.md | 5 +++++ src/types/result.ts | 23 +++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 .changeset/connect-to-embedded-by.md diff --git a/.changeset/connect-to-embedded-by.md b/.changeset/connect-to-embedded-by.md new file mode 100644 index 0000000..4d5ee9f --- /dev/null +++ b/.changeset/connect-to-embedded-by.md @@ -0,0 +1,5 @@ +--- +"@ontos-ai/knowhere-sdk": patch +--- + +Align `ConnectTo.relation` with the API schema: add `embedded_by` (and reserved relation values), `targetDocumentId`, and `position`. Drop unused `score`/`keywords` fields that the API no longer emits. diff --git a/src/types/result.ts b/src/types/result.ts index 123d1e6..45e1ecc 100644 --- a/src/types/result.ts +++ b/src/types/result.ts @@ -85,14 +85,25 @@ export interface Manifest { export interface ConnectTo { /** Target chunk_id */ target: string; - /** Relationship type */ - relation: 'embeds' | 'related'; + /** + * Relationship type. + * - `embeds`: body chunk -> inline image/table asset + * - `embedded_by`: image/table asset -> owning body chunk (reverse of `embeds`) + * - `related`: same-page body chunk -> asset + * - `cross_doc_entity` / `intra_doc_ref`: reserved, not produced yet + */ + relation: + | 'embeds' + | 'embedded_by' + | 'related' + | 'cross_doc_entity' + | 'intra_doc_ref'; + /** Reserved for cross-document targets; omitted for same-document edges */ + targetDocumentId?: string; /** Placeholder ref in content, e.g. '[images/a.png]' (embeds only) */ ref?: string; - /** Semantic similarity score (related only) */ - score?: number; - /** Shared keywords (related only) */ - keywords?: string[]; + /** Character offsets of `ref` in the body content (embeds only) */ + position?: { start: number; end: number }; } /** From 794a6ad883d19f6ebdd010a520f1da42dd905c06 Mon Sep 17 00:00:00 2001 From: chengke <404835780@qq.com> Date: Fri, 16 Oct 2026 10:37:45 +0800 Subject: [PATCH 2/2] style: format ConnectTo type for prettier Co-authored-by: Cursor --- src/types/result.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/types/result.ts b/src/types/result.ts index 45e1ecc..0bd1d0a 100644 --- a/src/types/result.ts +++ b/src/types/result.ts @@ -92,12 +92,7 @@ export interface ConnectTo { * - `related`: same-page body chunk -> asset * - `cross_doc_entity` / `intra_doc_ref`: reserved, not produced yet */ - relation: - | 'embeds' - | 'embedded_by' - | 'related' - | 'cross_doc_entity' - | 'intra_doc_ref'; + relation: 'embeds' | 'embedded_by' | 'related' | 'cross_doc_entity' | 'intra_doc_ref'; /** Reserved for cross-document targets; omitted for same-document edges */ targetDocumentId?: string; /** Placeholder ref in content, e.g. '[images/a.png]' (embeds only) */