n_dim (int) – dimension of an embedding.
dist_metric (str) – Distance metric for DocArrayHnswSearch can be one of:
“cosine”, “ip”, and “l2”. Defaults to “cosine”.
max_elements (int) – Maximum number of vectors that can be stored.
Defaults to 1024.
index (bool) – Whether an index should be built for this field.
Defaults to True.
ef_construction (int) – defines a construction time/accuracy trade-off.
Defaults to 200.
ef (int) – parameter controlling query time/accuracy trade-off.
Defaults to 10.
M (int) – parameter that defines the maximum number of outgoing
connections in the graph. Defaults to 16.
allow_replace_deleted (bool) – Enables replacing of deleted elements
with new added ones. Defaults to True.
num_threads (int) – Sets the number of cpu threads to use. Defaults to 1.
**kwargs – Other keyword arguments to be passed to the get_doc_cls method.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, work_dir: Optional[str] = None, n_dim: Optional[int] = None, **kwargs: Any) → langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch[source]#
Create an DocArrayHnswSearch store and insert data.
Parameters
texts (List[str]) – Text data.
embedding (Embeddings) – Embedding function.
metadatas (Optional[List[dict]]) – Metadata for each text if it exists.
Defaults to None.
work_dir (str) – path to the location where all the data will be stored.
n_dim (int) – dimension of an embedding.
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html