Interface defining the parameters for the Perplexity chat model.

interface PerplexityChatInput {
    apiKey?: string;
    cache?: boolean | BaseCache<Generation[]>;
    callbackManager?: CallbackManager;
    callbacks?: Callbacks;
    disableStreaming?: boolean;
    frequencyPenalty?: number;
    maxConcurrency?: number;
    maxRetries?: number;
    maxTokens?: number;
    metadata?: Record<string, unknown>;
    model: string;
    onFailedAttempt?: FailedAttemptHandler;
    presencePenalty?: number;
    returnImages?: boolean;
    returnRelatedQuestions?: boolean;
    searchDomainFilter?: any[];
    searchRecencyFilter?: string;
    streaming?: boolean;
    tags?: string[];
    temperature?: number;
    timeout?: number;
    topK?: number;
    topP?: number;
    verbose?: boolean;
}

Hierarchy

  • BaseChatModelParams
    • PerplexityChatInput

Implemented by

Properties

apiKey?: string

API key for Perplexity. Defaults to the value of PERPLEXITY_API_KEY environment variable.

cache?: boolean | BaseCache<Generation[]>
callbackManager?: CallbackManager

Use callbacks instead

callbacks?: Callbacks
disableStreaming?: boolean

Whether to disable streaming.

If streaming is bypassed, then stream() will defer to invoke().

  • If true, will always bypass streaming case.
  • If false (default), will always use streaming case if available.
frequencyPenalty?: number

Frequency penalty greater than 0

maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

maxTokens?: number

Maximum number of tokens to generate

metadata?: Record<string, unknown>
model: string

Model name to use

onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.

presencePenalty?: number

Presence penalty between -2 and 2

returnImages?: boolean

Whether to return images

returnRelatedQuestions?: boolean

Determines whether or not a request to an online model should return related questions.

searchDomainFilter?: any[]

Search domain filter - limit the citations used by the online model to URLs from the specified domains.

searchRecencyFilter?: string

Returns search results within the specified time interval - does not apply to images. Values include month, week, day, hour.

streaming?: boolean

Whether to stream the results or not

tags?: string[]
temperature?: number

Temperature parameter between 0 and 2

timeout?: number

Timeout for requests to Perplexity

topK?: number

Top K parameter between 1 and 2048

topP?: number

Top P parameter between 0 and 1

verbose?: boolean
""