langchain.js
    Preparing search index...

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

    Class representing the CloudflareWorkersAI language model. It extends the LLM (Large Language Model) class, providing a standard interface for interacting with the CloudflareWorkersAI language model.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Parameters

      • Optionalfields: any

      Returns CloudflareWorkersAI

    Properties

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

    Accessors

    • get identifyingParams(): { model: string }

      Get the identifying parameters for this LLM.

      Returns { model: string }

    Methods

    • Call out to CloudflareWorkersAI's complete endpoint. Args: prompt: The prompt to pass into the model. Returns: The string generated by the model. Example: let response = CloudflareWorkersAI.call("Tell me a joke.");

      Parameters

      • prompt: string
      • options: unknown
      • OptionalrunManager: any

      Returns Promise<string>

    • Get the type of LLM.

      Returns string

    • Parameters

      • prompt: string
      • options: unknown
      • Optionalstream: boolean

      Returns Promise<any>

    • Parameters

      • prompt: string
      • options: unknown
      • OptionalrunManager: any

      Returns AsyncGenerator<GenerationChunk>

    • Get the parameters used to invoke the model

      Returns { model: string }

    • Method to validate the environment.

      Returns void

    • Returns string