def from_params(
        cls,
        space: Literal["ip", "cosine", "l2"],
        dimension: int,
        max_elements: int,
        ef: Optional[int] = None,
        **kwargs,
    ) -> "HnswlibVectorStore":
        """
        To avoid creating the `Hnswlib.Index` Yourself You can just specify it's params.
        For more details see [Hnswlib documentation](https://github.com/nmslib/hnswlib?tab=readme-ov-file#api-description).
        """
        try:
            import hnswlib
        except ImportError:
            raise ImportError(IMPORT_ERROR_MSG)

        hnswlib_index = hnswlib.Index(space, dimension)
        hnswlib_index.init_index(max_elements, **kwargs)
        if ef is not None:
            hnswlib_index.set_ef(ef)
        return cls(hnswlib_index)

        To avoid creating the `Hnswlib.Index` Yourself You can just specify it's params.
        For more details see [Hnswlib documentation](https://github.com/nmslib/hnswlib?tab=readme-ov-file#api-description).
        
llama-index-integrations/vector_stores/llama-index-vector-stores-hnswlib/llama_index/vector_stores/hnswlib/base.py