@langchain/core
Version:
Core LangChain.js abstractions and schemas
118 lines (117 loc) • 3.56 kB
TypeScript
import { BaseTracer, type Run } from "./base.js";
/**
* A tracer that logs all events to the console. It extends from the
* `BaseTracer` class and overrides its methods to provide custom logging
* functionality.
* @example
* ```typescript
*
* const llm = new ChatAnthropic({
* temperature: 0,
* tags: ["example", "callbacks", "constructor"],
* callbacks: [new ConsoleCallbackHandler()],
* });
*
* ```
*/
export declare class ConsoleCallbackHandler extends BaseTracer {
name: "console_callback_handler";
/**
* Method used to persist the run. In this case, it simply returns a
* resolved promise as there's no persistence logic.
* @param _run The run to persist.
* @returns A resolved promise.
*/
protected persistRun(_run: Run): Promise<void>;
/**
* Method used to get all the parent runs of a given run.
* @param run The run whose parents are to be retrieved.
* @returns An array of parent runs.
*/
getParents(run: Run): Run[];
/**
* Method used to get a string representation of the run's lineage, which
* is used in logging.
* @param run The run whose lineage is to be retrieved.
* @returns A string representation of the run's lineage.
*/
getBreadcrumbs(run: Run): string;
/**
* Method used to log the start of a chain run.
* @param run The chain run that has started.
* @returns void
*/
onChainStart(run: Run): void;
/**
* Method used to log the end of a chain run.
* @param run The chain run that has ended.
* @returns void
*/
onChainEnd(run: Run): void;
/**
* Method used to log any errors of a chain run.
* @param run The chain run that has errored.
* @returns void
*/
onChainError(run: Run): void;
/**
* Method used to log the start of an LLM run.
* @param run The LLM run that has started.
* @returns void
*/
onLLMStart(run: Run): void;
/**
* Method used to log the end of an LLM run.
* @param run The LLM run that has ended.
* @returns void
*/
onLLMEnd(run: Run): void;
/**
* Method used to log any errors of an LLM run.
* @param run The LLM run that has errored.
* @returns void
*/
onLLMError(run: Run): void;
/**
* Method used to log the start of a tool run.
* @param run The tool run that has started.
* @returns void
*/
onToolStart(run: Run): void;
/**
* Method used to log the end of a tool run.
* @param run The tool run that has ended.
* @returns void
*/
onToolEnd(run: Run): void;
/**
* Method used to log any errors of a tool run.
* @param run The tool run that has errored.
* @returns void
*/
onToolError(run: Run): void;
/**
* Method used to log the start of a retriever run.
* @param run The retriever run that has started.
* @returns void
*/
onRetrieverStart(run: Run): void;
/**
* Method used to log the end of a retriever run.
* @param run The retriever run that has ended.
* @returns void
*/
onRetrieverEnd(run: Run): void;
/**
* Method used to log any errors of a retriever run.
* @param run The retriever run that has errored.
* @returns void
*/
onRetrieverError(run: Run): void;
/**
* Method used to log the action selected by the agent.
* @param run The run in which the agent action occurred.
* @returns void
*/
onAgentAction(run: Run): void;
}