If you are authoring a new plugin you can do anything.
That said, if all you want covered by the existing Discourse AI feature set, all you need is to install Discourse AI and go to the LLM configuration setting and configure it there, as we should support Perplexity API out of the box.