Search Results for

    Show / Hide Table of Contents

    Class PerplexityRequest

    Inheritance
    object
    PerplexityRequest
    Implements
    IJsonRequest
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Perplexity
    Assembly: Glitch9.AIDevKit.Provider.Perplexity.dll
    Syntax
    public sealed class PerplexityRequest : IJsonRequest

    Properties

    | Edit this page View Source

    DisableSearch

    Optional. When set to true, disables web search completely and the model will only use its training data to respond. This is useful when you want deterministic responses without external information.

    Declaration
    [JsonProperty("disable_search")]
    public bool? DisableSearch { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    EnableSearchClassifier

    Optional. Enables a classifier that decides if web search is needed based on your query.

    Declaration
    [JsonProperty("enable_search_classifier")]
    public bool? EnableSearchClassifier { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    FrequencyPenalty

    Optional. Decreases likelihood of repetition based on prior frequency. Applies a penalty to tokens based on how frequently they've appeared in the text so far. Values typically range from 0 (no penalty) to 2.0 (strong penalty). Higher values (e.g., 1.5) reduce repetition of the same words and phrases. Useful for preventing the model from getting stuck in loops.

    Declaration
    [JsonProperty("frequency_penalty")]
    public float? FrequencyPenalty { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    LastUpdatedAfterFilter

    Optional. Filters search results to only include content last updated after this date. Format should be %m/%d/%Y (e.g. 3/1/2025)

    Declaration
    [JsonConverter(typeof(PerplexityFilterTimeConveter))]
    [JsonProperty("last_updated_after_filter")]
    public UnixTime? LastUpdatedAfterFilter { get; set; }
    Property Value
    Type Description
    UnixTime?
    | Edit this page View Source

    LastUpdatedBeforeFilter

    Optional. Filters search results to only include content last updated before this date. Format should be %m/%d/%Y (e.g. 3/1/2025)

    Declaration
    [JsonConverter(typeof(PerplexityFilterTimeConveter))]
    [JsonProperty("last_updated_before_filter")]
    public UnixTime? LastUpdatedBeforeFilter { get; set; }
    Property Value
    Type Description
    UnixTime?
    | Edit this page View Source

    MaxTokens

    Optional. The maximum number of completion tokens returned by the API. Controls the length of the model's response. If the response would exceed this limit, it will be truncated. Higher values allow for longer responses but may increase processing time and costs.

    Declaration
    [JsonProperty("max_tokens")]
    public int? MaxTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    MediaResponse

    Perplexity-Specific: Configuration for controlling media content in responses, such as videos and images. Use the overrides property to enable specific media types.

    Declaration
    [JsonProperty("media_response")]
    public MediaResponse MediaResponse { get; set; }
    Property Value
    Type Description
    MediaResponse
    | Edit this page View Source

    Messages

    Required. A list of messages comprising the conversation so far.

    Declaration
    [JsonProperty("messages")]
    public List<PerplexityMessage> Messages { get; set; }
    Property Value
    Type Description
    List<PerplexityMessage>
    | Edit this page View Source

    Model

    Required. The name of the model that will complete your prompt. Choose from our available Sonar models: sonar (lightweight search), sonar-pro (advanced search), sonar-deep-research (exhaustive research), sonar-reasoning (fast reasoning), or sonar-reasoning-pro (premier reasoning).

    Declaration
    [JsonProperty("model")]
    public string Model { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    PresencePenalty

    Optional. Positive values increase the likelihood of discussing new topics. Applies a penalty to tokens that have already appeared in the text, encouraging the model to talk about new concepts. Values typically range from 0 (no penalty) to 2.0 (strong penalty). Higher values reduce repetition but may lead to more off-topic text.

    Declaration
    [JsonProperty("presence_penalty")]
    public float? PresencePenalty { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    ReasoningEffort

    WARNING: This parameter is ONLY applicable for sonar-deep-research.

    Optional. Controls how much computational effort the AI dedicates to each query for deep research models. 'low' provides faster, simpler answers with reduced token usage, 'medium' offers a balanced approach, and 'high' delivers deeper, more thorough responses with increased token usage. WARNING: This parameter is ONLY applicable for sonar-deep-research. Defaults to 'medium' when used with sonar-deep-research.

    Declaration
    [JsonProperty("reasoning_effort")]
    public ReasoningEffort? ReasoningEffort { get; set; }
    Property Value
    Type Description
    ReasoningEffort?
    | Edit this page View Source

    ResponseFormat

    Optional. Enables structured JSON output formatting.

    Declaration
    [JsonProperty("response_format")]
    public JsonSchema ResponseFormat { get; set; }
    Property Value
    Type Description
    JsonSchema
    | Edit this page View Source

    ReturnImages

    Optional. Determines whether search results should include images.

    Declaration
    [JsonProperty("return_images")]
    public bool? ReturnImages { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    ReturnRelatedQuestions

    Optional. Determines whether related questions should be returned.

    Declaration
    [JsonProperty("return_related_questions")]
    public bool? ReturnRelatedQuestions { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    SearchAfterDateFilter

    Optional. Filters search results to only include content published after this date. Format should be %m/%d/%Y (e.g. 3/1/2025)

    Declaration
    [JsonConverter(typeof(PerplexityFilterTimeConveter))]
    [JsonProperty("search_after_date_filter")]
    public UnixTime? SearchAfterDateFilter { get; set; }
    Property Value
    Type Description
    UnixTime?
    | Edit this page View Source

    SearchBeforeDateFilter

    Optional. Filters search results to only include content published before this date. Format should be %m/%d/%Y (e.g. 3/1/2025)

    Declaration
    [JsonConverter(typeof(PerplexityFilterTimeConveter))]
    [JsonProperty("search_before_date_filter")]
    public UnixTime? SearchBeforeDateFilter { get; set; }
    Property Value
    Type Description
    UnixTime?
    | Edit this page View Source

    SearchDomainFilter

    Optional. A list of domains to limit search results to. Currently limited to 10 domains for Allowlisting and Denylisting. For Denylisting, add a - at the beginning of the domain string.

    Declaration
    [JsonProperty("search_domain_filter")]
    public DomainFilter SearchDomainFilter { get; set; }
    Property Value
    Type Description
    DomainFilter
    | Edit this page View Source

    SearchMode

    Optional. Controls the search mode used for the request. When set to 'academic', results will prioritize scholarly sources like peer-reviewed papers and academic journals.

    Declaration
    [JsonProperty("search_mode")]
    public PerplexityTypes.WebSearchMode? SearchMode { get; set; }
    Property Value
    Type Description
    PerplexityTypes.WebSearchMode?
    | Edit this page View Source

    SearchRecencyFilter

    Optional. Filters search results based on time (e.g., 'week', 'day').

    Declaration
    [JsonProperty("search_recency_filter")]
    public string SearchRecencyFilter { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Stream

    Optional. Determines whether to stream the response incrementally.

    Declaration
    [JsonProperty("stream")]
    public bool? Stream { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    Temperature

    Optional. The amount of randomness in the response, valued between 0 and 2. Lower values (e.g., 0.1) make the output more focused, deterministic, and less creative. Higher values (e.g., 1.5) make the output more random and creative. Use lower values for factual/information retrieval tasks and higher values for creative applications.

    Declaration
    [JsonProperty("temperature")]
    public float? Temperature { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    TopK

    Optional. The number of tokens to keep for top-k filtering. Limits the model to consider only the k most likely next tokens at each step. Lower values (e.g., 10) make the output more focused and deterministic, while higher values allow for more diverse outputs. A value of 0 disables this filter. Often used in conjunction with top_p to control output randomness.

    Declaration
    [JsonProperty("top_k")]
    public int? TopK { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    TopP

    Optional. The nucleus sampling threshold, valued between 0 and 1. Controls the diversity of generated text by considering only the tokens whose cumulative probability exceeds the top_p value. Lower values (e.g., 0.5) make the output more focused and deterministic, while higher values (e.g., 0.95) allow for more diverse outputs. Often used as an alternative to temperature.

    Declaration
    [JsonProperty("top_p")]
    public float? TopP { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    WebSearchOptions

    Optional. Configuration for using web search in model responses.

    Declaration
    [JsonProperty("web_search_options")]
    public PerplexityWebSearchOptions WebSearchOptions { get; set; }
    Property Value
    Type Description
    PerplexityWebSearchOptions

    Implements

    IJsonRequest

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation