You can use the system prompt to provide instructions related to style, tone, and language of the response.
The real-time search component of our models does not attend to the system prompt.
Example of a system prompt
You should use the user prompt to pass in the actual query for which you need an answer for. The user prompt will be used to kick off a real-time web search to make sure the answer has the latest and the most relevant information needed.
Example of a user prompt
Our web search-powered models combine the capabilities of LLMs with real-time web searches. Understanding how they differ from traditional LLMs will help you craft more effective prompts.
Unlike traditional LLMs, our web search models require specificity to retrieve relevant search results. Adding just 2-3 extra words of context can dramatically improve performance.
Good Example: “Explain recent advances in climate prediction models for urban planning”
Poor Example: “Tell me about climate models”
While few-shot prompting works well for traditional LLMs, it confuses web search models by triggering searches for your examples rather than your actual query.
Good Example: “Summarize the current research on mRNA vaccine technology”
Poor Example: “Here’s an example of a good summary about vaccines: [example text]. Now summarize the current research on mRNA vaccines.”
Craft prompts with search-friendly terms that would appear on relevant web pages. Consider how experts in the field would describe the topic online.
Good Example: “Compare the energy efficiency ratings of heat pumps vs. traditional HVAC systems for residential use”
Poor Example: “Tell me which home heating is better”
Include critical context to guide the web search toward the most relevant content, but keep prompts concise and focused.
Good Example: “Explain the impact of the 2023 EU digital markets regulations on app store competition for small developers”
Poor Example: “What are the rules for app stores?”
Generic prompts lead to scattered web search results and unfocused responses. Always narrow your scope.
Avoid: “What’s happening in AI?”
Instead: “What are the three most significant commercial applications of generative AI in healthcare in the past year?”
Prompting strategies designed for traditional LLM often don’t work well with web search models. Adapt your approach accordingly.
Avoid: “Act as an expert chef and give me a recipe for sourdough bread. Start by explaining the history of sourdough, then list ingredients, then…”
Instead: “What’s a reliable sourdough bread recipe for beginners? Include ingredients and step-by-step instructions.”
Complex prompts with multiple unrelated questions can confuse the search component. Focus on one topic per query.
Avoid: “Explain quantum computing, and also tell me about regenerative agriculture, and provide stock market predictions.”
Instead: “Explain quantum computing principles that might impact cryptography in the next decade.”
Don’t assume the model will search for what you intended without specific direction. Be explicit about exactly what information you need.
Avoid: “Tell me about the latest developments.”
Instead: “What are the latest developments in offshore wind energy technology announced in the past 6 months?”
Never ask for URLs or source links in your prompts. The generative model cannot see the actual URLs from the web search, which means any URLs it provides in the response text are likely to be hallucinated and incorrect.
URLs and source information are automatically returned in the search_results
field of the API response. This field contains accurate information about the sources used, including:
title
: The title of the source pageurl
: The actual URL of the sourcedate
: The publication date of the contentExample of incorrect prompting:
Example of correct prompting:
The web search and language generation components work differently:
When you ask for URLs in your prompt, the language model will attempt to generate them based on patterns it has seen, but these will not be the actual URLs that were searched. Always use the search_results
field for accurate source information.
LLMs are designed to be “helpful” and may attempt to provide answers even when they lack sufficient information. This can lead to hallucinated or inaccurate responses, especially when asking about sources that Sonar cannot access.
Large Language Models are trained to be assistive and will often try to provide an answer even when they’re not confident about the information. This tendency can be problematic when:
Inaccessible Sources:
Sonar may not be able to access LinkedIn content, but the model might still attempt to provide an answer based on general knowledge or patterns.
Overly Specific Recent Events:
Private information that wouldn’t be publicly searchable may still get a fabricated response.
Use Explicit Instructions: Include clear guidance in your prompts about what to do when information isn’t available:
Set Clear Boundaries:
Request Source Transparency:
Always instruct the model to acknowledge when it cannot find information rather than guessing.
Example: “If you cannot find reliable sources for this information, please say so explicitly.”
Stick to information that is likely to be publicly indexed and searchable.
Avoid: LinkedIn posts, private company documents, closed meetings Prefer: News articles, public reports, official announcements
Frame requests with conditional statements that give the model permission to say “I don’t know.”
Example: “If available, provide details about… Otherwise, indicate what information could not be found.”
For critical information, consider breaking complex requests into smaller, more specific queries to verify consistency.
Strategy: Ask the same question in different ways and compare results for consistency.
Always use Perplexity’s built-in search parameters instead of trying to control search behavior through prompts. API parameters are guaranteed to work and are much more effective than asking the model to filter results.
When you want to control search behavior—such as limiting sources, filtering by date, or adjusting search depth—use the API’s built-in parameters rather than prompt instructions. The search component processes these parameters directly, ensuring reliable and consistent results.
❌ Ineffective - Trying to control via prompts:
✅ Effective - Using built-in parameters:
Built-in parameters are processed directly by the search engine, ensuring they’re applied correctly every time.
Parameters filter results before they reach the language model, leading to more focused and relevant responses.
Keep your prompts focused on what you want the model to generate, not how to search.
API parameters provide predictable behavior across different queries and use cases.
We recommend for users not to tune language parameters such as temperature
, as the default settings for these have already been optimized.
Adjust model parameters based on your specific needs:
Example configuration for technical documentation:
Query Type | Best Practices |
---|---|
Factual Research | • Use specific questions • Use search domain filters for academic sources • Consider “high” search context size |
Creative Content | • Provide detailed style guidelines in system prompt • Specify tone, voice, and audience |
Technical Questions | • Include relevant technical context • Specify preferred programming language/framework • Use domain filters for documentation sites |
Analysis & Insights | • Request step-by-step reasoning • Ask for specific metrics or criteria |