> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GalileoCallback

***

# Class: GalileoCallback

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Langchain callback handler for logging traces to the Galileo platform.

Requires `@langchain/core` to be installed as a peer dependency.
Install it with: `npm install @langchain/core`

## Extends

* `BaseCallbackHandler`\<`this`>

## Implements

* `CallbackHandlerMethods`

## Constructors

### Constructor

```ts theme={null}
new GalileoCallback(
   galileoLogger?: GalileoLogger,
   startNewTrace?: boolean,
   flushOnChainEnd?: boolean,
   ingestionHook?: (request: LogTracesIngestRequest) => void | Promise<void>): GalileoCallback;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

#### Parameters

##### galileoLogger?

[`GalileoLogger`](/sdk-api/typescript/reference/README/classes/GalileoLogger)

##### startNewTrace?

`boolean` = `true`

##### flushOnChainEnd?

`boolean` = `true`

##### ingestionHook?

(`request`: [`LogTracesIngestRequest`](/sdk-api/typescript/reference/README/type-aliases/LogTracesIngestRequest)) => `void` | `Promise`\<`void`>

#### Returns

`GalileoCallback`

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).constructor;
```

## Properties

### \_flushOnChainEnd

```ts theme={null}
_flushOnChainEnd: boolean;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### \_galileoLogger

```ts theme={null}
_galileoLogger: GalileoLogger;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### \_lastCommittedRoot

```ts theme={null}
_lastCommittedRoot:
  | null
  | {
  nodeType: LANGCHAIN_NODE_TYPE;
  runId: string;
} = null;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### \_nodes

```ts theme={null}
_nodes: Record<string, Node> = {};
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### \_rootNode

```ts theme={null}
_rootNode: null | Node = null;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### \_startNewTrace

```ts theme={null}
_startNewTrace: boolean;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

***

### awaitHandlers

```ts theme={null}
awaitHandlers: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:187

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).awaitHandlers;
```

***

### ignoreAgent

```ts theme={null}
ignoreAgent: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:183

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).ignoreAgent;
```

***

### ignoreChain

```ts theme={null}
ignoreChain: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:182

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).ignoreChain;
```

***

### ignoreCustomEvent

```ts theme={null}
ignoreCustomEvent: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:185

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).ignoreCustomEvent;
```

***

### ignoreLLM

```ts theme={null}
ignoreLLM: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:181

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).ignoreLLM;
```

***

### ignoreRetriever

```ts theme={null}
ignoreRetriever: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:184

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).ignoreRetriever;
```

***

### lc\_kwargs

```ts theme={null}
lc_kwargs: SerializedFields;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:179

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_kwargs;
```

***

### lc\_serializable

```ts theme={null}
lc_serializable: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:156

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_serializable;
```

***

### name

```ts theme={null}
name: string = "GalileoCallback";
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).name;
```

***

### raiseError

```ts theme={null}
raiseError: boolean;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:186

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).raiseError;
```

## Accessors

### lc\_aliases

#### Get Signature

```ts theme={null}
get lc_aliases():
  | undefined
  | {
[key: string]: string;
};
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:164

A map of aliases for constructor args.
Keys are the attribute names, e.g. "foo".
Values are the alias that will replace the key in serialization.
This is used to eg. make argument names match Python.

##### Returns

\| `undefined`
\| \{
\[`key`: `string`]: `string`;
}

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_aliases;
```

***

### lc\_attributes

#### Get Signature

```ts theme={null}
get lc_attributes():
  | undefined
  | {
[key: string]: string;
};
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:161

A map of additional attributes to merge with constructor args.
Keys are the attribute names, e.g. "foo".
Values are the attribute values, which will be serialized.
These attributes need to be accepted by the constructor as arguments.

##### Returns

\| `undefined`
\| \{
\[`key`: `string`]: `string`;
}

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_attributes;
```

***

### lc\_id

#### Get Signature

```ts theme={null}
get lc_id(): string[];
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:178

The final serialized identifier for the module.

##### Returns

`string`\[]

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_id;
```

***

### lc\_namespace

#### Get Signature

```ts theme={null}
get lc_namespace(): ["langchain_core", "callbacks", string];
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:157

A path to the module that contains the class, eg. \["langchain", "llms"]
Usually should be the same as the entrypoint the class is exported from.

##### Returns

\[`"langchain_core"`, `"callbacks"`, `string`]

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_namespace;
```

***

### lc\_secrets

#### Get Signature

```ts theme={null}
get lc_secrets():
  | undefined
  | {
[key: string]: string;
};
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:158

A map of secrets, which will be omitted from serialization.
Keys are paths to the secret in constructor args, e.g. "foo.bar.baz".
Values are the secret ids, which will be used when deserializing.

##### Returns

\| `undefined`
\| \{
\[`key`: `string`]: `string`;
}

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_secrets;
```

***

### lc\_serializable\_keys

#### Get Signature

```ts theme={null}
get lc_serializable_keys(): undefined | string[];
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:167

A manual list of keys that should be serialized.
If not overridden, all fields passed into the constructor will be serialized.

##### Returns

`undefined` | `string`\[]

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_serializable_keys;
```

## Methods

### copy()

```ts theme={null}
copy(): BaseCallbackHandler;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:189

#### Returns

`BaseCallbackHandler`

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).copy;
```

***

### handleAgentAction()?

```ts theme={null}
optional handleAgentAction(
   action: AgentAction,
   runId: string,
   parentRunId?: string,
tags?: string[]): void | Promise<void>;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:115

Called when an agent is about to execute an action,
with the action and the run ID.

#### Parameters

##### action

`AgentAction`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

#### Returns

`void` | `Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleAgentAction;
```

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleAgentAction;
```

***

### handleAgentEnd()

```ts theme={null}
handleAgentEnd(finish: AgentFinish, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called when an agent finishes execution, before it exits.
with the final output and the run ID.

#### Parameters

##### finish

`AgentFinish`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleAgentEnd;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleAgentEnd;
```

***

### handleChainEnd()

```ts theme={null}
handleChainEnd(
   outputs: ChainValues,
   runId: string,
   parentRunId?: string,
   tags?: string[],
kwargs?: object): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the end of a Chain run, with the outputs and the run ID.

#### Parameters

##### outputs

`ChainValues`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

##### kwargs?

###### inputs?

`Record`\<`string`, `unknown`>

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleChainEnd;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleChainEnd;
```

***

### handleChainError()

```ts theme={null}
handleChainError(err: Error, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called if a Chain run encounters an error

#### Parameters

##### err

`Error`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleChainError;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleChainError;
```

***

### handleChainStart()

```ts theme={null}
handleChainStart(
   chain: undefined | Serialized,
   inputs: ChainValues,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
   runType?: string,
runName?: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the start of a Chain run, with the chain name and inputs
and the run ID.

#### Parameters

##### chain

`undefined` | `Serialized`

##### inputs

`ChainValues`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `unknown`>

##### runType?

`string`

##### runName?

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleChainStart;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleChainStart;
```

***

### handleChatModelStart()

```ts theme={null}
handleChatModelStart(
   llm: undefined | Serialized,
   messages: BaseMessage[][],
   runId: string,
   parentRunId?: string,
   extraParams?: Record<string, unknown>,
   tags?: string[],
   metadata?: Record<string, unknown>,
runName?: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the start of a Chat Model run, with the prompt(s)
and the run ID.

#### Parameters

##### llm

`undefined` | `Serialized`

##### messages

`BaseMessage`\[]\[]

##### runId

`string`

##### parentRunId?

`string`

##### extraParams?

`Record`\<`string`, `unknown`>

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `unknown`>

##### runName?

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleChatModelStart;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleChatModelStart;
```

***

### handleCustomEvent()?

```ts theme={null}
optional handleCustomEvent(
   eventName: string,
   data: any,
   runId: string,
   tags?: string[],
   metadata?: Record<string, any>): any;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:127

#### Parameters

##### eventName

`string`

##### data

`any`

##### runId

`string`

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `any`>

#### Returns

`any`

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleCustomEvent;
```

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleCustomEvent;
```

***

### handleLLMEnd()

```ts theme={null}
handleLLMEnd(output: LLMResult, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the end of an LLM/ChatModel run, with the output and the run ID.

#### Parameters

##### output

`LLMResult`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleLLMEnd;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleLLMEnd;
```

***

### handleLLMError()

```ts theme={null}
handleLLMError(err: Error, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called if an LLM/ChatModel run encounters an error

#### Parameters

##### err

`Error`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleLLMError;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleLLMError;
```

***

### handleLLMNewToken()

```ts theme={null}
handleLLMNewToken(
   token: string,
   idx: NewTokenIndices,
runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called when an LLM/ChatModel in `streaming` mode produces a new token

#### Parameters

##### token

`string`

##### idx

`NewTokenIndices`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleLLMNewToken;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleLLMNewToken;
```

***

### handleLLMStart()

```ts theme={null}
handleLLMStart(
   llm: undefined | Serialized,
   prompts: string[],
   runId: string,
   parentRunId?: string,
   extraParams?: Record<string, unknown>,
   tags?: string[],
   metadata?: Record<string, unknown>,
runName?: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the start of an LLM or Chat Model run, with the prompt(s)
and the run ID.

#### Parameters

##### llm

`undefined` | `Serialized`

##### prompts

`string`\[]

##### runId

`string`

##### parentRunId?

`string`

##### extraParams?

`Record`\<`string`, `unknown`>

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `unknown`>

##### runName?

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleLLMStart;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleLLMStart;
```

***

### handleRetrieverEnd()

```ts theme={null}
handleRetrieverEnd(documents: DocumentInterface<Record<string, unknown>>[], runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

#### Parameters

##### documents

`DocumentInterface`\<`Record`\<`string`, `unknown`>>\[]

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleRetrieverEnd;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleRetrieverEnd;
```

***

### handleRetrieverError()

```ts theme={null}
handleRetrieverError(err: Error, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

#### Parameters

##### err

`Error`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleRetrieverError;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleRetrieverError;
```

***

### handleRetrieverStart()

```ts theme={null}
handleRetrieverStart(
   retriever: undefined | Serialized,
   query: string,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
runName?: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

#### Parameters

##### retriever

`undefined` | `Serialized`

##### query

`string`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `unknown`>

##### runName?

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleRetrieverStart;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleRetrieverStart;
```

***

### handleText()?

```ts theme={null}
optional handleText(
   text: string,
   runId: string,
   parentRunId?: string,
tags?: string[]): void | Promise<void>;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:110

#### Parameters

##### text

`string`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

#### Returns

`void` | `Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleText;
```

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleText;
```

***

### handleToolEnd()

```ts theme={null}
handleToolEnd(output: unknown, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the end of a Tool run, with the tool output and the run ID.

#### Parameters

##### output

`unknown`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleToolEnd;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleToolEnd;
```

***

### handleToolError()

```ts theme={null}
handleToolError(err: Error, runId: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called if a Tool run encounters an error

#### Parameters

##### err

`Error`

##### runId

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleToolError;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleToolError;
```

***

### handleToolStart()

```ts theme={null}
handleToolStart(
   tool: undefined | Serialized,
   input: string,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
runName?: string): Promise<void>;
```

Defined in: [src/handlers/langchain/index.ts](https://github.com/rungalileo/galileo-js/blob/main/src/handlers/langchain/index.ts)

Called at the start of a Tool run, with the tool name and input
and the run ID.

#### Parameters

##### tool

`undefined` | `Serialized`

##### input

`string`

##### runId

`string`

##### parentRunId?

`string`

##### tags?

`string`\[]

##### metadata?

`Record`\<`string`, `unknown`>

##### runName?

`string`

#### Returns

`Promise`\<`void`>

#### Implementation of

```ts theme={null}
CallbackHandlerMethods.handleToolStart;
```

#### Overrides

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).handleToolStart;
```

***

### toJSON()

```ts theme={null}
toJSON(): Serialized;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:190

#### Returns

`Serialized`

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).toJSON;
```

***

### toJSONNotImplemented()

```ts theme={null}
toJSONNotImplemented(): SerializedNotImplemented;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:191

#### Returns

`SerializedNotImplemented`

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).toJSONNotImplemented;
```

***

### fromMethods()

```ts theme={null}
static fromMethods(methods: BaseCallbackHandlerMethodsClass): object;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:192

#### Parameters

##### methods

`BaseCallbackHandlerMethodsClass`

#### Returns

##### awaitHandlers

```ts theme={null}
awaitHandlers: boolean;
```

##### ignoreAgent

```ts theme={null}
ignoreAgent: boolean;
```

##### ignoreChain

```ts theme={null}
ignoreChain: boolean;
```

##### ignoreCustomEvent

```ts theme={null}
ignoreCustomEvent: boolean;
```

##### ignoreLLM

```ts theme={null}
ignoreLLM: boolean;
```

##### ignoreRetriever

```ts theme={null}
ignoreRetriever: boolean;
```

##### lc\_aliases

```ts theme={null}
readonly lc_aliases:
  | undefined
  | {
[key: string]: string;
};
```

##### lc\_attributes

```ts theme={null}
readonly lc_attributes:
  | undefined
  | {
[key: string]: string;
};
```

##### lc\_id

```ts theme={null}
readonly lc_id: string[];
```

The final serialized identifier for the module.

##### lc\_kwargs

```ts theme={null}
lc_kwargs: SerializedFields;
```

##### lc\_namespace

```ts theme={null}
readonly lc_namespace: ["langchain_core", "callbacks", string];
```

##### lc\_secrets

```ts theme={null}
readonly lc_secrets:
  | undefined
  | {
[key: string]: string;
};
```

##### lc\_serializable

```ts theme={null}
lc_serializable: boolean;
```

##### lc\_serializable\_keys

```ts theme={null}
readonly lc_serializable_keys: undefined | string[];
```

##### name

```ts theme={null}
name: string;
```

##### raiseError

```ts theme={null}
raiseError: boolean;
```

##### copy()

```ts theme={null}
copy(): BaseCallbackHandler;
```

###### Returns

`BaseCallbackHandler`

##### handleAgentAction()?

```ts theme={null}
optional handleAgentAction(
   action: AgentAction,
   runId: string,
   parentRunId?: string,
tags?: string[]): void | Promise<void>;
```

Called when an agent is about to execute an action,
with the action and the run ID.

###### Parameters

###### action

`AgentAction`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`void` | `Promise`\<`void`>

##### handleAgentEnd()?

```ts theme={null}
optional handleAgentEnd(
   action: AgentFinish,
   runId: string,
   parentRunId?: string,
tags?: string[]): void | Promise<void>;
```

Called when an agent finishes execution, before it exits.
with the final output and the run ID.

###### Parameters

###### action

`AgentFinish`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`void` | `Promise`\<`void`>

##### handleChainEnd()?

```ts theme={null}
optional handleChainEnd(
   outputs: ChainValues,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   kwargs?: object): any;
```

Called at the end of a Chain run, with the outputs and the run ID.

###### Parameters

###### outputs

`ChainValues`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### kwargs?

###### inputs?

`Record`\<`string`, `unknown`>

###### Returns

`any`

##### handleChainError()?

```ts theme={null}
optional handleChainError(
   err: any,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   kwargs?: object): any;
```

Called if a Chain run encounters an error

###### Parameters

###### err

`any`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### kwargs?

###### inputs?

`Record`\<`string`, `unknown`>

###### Returns

`any`

##### handleChainStart()?

```ts theme={null}
optional handleChainStart(
   chain: Serialized,
   inputs: ChainValues,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
   runType?: string,
   runName?: string): any;
```

Called at the start of a Chain run, with the chain name and inputs
and the run ID.

###### Parameters

###### chain

`Serialized`

###### inputs

`ChainValues`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `unknown`>

###### runType?

`string`

###### runName?

`string`

###### Returns

`any`

##### handleChatModelStart()?

```ts theme={null}
optional handleChatModelStart(
   llm: Serialized,
   messages: BaseMessage[][],
   runId: string,
   parentRunId?: string,
   extraParams?: Record<string, unknown>,
   tags?: string[],
   metadata?: Record<string, unknown>,
   runName?: string): any;
```

Called at the start of a Chat Model run, with the prompt(s)
and the run ID.

###### Parameters

###### llm

`Serialized`

###### messages

`BaseMessage`\[]\[]

###### runId

`string`

###### parentRunId?

`string`

###### extraParams?

`Record`\<`string`, `unknown`>

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `unknown`>

###### runName?

`string`

###### Returns

`any`

##### handleCustomEvent()?

```ts theme={null}
optional handleCustomEvent(
   eventName: string,
   data: any,
   runId: string,
   tags?: string[],
   metadata?: Record<string, any>): any;
```

###### Parameters

###### eventName

`string`

###### data

`any`

###### runId

`string`

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `any`>

###### Returns

`any`

##### handleLLMEnd()?

```ts theme={null}
optional handleLLMEnd(
   output: LLMResult,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   extraParams?: Record<string, unknown>): any;
```

Called at the end of an LLM/ChatModel run, with the output and the run ID.

###### Parameters

###### output

`LLMResult`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### extraParams?

`Record`\<`string`, `unknown`>

###### Returns

`any`

##### handleLLMError()?

```ts theme={null}
optional handleLLMError(
   err: any,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   extraParams?: Record<string, unknown>): any;
```

Called if an LLM/ChatModel run encounters an error

###### Parameters

###### err

`any`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### extraParams?

`Record`\<`string`, `unknown`>

###### Returns

`any`

##### handleLLMNewToken()?

```ts theme={null}
optional handleLLMNewToken(
   token: string,
   idx: NewTokenIndices,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   fields?: HandleLLMNewTokenCallbackFields): any;
```

Called when an LLM/ChatModel in `streaming` mode produces a new token

###### Parameters

###### token

`string`

###### idx

`NewTokenIndices`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### fields?

`HandleLLMNewTokenCallbackFields`

###### Returns

`any`

##### handleLLMStart()?

```ts theme={null}
optional handleLLMStart(
   llm: Serialized,
   prompts: string[],
   runId: string,
   parentRunId?: string,
   extraParams?: Record<string, unknown>,
   tags?: string[],
   metadata?: Record<string, unknown>,
   runName?: string): any;
```

Called at the start of an LLM or Chat Model run, with the prompt(s)
and the run ID.

###### Parameters

###### llm

`Serialized`

###### prompts

`string`\[]

###### runId

`string`

###### parentRunId?

`string`

###### extraParams?

`Record`\<`string`, `unknown`>

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `unknown`>

###### runName?

`string`

###### Returns

`any`

##### handleRetrieverEnd()?

```ts theme={null}
optional handleRetrieverEnd(
   documents: DocumentInterface<Record<string, any>>[],
   runId: string,
   parentRunId?: string,
   tags?: string[]): any;
```

###### Parameters

###### documents

`DocumentInterface`\<`Record`\<`string`, `any`>>\[]

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`any`

##### handleRetrieverError()?

```ts theme={null}
optional handleRetrieverError(
   err: any,
   runId: string,
   parentRunId?: string,
   tags?: string[]): any;
```

###### Parameters

###### err

`any`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`any`

##### handleRetrieverStart()?

```ts theme={null}
optional handleRetrieverStart(
   retriever: Serialized,
   query: string,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
   name?: string): any;
```

###### Parameters

###### retriever

`Serialized`

###### query

`string`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `unknown`>

###### name?

`string`

###### Returns

`any`

##### handleText()?

```ts theme={null}
optional handleText(
   text: string,
   runId: string,
   parentRunId?: string,
tags?: string[]): void | Promise<void>;
```

###### Parameters

###### text

`string`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`void` | `Promise`\<`void`>

##### handleToolEnd()?

```ts theme={null}
optional handleToolEnd(
   output: any,
   runId: string,
   parentRunId?: string,
   tags?: string[]): any;
```

Called at the end of a Tool run, with the tool output and the run ID.

###### Parameters

###### output

`any`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`any`

##### handleToolError()?

```ts theme={null}
optional handleToolError(
   err: any,
   runId: string,
   parentRunId?: string,
   tags?: string[]): any;
```

Called if a Tool run encounters an error

###### Parameters

###### err

`any`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### Returns

`any`

##### handleToolStart()?

```ts theme={null}
optional handleToolStart(
   tool: Serialized,
   input: string,
   runId: string,
   parentRunId?: string,
   tags?: string[],
   metadata?: Record<string, unknown>,
   runName?: string): any;
```

Called at the start of a Tool run, with the tool name and input
and the run ID.

###### Parameters

###### tool

`Serialized`

###### input

`string`

###### runId

`string`

###### parentRunId?

`string`

###### tags?

`string`\[]

###### metadata?

`Record`\<`string`, `unknown`>

###### runName?

`string`

###### Returns

`any`

##### toJSON()

```ts theme={null}
toJSON(): Serialized;
```

###### Returns

`Serialized`

##### toJSONNotImplemented()

```ts theme={null}
toJSONNotImplemented(): SerializedNotImplemented;
```

###### Returns

`SerializedNotImplemented`

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).fromMethods;
```

***

### lc\_name()

```ts theme={null}
static lc_name(): string;
```

Defined in: node\_modules/@langchain/core/dist/callbacks/base.d.ts:174

The name of the serializable. Override to provide an alias or
to preserve the serialized module name in minified environments.

Implemented as a static method to support loading logic.

#### Returns

`string`

#### Inherited from

```ts theme={null}
(
  _BaseCallbackHandler as typeof import("@langchain/core/callbacks/base").BaseCallbackHandler
).lc_name;
```
