Repository: activeloopai/Hub
File: deeplake/core/vectorstore/deep_memory.py (Python)

Code before:
        """

        feature_report_path(
            path=self.dataset.path,
            feature_name="dm.evaluate",
            parameters={
                "relevance": relevance,
                "queries": queries,
                "embedding_function": embedding_function,
                "embedding": embedding,
                "top_k": top_k,
                "qvs_params": qvs_params,
            },
            token=self.token,
        )
        try_flushing(self.dataset)
        try:
            from indra import api  # type: ignore

            INDRA_INSTALLED = True
        except Exception:
            INDRA_INSTALLED = False

        if not INDRA_INSTALLED:
            raise ImportError(
                "The C++ library is not installed."
            )

        from indra import api  # type: ignore

        indra_dataset = api.dataset(self.dataset.path, token=self.token)
        api.tql.prepare_deepmemory_metrics(indra_dataset)

        parsed_qvs_params = parse_queries_params(qvs_params)

        start = time()
        query_embs: Union[List[np.ndarray], List[List[float]]]

        if embedding is not None:
            query_embs = embedding
        else:
            if self.embedding_function is not None:
                embedding_function = (
                    embedding_function or self.embedding_function.embed_documents
                )

            if embedding_function is None:
                raise ValueError(
                    "Embedding function should be specifed either during initialization or during evaluation."
                )
            query_embs = embedding_function(queries)

Review comment (suggestion):
We should add. 'The library should be installed using `pip install deeplake`, but if you want to install it separately, you may run `pip install libdeeplake`.'

Code after:
        """

        feature_report_path(
            path=self.dataset.path,
            feature_name="dm.evaluate",
            parameters={
                "relevance": relevance,
                "queries": queries,
                "embedding_function": embedding_function,
                "embedding": embedding,
                "top_k": top_k,
                "qvs_params": qvs_params,
            },
            token=self.token,
        )
        try_flushing(self.dataset)
        try:
            from indra import api  # type: ignore

            INDRA_INSTALLED = True
        except Exception:
            INDRA_INSTALLED = False

        if not INDRA_INSTALLED:
            raise ImportError(
                "The C++ library is not installed. The library should be installed using `pip install deeplake`, but if you want to install it separately, you may run `pip install libdeeplake`"
            )

        from indra import api  # type: ignore

        indra_dataset = api.dataset(self.dataset.path, token=self.token)
        api.tql.prepare_deepmemory_metrics(indra_dataset)

        parsed_qvs_params = parse_queries_params(qvs_params)

        start = time()
        query_embs: Union[List[np.ndarray], List[List[float]]]

        if embedding is not None:
            query_embs = embedding
        else:
            if self.embedding_function is not None:
                embedding_function = (
                    embedding_function or self.embedding_function.embed_documents
                )

            if embedding_function is None:
                raise ValueError(
                    "Embedding function should be specified either during initialization or during evaluation."
                )
            query_embs = embedding_function(queries)