async def get_chat_completions(
        self, context: OpenAILLMContext, messages: List[ChatCompletionMessageParam]
    ) -> AsyncStream[ChatCompletionChunk]:
        """Get chat completions from Perplexity API using OpenAI-compatible parameters.

        Args:
            context: The context containing conversation history and settings
            messages: The messages to send to the API

        Returns:
            A stream of chat completion chunks
        """
        params = {
            "model": self.model_name,
            "stream": True,
            "messages": messages,
        }

        # Add OpenAI-compatible parameters if they're set
        if self._settings["frequency_penalty"] is not NOT_GIVEN:
            params["frequency_penalty"] = self._settings["frequency_penalty"]
        if self._settings["presence_penalty"] is not NOT_GIVEN:
            params["presence_penalty"] = self._settings["presence_penalty"]
        if self._settings["temperature"] is not NOT_GIVEN:
            params["temperature"] = self._settings["temperature"]
        if self._settings["top_p"] is not NOT_GIVEN:
            params["top_p"] = self._settings["top_p"]
        if self._settings["max_tokens"] is not NOT_GIVEN:
            params["max_tokens"] = self._settings["max_tokens"]

        chunks = await self._client.chat.completions.create(**params)
        return chunks
Get chat completions from Perplexity API using OpenAI-compatible parameters.

        Args:
            context: The context containing conversation history and settings
            messages: The messages to send to the API

        Returns:
            A stream of chat completion chunks
        
src/pipecat/services/perplexity/llm.py