def request_stream(
        self, endpoint: str, payload: Dict[str, Any]
    ) -> Generator[str, None, None]:
        """
        Perform a synchronous streaming request to the DeepInfra API.

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

        Yields:
            str: The streaming response from the API.

        """

        def perform_request():
            response = requests.post(
                self.get_url(endpoint),
                json={
                    **payload,
                    "stream": True,
                },
                headers=self._get_headers(),
                stream=True,
                timeout=self.timeout,
            )
            response.raise_for_status()

            for line in response.iter_lines():
                if resp := maybe_decode_sse_data(line):
                    yield resp

        response = retry_request(perform_request, max_retries=self.max_retries)
        yield from response

        Perform a synchronous streaming request to the DeepInfra API.

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

        Yields:
            str: The streaming response from the API.

        
llama-index-integrations/llms/llama-index-llms-deepinfra/llama_index/llms/deepinfra/client.py