Skip to main content

Class: PerplexityApiConfiguration

Configuration for the Perplexity API.

It calls the API at https://api.perplexity.ai/ and uses the PERPLEXITY_API_KEY api key environment variable.

See

https://docs.perplexity.ai/reference/post_chat_completions

Hierarchy

Implements

Constructors

constructor

new PerplexityApiConfiguration(settings?): PerplexityApiConfiguration

Parameters

NameType
settingsOmit<BaseUrlPartsApiConfigurationOptions, "baseUrl"> & { baseUrl?: string | Partial<UrlParts> } & { apiKey?: string }

Returns

PerplexityApiConfiguration

Overrides

BaseUrlApiConfigurationWithDefaults.constructor

Defined in

packages/modelfusion/src/model-provider/openai-compatible/PerplexityApiConfiguration.ts:19

Methods

assembleUrl

assembleUrl(path): string

Creates a full URL given a inner path.

The inner path always starts with a slash, e.g. /generate.

Parameters

NameType
pathstring

Returns

string

Implementation of

OpenAICompatibleApiConfiguration.assembleUrl

Inherited from

BaseUrlApiConfigurationWithDefaults.assembleUrl

Defined in

packages/modelfusion/src/core/api/BaseUrlApiConfiguration.ts:47


fixedHeaders

fixedHeaders(): Record<string, string>

Returns

Record<string, string>

Inherited from

BaseUrlApiConfigurationWithDefaults.fixedHeaders

Defined in

packages/modelfusion/src/core/api/BaseUrlApiConfiguration.ts:43


headers

headers(params): Record<string, string>

Returns the headers that should be included in every request to the API. This is intended for authentication headers and proxy settings.

The model may add additional headers, in particular "Content-Type"."

Parameters

NameTypeDescription
paramsHeaderParametersParameters that can be used to create the headers.

Returns

Record<string, string>

Implementation of

OpenAICompatibleApiConfiguration.headers

Inherited from

BaseUrlApiConfigurationWithDefaults.headers

Defined in

packages/modelfusion/src/core/api/AbstractApiConfiguration.ts:31

Properties

baseUrl

Readonly baseUrl: UrlParts

Inherited from

BaseUrlApiConfigurationWithDefaults.baseUrl

Defined in

packages/modelfusion/src/core/api/BaseUrlApiConfiguration.ts:27


provider

Readonly provider: "openaicompatible-perplexity"

Implementation of

OpenAICompatibleApiConfiguration.provider

Defined in

packages/modelfusion/src/model-provider/openai-compatible/PerplexityApiConfiguration.ts:42


retry

Optional Readonly retry: RetryFunction

Defines how failed API calls should be retried.

Implementation of

OpenAICompatibleApiConfiguration.retry

Inherited from

BaseUrlApiConfigurationWithDefaults.retry

Defined in

packages/modelfusion/src/core/api/AbstractApiConfiguration.ts:7


throttle

Optional Readonly throttle: ThrottleFunction

Defines how API calls should be rate limited.

Implementation of

OpenAICompatibleApiConfiguration.throttle

Inherited from

BaseUrlApiConfigurationWithDefaults.throttle

Defined in

packages/modelfusion/src/core/api/AbstractApiConfiguration.ts:8