/** * Perplexity Node - Version 1 * Discriminator: resource=chat, operation=complete */ interface Credentials { perplexityApi: CredentialReference; } /** Create one or more completions for a given text */ export type PerplexityV1ChatCompleteParams = { resource: 'chat'; operation: 'complete'; /** * The model which will generate the completion * @default sonar */ model?: 'sonar' | 'sonar-deep-research' | 'sonar-pro' | 'sonar-reasoning-pro' | Expression; /** * Any optional system messages must be sent first, followed by alternating user and assistant messages * @default {"message":[{"role":"user","content":""}]} */ messages?: { /** Message */ message?: Array<{ /** The content of the message to be sent */ content?: string | Expression | PlaceholderValue; /** Role in shaping the model's response, it tells the model how it should behave and interact with the user * @default user */ role?: 'assistant' | 'system' | 'user' | Expression; }>; }; /** * Whether to return only essential fields (ID, citations, message) * @default false */ simplify?: boolean | Expression; /** * Options * @default {} */ options?: { /** Whether to disable web search for this request * @default false */ disableSearch?: boolean | Expression; /** Whether to enable the search classifier * @default false */ enableSearchClassifier?: boolean | Expression; /** Values greater than 1.0 penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim * @default 0 */ frequencyPenalty?: number | Expression; /** Comma-separated list of domains to filter image results from */ imageDomainFilter?: string | Expression | PlaceholderValue; /** Comma-separated list of image formats to filter results by */ imageFormatFilter?: string | Expression | PlaceholderValue; /** ISO 639-1 language code for the response language preference */ languagePreference?: string | Expression | PlaceholderValue; /** Filter results last updated after this date (MM/DD/YYYY) */ lastUpdatedAfter?: string | Expression | PlaceholderValue; /** Filter results last updated before this date (MM/DD/YYYY) */ lastUpdatedBefore?: string | Expression | PlaceholderValue; /** The maximum number of tokens to generate in the completion. The number of tokens requested plus the number of prompt tokens sent in messages must not exceed the context window token limit of model requested. * @default 1 */ maxTokens?: number | Expression; /** The amount of randomness in the response, valued between 0 inclusive and 2 exclusive. Higher values are more random, and lower values are more deterministic. * @default 0.2 */ temperature?: number | Expression; /** A value between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. * @default 0 */ presencePenalty?: number | Expression; /** The level of reasoning effort to apply * @default medium */ reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | Expression; /** JSON schema for structured output. Set type to "json_schema" with a schema property. */ responseFormat?: IDataObject | string | Expression; /** Whether or not a request to an online model should return images. Requires Perplexity API usage Tier-2. * @default false */ returnImages?: boolean | Expression; /** Whether or not a request to an online model should return related questions. Requires Perplexity API usage Tier-2. * @default false */ returnRelatedQuestions?: boolean | Expression; /** Filter results published after this date (MM/DD/YYYY) */ searchAfterDate?: string | Expression | PlaceholderValue; /** Filter results published before this date (MM/DD/YYYY) */ searchBeforeDate?: string | Expression | PlaceholderValue; /** Limit the citations used by the online model to URLs from the specified domains. For blacklisting, add a <code>-</code> to the beginning of the domain string (e.g., <code>-domain1</code>). Currently limited to 3 domains. Requires Perplexity API usage Tier-3. */ searchDomainFilter?: string | Expression | PlaceholderValue; /** Comma-separated list of ISO 639-1 language codes to filter results by (max 20) */ searchLanguageFilter?: string | Expression | PlaceholderValue; /** The search mode to use for retrieving information * @default web */ searchMode?: 'web' | 'academic' | 'sec' | Expression; /** Returns search results within the specified time interval * @default month */ searchRecency?: 'day' | 'hour' | 'month' | 'week' | 'year' | Expression; /** Comma-separated list of sequences where the model should stop generating */ stop?: string | Expression | PlaceholderValue; /** The number of tokens to keep for highest Top K filtering, specified as an integer between 0 and 2048 inclusive. If set to 0, Top K filtering is disabled. We recommend either altering Top K or Top P, but not both. * @default 0 */ topK?: number | Expression; /** 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. * @default 0.9 */ topP?: number | Expression; /** Advanced web search configuration object */ webSearchOptions?: IDataObject | string | Expression; }; requestOptions?: { /** Batching * @default {"batch":{}} */ batching?: { /** Batching */ batch?: { /** Input will be split in batches to throttle requests. -1 for disabled. 0 will be treated as 1. * @default 50 */ batchSize?: number | Expression; /** Time (in milliseconds) between each batch of requests. 0 for disabled. * @default 1000 */ batchInterval?: number | Expression; }; }; /** Whether to accept the response even if SSL certificate validation is not possible * @default false */ allowUnauthorizedCerts?: boolean; /** HTTP proxy to use. If authentication is required it can be defined as follow: http://username:password@myproxy:3128 */ proxy?: string | Expression | PlaceholderValue; /** Time in ms to wait for the server to send response headers (and start the response body) before aborting the request * @default 10000 */ timeout?: number | Expression; }; }; export type PerplexityV1ChatCompleteOutput = { choices?: Array<{ delta?: { content?: string; role?: string; }; finish_reason?: string; index?: number; message?: { content?: string; role?: string; }; }>; citations?: Array; created?: number; id?: string; model?: string; object?: string; search_results?: Array<{ date?: string; last_updated?: string; snippet?: string; source?: string; title?: string; url?: string; }>; usage?: { completion_tokens?: number; cost?: { request_cost?: number; total_cost?: number; }; prompt_tokens?: number; search_context_size?: string; total_tokens?: number; }; }; export type PerplexityV1ChatCompleteNode = { type: 'n8n-nodes-base.perplexity'; version: 1; credentials?: Credentials; config: NodeConfig; output?: Items; };