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 = "callback_manager"
tags: string[] = []

Methods

  • Parameters

    Returns void

  • Parameters

    • metadata: Record<string, unknown>
    • inherit: boolean = true

    Returns void

  • Parameters

    • tags: string[]
    • inherit: boolean = true

    Returns void

  • Parameters

    • chain: Serialized
    • inputs: ChainValues
    • runId: string = ...
    • runType: undefined | string = undefined
    • _tags: undefined | string[] = undefined
    • _metadata: undefined | Record<string, unknown> = undefined
    • runName: undefined | string = undefined

    Returns Promise<CallbackManagerForChainRun>

  • 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[]>

  • Parameters

    • retriever: Serialized
    • query: string
    • runId: string = ...
    • _parentRunId: undefined | string = undefined
    • _tags: undefined | string[] = undefined
    • _metadata: undefined | Record<string, unknown> = undefined
    • runName: undefined | string = undefined

    Returns Promise<CallbackManagerForRetrieverRun>

  • Parameters

    • tool: Serialized
    • input: string
    • runId: string = ...
    • _parentRunId: undefined | string = undefined
    • _tags: undefined | string[] = undefined
    • _metadata: undefined | Record<string, unknown> = undefined
    • runName: undefined | string = undefined

    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