NAME
Langertha::Engine::Perplexity - Perplexity Sonar API
VERSION
version 0.200
SYNOPSIS
use Langertha::Engine::Perplexity;
my $perplexity = Langertha::Engine::Perplexity->new(
api_key => $ENV{PERPLEXITY_API_KEY},
model => 'sonar-pro',
);
print $perplexity->simple_chat('What are the latest Perl releases?');
# Streaming
$perplexity->simple_chat_stream(sub {
print shift->content;
}, 'Summarize recent Perl news');
# Async with Future::AsyncAwait
use Future::AsyncAwait;
my $response = await $perplexity->simple_chat_f('What is new in Perl?');
DESCRIPTION
Provides access to Perplexity's Sonar API. Extends Langertha::Engine::OpenAI with Perplexity's endpoint (https://api.perplexity.ai). Perplexity models are search-augmented LLMs with real-time web access; responses include citations alongside generated text.
Available models: sonar (default, fast), sonar-pro (deeper analysis), sonar-reasoning (chain-of-thought), sonar-reasoning-pro (most capable).
Limitations: tool calling, embeddings, and transcription are not supported. Only chat and streaming are available.
Get your API key at https://www.perplexity.ai/settings/api and set LANGERTHA_PERPLEXITY_API_KEY.
THIS API IS WORK IN PROGRESS
SEE ALSO
https://docs.perplexity.ai/ - Official Perplexity API documentation
Langertha::Engine::OpenAI - Parent class
Langertha - Main Langertha documentation
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudss.us/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.