def persist(
        self,
        persist_path: str = DEFAULT_PERSIST_PATH,
        fs: Optional[fsspec.AbstractFileSystem] = None,
    ) -> None:
        """
        Save to file.

        This method saves the vector store to disk.

        Args:
            persist_path (str): The save_path of the file.

        """
        if fs and not isinstance(fs, LocalFileSystem):
            raise NotImplementedError("Hnswlib only supports local storage for now.")

        parent_directory = Path(persist_path).parent
        parent_directory.mkdir(exist_ok=True)

        config_path = parent_directory / "config.json"
        with open(config_path, "w") as file:
            json.dump(
                {
                    "dim": self._hnswlib_index.dim,
                    "space": self._hnswlib_index.space,
                    "ef": self._hnswlib_index.ef,
                    "ef_construction": self._hnswlib_index.ef_construction,
                    "element_count": self._hnswlib_index.element_count,
                    "max_elements": self._hnswlib_index.max_elements,
                },
                file,
            )
        self._hnswlib_index.save_index(persist_path)

        Save to file.

        This method saves the vector store to disk.

        Args:
            persist_path (str): The save_path of the file.

        
llama-index-integrations/vector_stores/llama-index-vector-stores-hnswlib/llama_index/vector_stores/hnswlib/base.py