diff --git a/src/brainyData.ts b/src/brainyData.ts index 268d4137..623716c6 100644 --- a/src/brainyData.ts +++ b/src/brainyData.ts @@ -1631,6 +1631,38 @@ export class BrainyData implements BrainyDataInterface { } } + /** + * Import sparse data into the database + * @param data The sparse data to import + * If vectors are not present for nouns, they will be created using the embedding function + * @param options Import options + * @returns Object containing counts of imported items + */ + public async importSparseData( + data: { + nouns: VectorDocument[] + verbs: GraphVerb[] + nounTypes?: string[] + verbTypes?: string[] + hnswIndex?: { + entryPointId: string | null + maxLevel: number + dimension: number | null + config: HNSWConfig + connections: Record> + } + version: string + }, + options: { + clearExisting?: boolean + } = {} + ): Promise<{ + nounsRestored: number + verbsRestored: number + }> { + return this.restore(data, options); + } + /** * Restore data into the database from a previously backed up format * @param data The data to restore, in the format returned by backup()