Are you sure you want to delete this access key?
This example demonstrates how to use Perplexity's search-augmented chat models to get up-to-date answers with citations, structured outputs, and specialized reasoning.
You can run this example with:
npx promptfoo@latest init --example perplexity.ai-example
This example requires the following environment variables:
PERPLEXITY_API_KEY
- Your Perplexity API key from Perplexity SettingsOPENAI_API_KEY
- Your OpenAI API key (for comparison model in basic example)You can set these in a .env
file or directly in your environment:
export PERPLEXITY_API_KEY=your_api_key_here
export OPENAI_API_KEY=your_api_key_here
This example includes multiple configuration files to demonstrate different Perplexity features:
promptfooconfig.yaml
)Compares different Perplexity search models against a traditional non-search model (GPT-4o-mini):
sonar
: Lightweight search modelsonar-pro
: Advanced search model with high contextsonar-reasoning
: Fast reasoning model with step-by-step thinkingnpx promptfoo@latest eval -c promptfooconfig.yaml
promptfooconfig.structured-output.yaml
)Demonstrates Perplexity's structured output capabilities:
npx promptfoo@latest eval -c promptfooconfig.structured-output.yaml
promptfooconfig.search-filters.yaml
)Shows how to use advanced search filtering options:
npx promptfoo@latest eval -c promptfooconfig.search-filters.yaml
promptfooconfig.research-reasoning.yaml
)Demonstrates specialized models for research and reasoning:
sonar-deep-research
: Comprehensive research modelsonar-reasoning-pro
: Advanced reasoning with Chain of Thoughtr1-1776
: Offline model without search capabilitiesnpx promptfoo@latest eval -c promptfooconfig.research-reasoning.yaml
After initializing the example, you can run any of the configurations:
cd perplexity.ai-example
npx promptfoo@latest eval -c <config-file.yaml>
npx promptfoo@latest view
These examples will show you how to:
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?