Class PerplexityClient
- All Implemented Interfaces:
com.tnsai.llm.LLMClient
Perplexity hosts search-augmented LLMs (the Sonar family). Models
fetch web results inline and ground their answers in real-time sources.
The API is OpenAI-compatible at https://api.perplexity.ai —
same chat-completions wire format as GroqClient /
XAIGrokClient / YiClient.
Supported models (at time of writing):
- sonar — fast / cheap search-grounded answer
- sonar-pro — higher-quality search + synthesis tier
- sonar-reasoning — chain-of-thought reasoning over search results
- sonar-deep-research — multi-hop deep research mode
The catalog evolves; check the live list at docs.perplexity.ai.
About citations. Perplexity's responses include a
citations[] array alongside the standard OpenAI
choices[].message.content text. The shared
invalid reference
ChatResponseChatResponse extension and a
follow-up issue.
Configuration via environment variable:
PERPLEXITY_API_KEY— Required.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPerplexityClient(String model) PerplexityClient(String model, float temperature) PerplexityClient(String model, float temperature, Float topP, Integer maxTokens) PerplexityClient(String model, float temperature, Integer maxTokens) PerplexityClient(String baseUrl, String model, float temperature, Float topP, Integer maxTokens, String apiKey) PerplexityClient(String baseUrl, String model, float temperature, Integer maxTokens, String apiKey) -
Method Summary
Methods inherited from class com.tnsai.llm.providers.AbstractOpenAICompatibleClient
chat, streamChatMethods inherited from class com.tnsai.llm.providers.AbstractLLMClient
getBaseUrl, getCallTimeoutMs, getMaxTokens, getModel, getTemperature, getTopPMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.llm.LLMClient
chat, chat, chat, chat, chat, getCapabilities, getProviderName, listModels, streamChat, streamChat, streamChatWithHandler, streamChatWithHandler, streamChatWithSpec, streamChatWithSpec
-
Constructor Details
-
PerplexityClient
-
PerplexityClient
-
PerplexityClient
-
PerplexityClient
-
PerplexityClient
-
PerplexityClient
-