⚠️ Deprecated ⚠️

Install and import from "@langchain/cloudflare" instead.

This feature is deprecated and will be removed in the future.

It is not recommended for use.

A class that enables calls to the Cloudflare Workers AI API to access large language models in a chat-like fashion. It extends the SimpleChatModel class and implements the CloudflareWorkersAIInput interface.

Example

const model = new ChatCloudflareWorkersAI({
model: "@cf/meta/llama-2-7b-chat-int8",
cloudflareAccountId: process.env.CLOUDFLARE_ACCOUNT_ID,
cloudflareApiToken: process.env.CLOUDFLARE_API_TOKEN
});

const response = await model.invoke([
["system", "You are a helpful assistant that translates English to German."],
["human", `Translate "I love programming".`]
]);

console.log(response);

Hierarchy

Implements

Constructors

Properties

baseUrl: string
model: string = "@cf/meta/llama-2-7b-chat-int8"
streaming: boolean = false
cloudflareAccountId?: string
cloudflareApiToken?: string

Accessors

Methods

Generated using TypeDoc