Skip to main content
View source

Perplexity

View as Markdown

A RocketRide LLM node that connects Perplexity AI's Sonar models to a pipeline with built-in real-time web search.

What it does

Routes questions through Perplexity AI's Sonar family of models, each of which grounds responses in current web content rather than training data alone. The node is registered with classType: llm and the invoke capability, so agents and other LLM-consuming nodes can use it as a drop-in model connection. It can also be driven directly via the questions/answers lane pair.

Uses langchain-openai (ChatOpenAI) against Perplexity's OpenAI-compatible endpoint at https://api.perplexity.ai. Temperature is fixed at 0. The SDK's built-in retries are disabled; the node manages its own retry loop with per-model timeouts and exponential backoff (see "Timeouts and retries" below). Prompt length is checked against the model's token limit before each request, using a word-based estimate (approximately 0.75 words per token).


Configuration

FieldType / DefaultDescription
profileenum, default sonarWhich Sonar model profile to activate (see Profiles)
apikeystringPerplexity AI API key for the selected profile
modelstring (per profile)Perplexity model identifier, set automatically by profile
modelTotalTokensnumber (per profile)Total context window in tokens
modelOutputTokensnumber (per profile)Maximum output tokens per response

The model, modelTotalTokens, and modelOutputTokens values are preset by the chosen profile; only apikey needs to be supplied per profile.

Lanes

Lane inLane outDescription
questionsanswersSend a question directly, receive a generated answer

Profiles

ProfileModelContext (tokens)Max outputModel source
Sonar (default)sonar127,0724,096manual
Sonar Prosonar-pro200,0008,000manual
Sonar Reasoningsonar-reasoning128,0004,096manual
Sonar Reasoning Prosonar-reasoning-pro128,0004,096manual
Sonar Deep Researchsonar-deep-research128,0004,096manual
Perplexity: Sonar Pro Searchsonar-pro-search200,0008,000OpenRouter

All profiles except sonar-pro-search use manually configured model metadata. The sonar-pro-search profile pulls token limits from OpenRouter.


Timeouts and retries

Request timeout and retry behavior scale with model complexity:

Model(s)TimeoutMax retriesBase delay
sonar-deep-research180 s32.0 s
sonar-reasoning* models120 s21.5 s
All other models60 s21.0 s

Retries use exponential backoff (base_delay x 2^attempt) and only fire on transient failures: timeouts, connection/network errors, and HTTP 500/502/503/504 responses. Authentication errors, quota/billing errors, and input validation errors fail immediately without retrying.

After all retries are exhausted, raw API errors are translated into concise user-facing messages covering: bad API key, rate limiting, quota/billing issues, invalid input, model unavailability, content policy violations, timeouts, and network errors.


Authentication

Set apikey to a valid Perplexity AI API key in the selected profile's config panel. The key is validated at save time by sending a minimal 10-token probe request ("Hi") to https://api.perplexity.ai. If the probe fails, a concise warning is surfaced rather than a raw error dump. For HTTP 401 responses that return an HTML page (a known Perplexity behavior), the node extracts the page title or <h1> text and formats it into a readable message.

To obtain an API key, visit https://www.perplexity.ai/settings/api.


Upstream docs


Schema

FieldTypeDescriptionDefault
modelstringModel
Perplexity AI model
modelTotalTokensnumberTokens
Total Tokens
perplexity.profilestringModel
Perplexity AI model
"sonar-pro"

Dependencies

  • openai
  • langchain-openai
  • langchain-core
  • langchain