def _request(
        self, payload: Dict[str, Any], headers: Optional[Dict[str, str]] = None
    ) -> Dict[str, Any]:
        """
        Send a POST request to the configured endpoint with retry and error handling.

        This method handles the HTTP request, including retries on failure, and returns the JSON response.

        Args:
            payload (Dict[str, Any]): Parameters for the request payload.
            headers (Optional[Dict[str, str]]): HTTP headers to include in the request.

        Returns:
            Dict[str, Any]: The decoded JSON response from the server.

        Raises:
            ExtendedRequestException: Raised when the request fails after retries.

        """
        logger.debug(f"Starting synchronous request with payload: {payload}")
        try:
            response = self._client.post(
                self.endpoint,
                headers=self._prepare_headers(headers=headers),
                auth=self.auth,
                json=payload,
            )
            logger.debug(f"Received response with status code: {response.status_code}")
            response.raise_for_status()
            json_response = response.json()
            logger.debug(f"Response JSON: {json_response}")
            return json_response
        except Exception as e:
            last_exception_text = (
                e.response.text if hasattr(e, "response") and e.response else str(e)
            )
            logger.error(
                f"Request failed. Error: {e!s}. Details: {last_exception_text}"
            )
            raise ExtendedRequestException(
                f"Request failed: {e!s}. Details: {last_exception_text}",
                e,
                last_exception_text,
            ) from e

        Send a POST request to the configured endpoint with retry and error handling.

        This method handles the HTTP request, including retries on failure, and returns the JSON response.

        Args:
            payload (Dict[str, Any]): Parameters for the request payload.
            headers (Optional[Dict[str, str]]): HTTP headers to include in the request.

        Returns:
            Dict[str, Any]: The decoded JSON response from the server.

        Raises:
            ExtendedRequestException: Raised when the request fails after retries.

        
llama-index-integrations/embeddings/llama-index-embeddings-oci-data-science/llama_index/embeddings/oci_data_science/client.py