async def generate(
        self,
        prompt: str,
        payload: Optional[Dict[str, Any]] = None,
        headers: Optional[Dict[str, str]] = None,
        stream: bool = False,
    ) -> Union[Dict[str, Any], AsyncIterator[Mapping[str, Any]]]:
        """
        Generate text completion for the given prompt.

        Args:
            prompt (str): Input text prompt for the model.
            payload (Optional[Dict[str, Any]]): Additional parameters for the request payload.
            headers (Optional[Dict[str, str]]): HTTP headers to include in the request.
            stream (bool): Whether to use streaming for the response.

        Returns:
            Union[Dict[str, Any], AsyncIterator[Mapping[str, Any]]]: A full JSON response or an async iterator for streaming responses.

        """
        logger.debug(f"Generating text with prompt: {prompt}, stream: {stream}")
        payload = {**(payload or {}), "prompt": prompt}
        headers = {"route": "/v1/completions", **(headers or {})}
        if stream:
            return self._stream(payload=payload, headers=headers)
        return await self._request(payload=payload, headers=headers)

        Generate text completion for the given prompt.

        Args:
            prompt (str): Input text prompt for the model.
            payload (Optional[Dict[str, Any]]): Additional parameters for the request payload.
            headers (Optional[Dict[str, str]]): HTTP headers to include in the request.
            stream (bool): Whether to use streaming for the response.

        Returns:
            Union[Dict[str, Any], AsyncIterator[Mapping[str, Any]]]: A full JSON response or an async iterator for streaming responses.

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