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..0bd1d0a 100644 --- a/src/types/result.ts +++ b/src/types/result.ts @@ -85,14 +85,20 @@ 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 }; } /**