Class CallbackManager

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

  • BaseCallbackManager
    • CallbackManager

Implements

  • BaseCallbackManagerMethods

Constructors

  • Parameters

    • Optional parentRunId: string

    Returns CallbackManager

Properties

inheritableHandlers: BaseCallbackHandler[]
inheritableMetadata: Record<string, unknown>
inheritableTags: string[]
metadata: Record<string, unknown>
name: string
tags: string[]

Methods

  • Parameters

    Returns void

  • Parameters

    • metadata: Record<string, unknown>
    • Optional inherit: boolean

    Returns void

  • Parameters

    • tags: string[]
    • Optional inherit: boolean

    Returns void

  • Parameters

    • chain: Serialized
    • inputs: ChainValues
    • Optional runId: string
    • Optional runType: string
    • Optional _tags: string[]
    • Optional _metadata: Record<string, unknown>
    • Optional runName: string

    Returns Promise<CallbackManagerForChainRun>

  • Parameters

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

    Returns Promise<CallbackManagerForLLMRun[]>

  • Parameters

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

    Returns Promise<CallbackManagerForLLMRun[]>

  • Parameters

    • retriever: Serialized
    • query: string
    • Optional runId: string
    • Optional _parentRunId: string
    • Optional _tags: string[]
    • Optional _metadata: Record<string, unknown>
    • Optional runName: string

    Returns Promise<CallbackManagerForRetrieverRun>

  • Parameters

    • tool: Serialized
    • input: string
    • Optional runId: string
    • Optional _parentRunId: string
    • Optional _tags: string[]
    • Optional _metadata: Record<string, unknown>
    • Optional runName: string

    Returns Promise<CallbackManagerForToolRun>

  • Parameters

    Returns void

  • Parameters

    • metadata: Record<string, unknown>

    Returns void

  • Parameters

    • tags: string[]

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • Optional inheritableHandlers: Callbacks
    • Optional localHandlers: Callbacks
    • Optional inheritableTags: string[]
    • Optional localTags: string[]
    • Optional inheritableMetadata: Record<string, unknown>
    • Optional localMetadata: Record<string, unknown>
    • Optional options: CallbackManagerOptions

    Returns Promise<undefined | CallbackManager>

  • Parameters

    • handlers: BaseCallbackHandlerMethodsClass

    Returns CallbackManager

Generated using TypeDoc