langchain.js
    Preparing search index...

    Class representing a Cohere Large Language Model (LLM). It interacts with the Cohere API to generate text completions.

    const model = new Cohere({
    temperature: 0.7,
    maxTokens: 20,
    maxRetries: 5,
    });

    const res = await model.invoke(
    "Question: What would be a good company name for a company that makes colorful socks?\nAnswer:"
    );
    console.log({ res });

    Use Cohere from @langchain/cohere instead.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Parameters

      Returns Cohere

    Properties

    apiKey: string
    lc_serializable: boolean = true
    maxTokens: number = 250

    Maximum number of tokens to generate in the completion.

    model: string

    Model to use

    temperature: number = 0

    Sampling temperature to use

    Accessors

    • get lc_aliases(): undefined | { [key: string]: string }

      Returns undefined | { [key: string]: string }

    • get lc_secrets(): undefined | { [key: string]: string }

      Returns undefined | { [key: string]: string }

    Methods

    • Returns string

    • Returns string