def _embed_with_retry(
        self, inputs: List[Union[str, BytesIO]], embed_type: str = "text"
    ) -> List[List[float]]:
        """
        Generates embeddings with retry mechanism.

        Args:
            inputs: List of texts or images to embed

        Returns:
            List of embedding vectors

        Raises:
            Exception: If embedding fails after retries

        """
        try:
            if embed_type == "image":
                inputs = [
                    {
                        "prompt_token_ids": [self._image_token_id],
                        "multi_modal_data": {"image": x},
                    }
                    for x in inputs
                ]
            emb = self._client.embed(inputs)
            return [x.outputs.embedding for x in emb]
        except Exception as e:
            logger.warning(f"Embedding attempt failed: {e!s}")
            raise

        Generates embeddings with retry mechanism.

        Args:
            inputs: List of texts or images to embed

        Returns:
            List of embedding vectors

        Raises:
            Exception: If embedding fails after retries

        
llama-index-integrations/embeddings/llama-index-embeddings-vllm/llama_index/embeddings/vllm/base.py