123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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;
- }
|