Example

const prompt = PromptTemplate.fromTemplate("What is the answer to {question}?");

// Example of using LLMChain with OpenAI and a simple prompt
const chain = new LLMChain({
llm: new ChatOpenAI({ temperature: 0.9 }),
prompt,
});

// Running the chain with a single question
const result = await chain.call({
question: "What is the airspeed velocity of an unladen swallow?",
});
console.log("The answer is:", result);

Hierarchy (view full)

Implements

  • BaseCallbackManagerMethods

Constructors

Properties

handlers: BaseCallbackHandler[] = []
inheritableHandlers: BaseCallbackHandler[] = []
inheritableMetadata: Record<string, unknown> = {}
inheritableTags: string[] = []
metadata: Record<string, unknown> = {}
name: string = "callback_manager"
tags: string[] = []

Methods

  • Parameters

    • llm: Serialized
    • messages: BaseMessage[][]
    • _runId: undefined | string = undefined
    • _parentRunId: undefined | string = undefined
    • extraParams: undefined | Record<string, unknown> = undefined
    • _tags: undefined | string[] = undefined
    • _metadata: undefined | Record<string, unknown> = undefined
    • runName: undefined | string = undefined

    Returns Promise<CallbackManagerForLLMRun[]>

  • Parameters

    • llm: Serialized
    • prompts: string[]
    • _runId: undefined | string = undefined
    • _parentRunId: undefined | string = undefined
    • extraParams: undefined | Record<string, unknown> = undefined
    • _tags: undefined | string[] = undefined
    • _metadata: undefined | Record<string, unknown> = undefined
    • runName: undefined | string = undefined

    Returns Promise<CallbackManagerForLLMRun[]>

Generated using TypeDoc