n8n-nodes-base
Version:
Base nodes of n8n
137 lines (131 loc) • 5.62 kB
text/typescript
/**
* Perplexity Node - Version 1
* AI-powered answer engine that provides accurate, trusted, and real-time answers to any question. Generates AI responses with citations
*/
export interface PerplexityV1Params {
resource?: unknown;
/**
* Operation
* @displayOptions.show { resource: ["chat"] }
* @default complete
*/
operation?: 'complete';
/**
* The model which will generate the completion
* @displayOptions.show { resource: ["chat"], operation: ["complete"] }
* @default sonar
*/
model?: 'sonar' | 'sonar-deep-research' | 'sonar-pro' | 'sonar-reasoning' | 'sonar-reasoning-pro' | Expression<string>;
/**
* Any optional system messages must be sent first, followed by alternating user and assistant messages
* @displayOptions.show { resource: ["chat"], operation: ["complete"] }
* @default {"message":[{"role":"user","content":""}]}
*/
messages?: {
/** Message
*/
message?: Array<{
/** The content of the message to be sent
*/
content?: string | Expression<string> | 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<string>;
}>;
};
/**
* Whether to return only essential fields (ID, citations, message)
* @displayOptions.show { resource: ["chat"], operation: ["complete"] }
* @default false
*/
simplify?: boolean | Expression<boolean>;
/**
* Options
* @displayOptions.show { resource: ["chat"], operation: ["complete"] }
* @default {}
*/
options?: {
/** 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<number>;
/** 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<number>;
/** 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<number>;
/** 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<number>;
/** 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<number>;
/** 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<number>;
/** Whether or not a request to an online model should return images. Requires Perplexity API usage Tier-2.
* @default false
*/
returnImages?: boolean | Expression<boolean>;
/** Whether or not a request to an online model should return related questions. Requires Perplexity API usage Tier-2.
* @default false
*/
returnRelatedQuestions?: boolean | Expression<boolean>;
/** 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<string> | PlaceholderValue;
/** Returns search results within the specified time interval
* @default month
*/
searchRecency?: 'day' | 'hour' | 'month' | 'week' | Expression<string>;
};
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<number>;
/** Time (in milliseconds) between each batch of requests. 0 for disabled.
* @default 1000
*/
batchInterval?: number | Expression<number>;
};
};
/** 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<string> | 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<number>;
};
}
export interface PerplexityV1Credentials {
perplexityApi: CredentialReference;
}
interface PerplexityV1NodeBase {
type: 'n8n-nodes-base.perplexity';
version: 1;
credentials?: PerplexityV1Credentials;
}
export type PerplexityV1ParamsNode = PerplexityV1NodeBase & {
config: NodeConfig<PerplexityV1Params>;
};
export type PerplexityV1Node = PerplexityV1ParamsNode;