Static method to create a new HNSWLib instance from texts and metadata. It creates a new Document instance for each text and metadata, then calls the fromDocuments method to create the HNSWLib instance.
fromTexts(
texts: string[],
metadatas: object | object[],
embeddings: EmbeddingsInterface,
dbConfig: __type
): Promise<HNSWLib>| Name | Type | Description |
|---|---|---|
texts* | string[] | The texts to be used to create the documents. |
metadatas* | object | object[] | The metadata to be used to create the documents. |
embeddings* | EmbeddingsInterface | The embeddings to be used by the HNSWLib instance. |
dbConfig | __type | An optional configuration object for the document store. |