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.
Class: GalileoCallback
Defined in: src/handlers/langchain.ts
Langchain callback handler for logging traces to the Galileo platform.
Extends
Implements
Constructors
Constructor
new GalileoCallback(
galileoLogger?: GalileoLogger,
startNewTrace?: boolean,
flushOnChainEnd?: boolean): GalileoCallback;
Defined in: src/handlers/langchain.ts
Parameters
galileoLogger?
GalileoLogger
startNewTrace?
boolean = true
flushOnChainEnd?
boolean = true
Returns
GalileoCallback
Overrides
BaseCallbackHandler.constructor;
Properties
_flushOnChainEnd
_flushOnChainEnd: boolean;
Defined in: src/handlers/langchain.ts
_galileoLogger
_galileoLogger: GalileoLogger;
Defined in: src/handlers/langchain.ts
_nodes
_nodes: Record<string, Node> = {};
Defined in: src/handlers/langchain.ts
_startNewTrace
Defined in: src/handlers/langchain.ts
awaitHandlers
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:187
Inherited from
BaseCallbackHandler.awaitHandlers;
ignoreAgent
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:183
Inherited from
BaseCallbackHandler.ignoreAgent;
ignoreChain
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:182
Inherited from
BaseCallbackHandler.ignoreChain;
ignoreCustomEvent
ignoreCustomEvent: boolean;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:185
Inherited from
BaseCallbackHandler.ignoreCustomEvent;
ignoreLLM
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:181
Inherited from
BaseCallbackHandler.ignoreLLM;
ignoreRetriever
ignoreRetriever: boolean;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:184
Inherited from
BaseCallbackHandler.ignoreRetriever;
lc_kwargs
lc_kwargs: SerializedFields;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:179
Inherited from
BaseCallbackHandler.lc_kwargs;
lc_serializable
lc_serializable: boolean;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:156
Inherited from
BaseCallbackHandler.lc_serializable;
name
name: string = "GalileoCallback";
Defined in: src/handlers/langchain.ts
Overrides
BaseCallbackHandler.name;
raiseError
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:186
Inherited from
BaseCallbackHandler.raiseError;
Accessors
lc_aliases
Get Signature
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
BaseCallbackHandler.lc_aliases;
lc_attributes
Get Signature
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
BaseCallbackHandler.lc_attributes;
lc_id
Get Signature
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:178
The final serialized identifier for the module.
Returns
string[]
Inherited from
BaseCallbackHandler.lc_id;
lc_namespace
Get Signature
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
BaseCallbackHandler.lc_namespace;
lc_secrets
Get Signature
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
BaseCallbackHandler.lc_secrets;
lc_serializable_keys
Get Signature
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
BaseCallbackHandler.lc_serializable_keys;
Methods
copy()
copy(): BaseCallbackHandler;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:189
Returns
BaseCallbackHandler
Inherited from
BaseCallbackHandler.copy;
handleAgentAction()?
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
CallbackHandlerMethods.handleAgentAction;
Inherited from
BaseCallbackHandler.handleAgentAction;
handleAgentEnd()
handleAgentEnd(finish: AgentFinish, runId: string): Promise<void>;
Defined in: src/handlers/langchain.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
CallbackHandlerMethods.handleAgentEnd;
Overrides
BaseCallbackHandler.handleAgentEnd;
handleChainEnd()
handleChainEnd(
outputs: ChainValues,
runId: string,
parentRunId?: string,
tags?: string[],
kwargs?: object): Promise<void>;
Defined in: src/handlers/langchain.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
CallbackHandlerMethods.handleChainEnd;
Overrides
BaseCallbackHandler.handleChainEnd;
handleChainError()
handleChainError(err: AxiosError, runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Called if a Chain run encounters an error
Parameters
err
AxiosError
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleChainError;
Overrides
BaseCallbackHandler.handleChainError;
handleChainStart()
handleChainStart(
chain: undefined | Serialized,
inputs: ChainValues,
runId: string,
parentRunId?: string,
tags?: string[],
metadata?: Record<string, any>): Promise<void>;
Defined in: src/handlers/langchain.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, any>
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleChainStart;
Overrides
BaseCallbackHandler.handleChainStart;
handleChatModelStart()
handleChatModelStart(
llm: undefined | Serialized,
messages: BaseMessage[][],
runId: string,
parentRunId?: string,
extraParams?: Record<string, unknown>,
tags?: string[],
metadata?: Record<string, any>): Promise<void>;
Defined in: src/handlers/langchain.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, any>
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleChatModelStart;
Overrides
BaseCallbackHandler.handleChatModelStart;
handleCustomEvent()?
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
CallbackHandlerMethods.handleCustomEvent;
Inherited from
BaseCallbackHandler.handleCustomEvent;
handleLLMEnd()
handleLLMEnd(output: LLMResult, runId: string): Promise<void>;
Defined in: src/handlers/langchain.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
CallbackHandlerMethods.handleLLMEnd;
Overrides
BaseCallbackHandler.handleLLMEnd;
handleLLMError()
handleLLMError(err: AxiosError, runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Called if an LLM/ChatModel run encounters an error
Parameters
err
AxiosError
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleLLMError;
Overrides
BaseCallbackHandler.handleLLMError;
handleLLMNewToken()
handleLLMNewToken(
token: string,
idx: NewTokenIndices,
runId: string): Promise<void>;
Defined in: src/handlers/langchain.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
CallbackHandlerMethods.handleLLMNewToken;
Overrides
BaseCallbackHandler.handleLLMNewToken;
handleLLMStart()
handleLLMStart(
llm: undefined | Serialized,
prompts: string[],
runId: string,
parentRunId?: string,
extraParams?: Record<string, unknown>,
tags?: string[],
metadata?: Record<string, any>): Promise<void>;
Defined in: src/handlers/langchain.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, any>
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleLLMStart;
Overrides
BaseCallbackHandler.handleLLMStart;
handleRetrieverEnd()
handleRetrieverEnd(documents: DocumentInterface<Record<string, unknown>>[], runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Parameters
documents
DocumentInterface<Record<string, unknown>>[]
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleRetrieverEnd;
Overrides
BaseCallbackHandler.handleRetrieverEnd;
handleRetrieverError()
handleRetrieverError(err: AxiosError, runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Parameters
err
AxiosError
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleRetrieverError;
Overrides
BaseCallbackHandler.handleRetrieverError;
handleRetrieverStart()
handleRetrieverStart(
retriever: undefined | Serialized,
query: string,
runId: string,
parentRunId?: string,
tags?: string[],
metadata?: Record<string, any>): Promise<void>;
Defined in: src/handlers/langchain.ts
Parameters
retriever
undefined | Serialized
query
string
runId
string
parentRunId?
string
tags?
string[]
metadata?
Record<string, any>
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleRetrieverStart;
Overrides
BaseCallbackHandler.handleRetrieverStart;
handleText()?
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
CallbackHandlerMethods.handleText;
Inherited from
BaseCallbackHandler.handleText;
handleToolEnd(output: any, runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Called at the end of a Tool run, with the tool output and the run ID.
Parameters
output
any
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleToolEnd;
Overrides
BaseCallbackHandler.handleToolEnd;
handleToolError(err: AxiosError, runId: string): Promise<void>;
Defined in: src/handlers/langchain.ts
Called if a Tool run encounters an error
Parameters
err
AxiosError
runId
string
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleToolError;
Overrides
BaseCallbackHandler.handleToolError;
handleToolStart(
tool: undefined | Serialized,
input: string,
runId: string,
parentRunId?: string,
tags?: string[],
metadata?: Record<string, any>): Promise<void>;
Defined in: src/handlers/langchain.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, any>
Returns
Promise<void>
Implementation of
CallbackHandlerMethods.handleToolStart;
Overrides
BaseCallbackHandler.handleToolStart;
toJSON()
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:190
Returns
Serialized
Inherited from
BaseCallbackHandler.toJSON;
toJSONNotImplemented()
toJSONNotImplemented(): SerializedNotImplemented;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:191
Returns
SerializedNotImplemented
Inherited from
BaseCallbackHandler.toJSONNotImplemented;
fromMethods()
static fromMethods(methods: BaseCallbackHandlerMethodsClass): object;
Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:192
Parameters
methods
BaseCallbackHandlerMethodsClass
Returns
awaitHandlers
ignoreAgent
ignoreChain
ignoreCustomEvent
ignoreCustomEvent: boolean;
ignoreLLM
ignoreRetriever
ignoreRetriever: boolean;
lc_aliases
readonly lc_aliases:
| undefined
| {
[key: string]: string;
};
lc_attributes
readonly lc_attributes:
| undefined
| {
[key: string]: string;
};
lc_id
readonly lc_id: string[];
The final serialized identifier for the module.
lc_kwargs
lc_kwargs: SerializedFields;
lc_namespace
readonly lc_namespace: ["langchain_core", "callbacks", string];
lc_secrets
readonly lc_secrets:
| undefined
| {
[key: string]: string;
};
lc_serializable
lc_serializable: boolean;
lc_serializable_keys
readonly lc_serializable_keys: undefined | string[];
name
raiseError
copy()
copy(): BaseCallbackHandler;
Returns
BaseCallbackHandler
handleAgentAction()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
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()?
optional handleRetrieverError(
err: any,
runId: string,
parentRunId?: string,
tags?: string[]): any;
Parameters
err
any
runId
string
parentRunId?
string
tags?
string[]
Returns
any
handleRetrieverStart()?
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()?
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()?
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()?
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()?
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()
Returns
Serialized
toJSONNotImplemented()
toJSONNotImplemented(): SerializedNotImplemented;
Returns
SerializedNotImplemented
Inherited from
BaseCallbackHandler.fromMethods;
lc_name()
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
BaseCallbackHandler.lc_name;