Overview
Sonar models provide powerful web search capabilities, but there are times when you want to control when and how searches are performed. Perplexity offers two main approaches for search control:- Search Classifier - Let AI intelligently decide when to search based on the query context
- Disable Search - Turn off web search completely for specific requests
Search control is available across all Sonar models.
Pricing remains the same regardless of whether search is triggered or not. Search control features are designed for performance optimization and user experience, not cost reduction.
Search Classifier
The search classifier is a trained model that automatically determines whether a web search is necessary based on the context and content of your query. This helps optimize performance and costs by only searching when beneficial.How It Works
The classifier analyzes your query and decides whether:- Search is needed - For questions requiring current information, facts, or research
- Search is unnecessary - For creative tasks, math problems, or general knowledge that doesn’t require real-time data
When to Use Search Classifier
Use the search classifier when you want to:- Improve response speed - Skip search for queries that don’t benefit from it
- Automatic intelligence - Let AI decide the best approach for each query
- Optimal user experience - Ensure search is only used when it adds value
Search Classifier Examples
Queries that typically trigger search
Queries that typically trigger search
- “What happened in the stock market today?”
- “Latest news about renewable energy”
- “Current weather in San Francisco”
- “Recent research on machine learning”
Queries that typically skip search
Queries that typically skip search
- “What is 2 + 2?”
- “Write a creative story about a dragon”
- “Explain the concept of recursion”
- “Generate a business name for a bakery”
Disabling Search Completely
For certain use cases, you may want to disable web search entirely. This is useful when:- Offline-like responses - Get responses based only on training data
- Creative tasks - Focus on generation without external influence
- Deterministic responses - Ensure consistent outputs based only on training data
Implementation
To disable search completely, set thedisable_search
parameter to true
:
When search is disabled, responses will be based solely on the model’s training data and may not include the most current information.
Comparison and Best Practices
When to Use Each Approach
Search Classifier
Best for:
- Mixed workloads with varying query types
- Performance optimization without manual intervention
- General-purpose applications
- Unknown query patterns
Disabled Search
Best for:
- Creative content generation
- Mathematical computations
- Sensitive data processing
- Offline-like experiences
Performance Considerations
Search Classifier: Variable response time depending on whether search is triggeredDisabled Search: Consistently faster responses since no search operations occur
Complete Examples
Search Classifier in Action
1
Set up the request with search classifier
The classifier will likely skip search for this general concept explanation.
2
Try with a current events query
The classifier will trigger search for this time-sensitive query.
Creative Task with Disabled Search
Here’s an example of using disabled search for creative content generation:Troubleshooting
Search classifier not working as expected
Search classifier not working as expected
Common causes:
- API key doesn’t have access to classifier features
- Using an unsupported model
- Incorrect parameter syntax
- Verify your API key permissions
- Ensure you’re using a Sonar model
- Check parameter spelling:
enable_search_classifier
Responses seem outdated with disabled search
Responses seem outdated with disabled search
This is expected behavior when search is disabled. The model can only use information from its training data.Solutions:
- Re-enable search for queries requiring current information
- Use search classifier for automatic optimization
- Clearly document when search is disabled for your users
Start with the search classifier for most applications, then selectively disable search for specific use cases where you want guaranteed offline-like behavior.