def request(
        self,
        endpoint: str,
        stream: bool,
        messages: Dict[str, Any],
        extra_headers: Dict[str, Any],
        **kwargs: Any,
    ) -> Dict[str, Any]:
        """
        Perform a synchronous request to the NVIDIA API.

        Args:
            endpoint (str): The API endpoint to send the request to.
            messages (Dict[str, Any]): The request payload.

        Returns:
            Dict[str, Any]: The API response.

        """

        def perform_request():
            payload = {"messages": messages, "stream": stream, **kwargs}
            headers = {
                **self._get_headers(stream=stream),
                **extra_headers,
            }
            response = requests.post(
                endpoint, json=payload, headers=headers, stream=stream
            )
            response.raise_for_status()
            return response

        return perform_request()

        Perform a synchronous request to the NVIDIA API.

        Args:
            endpoint (str): The API endpoint to send the request to.
            messages (Dict[str, Any]): The request payload.

        Returns:
            Dict[str, Any]: The API response.

        
llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-nvidia/llama_index/multi_modal_llms/nvidia/base.py