Install and import from @langchain/baidu-qianfan instead. Wrapper around Baidu ERNIE large language models that use the Chat endpoint.

To use you should have the BAIDU_API_KEY and BAIDU_SECRET_KEY environment variable set.

const ernieTurbo = new ChatBaiduWenxin({
apiKey: "YOUR-API-KEY",
baiduSecretKey: "YOUR-SECRET-KEY",
});

const ernie = new ChatBaiduWenxin({
model: "ERNIE-Bot",
temperature: 1,
apiKey: "YOUR-API-KEY",
baiduSecretKey: "YOUR-SECRET-KEY",
});

const messages = [new HumanMessage("Hello")];

let res = await ernieTurbo.call(messages);

res = await ernie.call(messages);

Hierarchy (view full)

Implements

  • BaiduWenxinChatInput

Constructors

Constructors