Static method to create a new HNSWLib instance from documents. It creates a new HNSWLib instance, adds the documents to it, then returns the instance.
fromDocuments(
docs: Document<Record<string, any>>[],
embeddings: EmbeddingsInterface,
dbConfig: __type
): Promise<HNSWLib>| Name | Type | Description |
|---|---|---|
docs* | Document<Record<string, any>>[] | The documents to be added to the HNSWLib instance. |
embeddings* | EmbeddingsInterface | The embeddings to be used by the HNSWLib instance. |
dbConfig | __type | An optional configuration object for the document store. |