Perplexity AI Integration with SmythOS
Want to build agents with access to real-time web knowledge? Connect Perplexity AI to SmythOS and empower them with conversational search models that provide up-to-date, sourced answers.
List of Perplexity AI Components
The Perplexity AI integration provides a single, powerful component for accessing their suite of language models.
Component | Action | What it Does | Inputs | Key Outputs | Use Case |
---|---|---|---|---|---|
Chat Completion | AI Task | Runs chat and text generation on various models, including web-connected ones. | required prompt optional model | message_content | Research, fact-checking, content creation. |
Prerequisites
Before you begin, please ensure you have the following:
- An active SmythOS account. (Sign up here).
- A Perplexity AI account.
- Your Perplexity AI API Key.
Getting Started With Perplexity AI
The connection between SmythOS and Perplexity AI is configured using a secure API key.
Step 1: Get Your Perplexity AI API Key
- Log in to your Perplexity AI account.
- Navigate to your account settings and click on the API section, or go directly to
https://www.perplexity.ai/settings/api
. - Click Generate to create a new API key.
- Copy the key to your clipboard.
Step 2: Store Your API Key in SmythOS Vault
Your API Key is a sensitive credential. Use the SmythOS Vault
to store it securely.
- In your SmythOS dashboard, navigate to the Vault.
- Create a new secret and paste your Perplexity AI API Key as the value. Give it a memorable name, like
perplexity_api_key
. - For more details, see the Vault Documentation.
Step 3: Configure the Perplexity AI Component
- In your SmythOS agent graph, drag and drop the Perplexity AI Chat Completion component.
- Click the component to open its Settings panel.
- In the
API Key
field, select the secret you saved in the Vault (e.g.,perplexity_api_key
). - Select your desired
Model
from the dropdown list. - Your connection is now configured for that component.
Which Perplexity AI Model Should I Use?
If you need to… | Task Type | Recommended Model (Example) | Why this one? |
---|---|---|---|
Answer questions about recent events | Real-time Search | llama-3-sonar-large-32k-online | Provides the best reasoning with live web access. |
Perform a quick, cost-effective task | General Purpose | llama-3-sonar-small-32k-chat | A fast and efficient model for standard NLP tasks. |
Write high-quality, creative content | Creative Writing | llama-3-70b-instruct | A powerful instruction-tuned model for creative and complex generation. |
Balance performance and cost | Balanced | mixtral-8x7b-instruct | A strong mixture-of-experts model with excellent performance for its cost. |
Component Details
This section provides detailed information for the Perplexity AI component.
Chat Completion
Provides a unified interface to send prompts to Perplexity's suite of powerful and web-connected language models.
Component-Specific Settings
- Model: Choose your desired AI model from the dropdown list in the settings panel. Options range from fast, small models to large, web-connected ones.
Inputs
Field | Type | Required | Notes |
---|---|---|---|
prompt | string | Yes | The text input, question, or instruction to send to the language model. |
Outputs
Field | Type | Description |
---|---|---|
message_content | string | The text content of the AI's generated response. |
id | string | The unique identifier for the chat completion request. |
Response | object | The full, raw JSON response from the Perplexity AI API, including usage data. |
Headers | object | The HTTP headers from the API response. |
{
"component": "perplexityai.chatCompletion",
"prompt": "What were the main announcements from the latest Apple event?",
"model": "llama-3-sonar-large-32k-online"
}
Best Practices & Advanced Tips
- Secure Your API Key: Always use the SmythOS
Vault
to store your Perplexity AI API key. - Choose the Right Model: The key to this integration is model selection. Use "online" models for questions that require up-to-date information. Use "chat" or "instruct" models for creative tasks, summarization, or general conversation where live web access isn't needed.
- Craft Clear Prompts: For the best results, especially with "online" models, frame your
prompt
as a clear question or instruction. This helps the model understand when and how to search the web. - Check the
Response
for Sources: When using an "online" model, the fullResponse
object may contain a list of sources the model used to generate the answer. You can parse this for fact-checking and citation.
Troubleshooting Common Issues
-
Error:
401 Unauthorized
- Cause: The API key is missing, invalid, or disabled.
- Solution: Verify that the API key in your SmythOS Vault is correct and matches the one in your Perplexity AI dashboard.
-
Error:
402 Payment Required
- Cause: You may have exceeded your plan's limits or have a billing issue with your Perplexity AI account.
- Solution: Check your account status and billing information on the Perplexity AI website.
-
Error:
404 Not Found
- Cause: This can happen if the API endpoint is incorrect or the specified model name is not valid.
- Solution: Ensure you have selected a valid model from the component's dropdown list. If the issue persists, check Perplexity's API documentation for any recent changes.
-
Error:
429 Too Many Requests
- Cause: You have exceeded the rate limit for your Perplexity AI account or for the specific model you are using.
- Solution: Add a delay in your agent between frequent calls. Check the Perplexity API documentation for specific rate limit information.
What's Next?
You are now ready to build intelligent, fact-aware agents with the SmythOS Perplexity AI Integration!
Consider these ideas:
-
Build an Agent That...
- Acts as a research assistant. It takes a topic, uses an "online" model to gather sourced information, and then uses a standard "chat" model to format that information into a structured report.
- Monitors social media for questions about your product. When a question is found, the agent uses an "online" model to search your public documentation or recent blog posts to find the answer and drafts a reply.
- Creates daily news summaries. Every morning, the agent asks an "online" model, "What are the top 3 headlines in the tech industry today?" and sends the summary to a Slack channel.
-
Explore Other Integrations:
- Combine Perplexity AI with a text-to-speech service like Elevenlabs to create an audio news briefing.
- Use Perplexity to research a topic, then use the Fal.ai Integration to generate a relevant image for the content.
- Feed the output from Perplexity into a Google Sheet to build a repository of sourced facts and research.