This guide will help you understand and utilize the various parameters available in the Openperplex API to customize your search queries and responses.
Optional date for context.Format example: Today is Monday 16 of September 2024 and the time is 6:36 PM.If not provided, the API uses the current date of the server.
User prompt : The user prompt is the prompt that will be used to perform the web search. be as specific as possible and let the system prompt handle the details of the response.
The amount of randomness in the response, valued between 0 inclusive and 1 exclusive. Higher values are more random, and lower values are more deterministic.
The nucleus sampling threshold, valued between 0 and 1 inclusive. For each subsequent token, the model considers the results of the tokens with top_p probability mass. We recommend either altering top_k or top_p, but not both.
The location parameter accepts various country codes to provide localized search results. Here’s a comprehensive list of supported locations:
🇺🇸 us
🇨🇦 ca
🇬🇧 uk
🇲🇽 mx
🇪🇸 es
🇩🇪 de
🇫🇷 fr
🇵🇹 pt
🇧🇪 be
🇳🇱 nl
🇨🇭 ch
🇳🇴 no
🇸🇪 se
🇦🇹 at
🇩🇰 dk
🇫🇮 fi
🇹🇷 tr
🇮🇹 it
🇵🇱 pl
🇷🇺 ru
🇿🇦 za
🇦🇪 ae
🇸🇦 sa
🇦🇷 ar
🇧🇷 br
🇦🇺 au
🇨🇳 cn
🇰🇷 kr
🇯🇵 jp
🇮🇳 in
🇵🇸 ps
🇰🇼 kw
🇴🇲 om
🇶🇦 qa
🇮🇱 il
🇲🇦 ma
🇪🇬 eg
🇮🇷 ir
🇱🇾 ly
🇾🇪 ye
🇮🇩 id
🇵🇰 pk
🇧🇩 bd
🇲🇾 my
🇵🇭 ph
🇹🇭 th
🇻🇳 vn
Use the appropriate country code to get results relevant to a specific region. For example, use “jp” for Japan-specific results or “br” for Brazil-focused searches.
Be as specific as possible in your query parameter to get more accurate results.
Custom Search advice
Use the custom_search or custom_search_stream to write your own system and user prompts for more specific queries.
always be specific with the user prompt since it will be used for the web search.
Remember to include date context if needed in your system prompt.
if you need citations, you must add the citation prompt in the System prompt.
Leverage Date Context
Use the date_context parameter when searching for time-sensitive information.Use this format : today is 8 of october and the time is 6 PM
Optimize for Locale
Combine location and response_language parameters for the most relevant local results.
Choose the Right Answer Type
Select the appropriate answer_type based on how you plan to display the results in your application.
Write a good user prompt
in the custom_search and custom_search_stream methods, be as specific as possible, let the system_prompthandle the details of the response.be aware that the user_prompt will be used to perform the web search.
By understanding and effectively using these parameters, you can maximize the power of the Openperplex API in your applications. Happy coding!