def test_embed_equivalent_to_search_image(self):
        """
            Ensure that the embedding returned by embed endpoint matches the one created by search, on image content.
            Embedding from search is retrieved using mock on query.
        """
        for index in [self.unstructured_default_image_index, self.structured_default_image_index]:
            with self.subTest(index=index.type):
                image_url = TestImageUrls.IMAGE1.value
                original_query = self.config.vespa_client.query

                def pass_through_query(*arg, **kwargs):
                    return original_query(*arg, **kwargs)

                mock_vespa_client_query = unittest.mock.MagicMock()
                mock_vespa_client_query.side_effect = pass_through_query

                @unittest.mock.patch("marqo.vespa.vespa_client.VespaClient.query", mock_vespa_client_query)
                def run():
                    tensor_search.search(
                        config=self.config, index_name=index.name, text=image_url,
                        search_method=enums.SearchMethod.TENSOR
                    )
                    return True

                self.assertTrue(run())

                call_args = mock_vespa_client_query.call_args_list
                self.assertEqual(len(call_args), 1)

                vespa_query_kwargs = call_args[0].kwargs
                search_query_embedding = vespa_query_kwargs["query_features"]["marqo__query_embedding"]

                # Embed request the same text
                embed_res = embed(
                    marqo_config=self.config, index_name=index.name,
                    embedding_request=EmbedRequest(
                        content=[image_url]
                    ),
                    device="cpu"
                )

                # Assert vectors are equal
                self.assertEqual(embed_res["content"], [image_url])
                self.assertTrue(np.allclose(embed_res["embeddings"][0], search_query_embedding))

            Ensure that the embedding returned by embed endpoint matches the one created by search, on image content.
            Embedding from search is retrieved using mock on query.
        
tests/integ_tests/tensor_search/integ_tests/test_embed.py