Skip to main content

Class: GalileoCallback

Defined in: 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

Defined in: src/handlers/langchain/index.ts

Parameters

galileoLogger?
GalileoLogger
startNewTrace?
boolean = true
flushOnChainEnd?
boolean = true
ingestionHook?
(request: LogTracesIngestRequest) => void | Promise<void>

Returns

GalileoCallback

Overrides

Properties

_flushOnChainEnd

Defined in: src/handlers/langchain/index.ts

_galileoLogger

Defined in: src/handlers/langchain/index.ts

_lastCommittedRoot

Defined in: src/handlers/langchain/index.ts

_nodes

Defined in: src/handlers/langchain/index.ts

_rootNode

Defined in: src/handlers/langchain/index.ts

_startNewTrace

Defined in: src/handlers/langchain/index.ts

awaitHandlers

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:187

Inherited from


ignoreAgent

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:183

Inherited from


ignoreChain

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:182

Inherited from


ignoreCustomEvent

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:185

Inherited from


ignoreLLM

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:181

Inherited from


ignoreRetriever

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:184

Inherited from


lc_kwargs

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:179

Inherited from


lc_serializable

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:156

Inherited from


name

Defined in: src/handlers/langchain/index.ts

Overrides


raiseError

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:186

Inherited from

Accessors

lc_aliases

Get Signature

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


lc_attributes

Get Signature

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


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


lc_namespace

Get Signature

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


lc_secrets

Get Signature

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


lc_serializable_keys

Get Signature

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

Methods

copy()

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:189

Returns

BaseCallbackHandler

Inherited from


handleAgentAction()?

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

Inherited from


handleAgentEnd()

Defined in: 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

Overrides


handleChainEnd()

Defined in: 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

Overrides


handleChainError()

Defined in: src/handlers/langchain/index.ts Called if a Chain run encounters an error

Parameters

err
Error
runId
string

Returns

Promise<void>

Implementation of

Overrides


handleChainStart()

Defined in: 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

Overrides


handleChatModelStart()

Defined in: 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

Overrides


handleCustomEvent()?

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

Inherited from


handleLLMEnd()

Defined in: 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

Overrides


handleLLMError()

Defined in: src/handlers/langchain/index.ts Called if an LLM/ChatModel run encounters an error

Parameters

err
Error
runId
string

Returns

Promise<void>

Implementation of

Overrides


handleLLMNewToken()

Defined in: 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

Overrides


handleLLMStart()

Defined in: 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

Overrides


handleRetrieverEnd()

Defined in: src/handlers/langchain/index.ts

Parameters

documents
DocumentInterface<Record<string, unknown>>[]
runId
string

Returns

Promise<void>

Implementation of

Overrides


handleRetrieverError()

Defined in: src/handlers/langchain/index.ts

Parameters

err
Error
runId
string

Returns

Promise<void>

Implementation of

Overrides


handleRetrieverStart()

Defined in: 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

Overrides


handleText()?

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

Inherited from


handleToolEnd()

Defined in: 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

Overrides


handleToolError()

Defined in: src/handlers/langchain/index.ts Called if a Tool run encounters an error

Parameters

err
Error
runId
string

Returns

Promise<void>

Implementation of

Overrides


handleToolStart()

Defined in: 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

Overrides


toJSON()

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:190

Returns

Serialized

Inherited from


toJSONNotImplemented()

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:191

Returns

SerializedNotImplemented

Inherited from


fromMethods()

Defined in: node_modules/@langchain/core/dist/callbacks/base.d.ts:192

Parameters

methods
BaseCallbackHandlerMethodsClass

Returns

awaitHandlers
ignoreAgent
ignoreChain
ignoreCustomEvent
ignoreLLM
ignoreRetriever
lc_aliases
lc_attributes
lc_id
The final serialized identifier for the module.
lc_kwargs
lc_namespace
lc_secrets
lc_serializable
lc_serializable_keys
name
raiseError
copy()
Returns
BaseCallbackHandler
handleAgentAction()?
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()?
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()?
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()?
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()?
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()?
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()?
Parameters
eventName
string
data
any
runId
string
tags?
string[]
metadata?
Record<string, any>
Returns
any
handleLLMEnd()?
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()?
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()?
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()?
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()?
Parameters
documents
DocumentInterface<Record<string, any>>[]
runId
string
parentRunId?
string
tags?
string[]
Returns
any
handleRetrieverError()?
Parameters
err
any
runId
string
parentRunId?
string
tags?
string[]
Returns
any
handleRetrieverStart()?
Parameters
retriever
Serialized
query
string
runId
string
parentRunId?
string
tags?
string[]
metadata?
Record<string, unknown>
name?
string
Returns
any
handleText()?
Parameters
text
string
runId
string
parentRunId?
string
tags?
string[]
Returns
void | Promise<void>
handleToolEnd()?
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()?
Called if a Tool run encounters an error
Parameters
err
any
runId
string
parentRunId?
string
tags?
string[]
Returns
any
handleToolStart()?
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()
Returns
SerializedNotImplemented

Inherited from


lc_name()

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