Wrapper around Baidu ERNIE large language models that use the Chat endpoint.

To use you should have the QIANFAN_AK and QIANFAN_SK environment variable set.

Hierarchy (view full)

Implements

  • BaiduQianfanChatInput

Constructors

Properties

model: string = "ERNIE-Lite-8K"

Model name to use. Available options are: ERNIE-Bot, ERNIE-Lite-8K, ERNIE-Bot-4

"ERNIE-Lite-8K"
modelName: string = "ERNIE-Lite-8K"

Model name to use. Available options are: ERNIE-Bot, ERNIE-Lite-8K, ERNIE-Bot-4 Alias for model

"ERNIE-Lite-8K"
streaming: boolean = false

Whether to stream the results or not. Defaults to false.

client?: any
penaltyScore?: number

Penalizes repeated tokens according to frequency. Range from 1.0 to 2.0. Defaults to 1.0.

prefixMessages?: Qianfan[]

Messages to pass as a prefix to the prompt

qianfanAK?: string

Access key to use when making requests by Qianfan SDK. Defaults to the value of QIANFAN_KEY environment variable.

qianfanAccessKey?: string

Access key to use when making requests by Qianfan SDK with auth. Defaults to the value of QIANFAN_ACCESS_KEY environment variable.

qianfanSK?: string

Secret key to use when making requests by Qianfan SDK. Defaults to the value of QIANFAN_KEY environment variable.

qianfanSecretKey?: string

Secret key to use when making requests by Qianfan SDK with auth. Defaults to the value of QIANFAN_SECRET_KEY environment variable.

temperature?: number

Amount of randomness injected into the response. Ranges from 0 to 1 (0 is not included). Use temp closer to 0 for analytical / multiple choice, and temp closer to 1 for creative and generative tasks. Defaults to 0.95.

topP?: number

Total probability mass of tokens to consider at each step. Range from 0 to 1.0. Defaults to 0.8.

userId?: string

ID of the end-user who made requests.

Accessors

Methods

  • Get the identifying parameters for the model

    Returns {
        model_name: string;
        penalty_score?: number;
        stream?: boolean;
        system?: string;
        temperature?: number;
        top_p?: number;
        user_id?: string;
    }

    • model_name: string
    • Optionalpenalty_score?: number
    • Optionalstream?: boolean
    • Optionalsystem?: string
    • Optionaltemperature?: number
    • Optionaltop_p?: number
    • Optionaluser_id?: string