Class: GalileoLogger
Defined in: src/utils/galileo-logger.ts:67Constructors
Constructor
Parameters
config
GalileoLoggerConfig = {}
Returns
GalileoLogger
Properties
traces
Methods
addAgentSpan()
Parameters
options
Configuration for the agent span. Onlyinput is required. This creates a parent span that can contain child spans.
agentType?
AgentType
(Optional) The type of agent. One of: ‘default’, ‘planner’, ‘react’, ‘reflection’, ‘router’, ‘classifier’, ‘supervisor’, ‘judge’. Defaults to ‘default’.
createdAt?
Date
(Optional) The timestamp when the span was created.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
string
The input content for the agent.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
name?
string
(Optional) Name for the span (e.g., ‘Planning Agent’, ‘Router Agent’).
output?
string
(Optional) The output result from the agent.
redactedInput?
string
(Optional) Redacted version of the input.
redactedOutput?
string
(Optional) Redacted version of the output.
stepNumber?
number
(Optional) The step number in a multi-step process.
tags?
string[]
(Optional) Array of tags to categorize the span.
Returns
AgentSpan
The created agent span.
addChildSpanToParent()
Parameters
span
Span
The span to add as a child to the current parent.
Returns
void
Throws
Error if no trace or parent span exists.addLlmSpan()
Parameters
options
Configuration for the LLM span. All parameters are optional exceptinput and output.
createdAt?
Date
(Optional) The timestamp when the span was created. Defaults to current time if not provided.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
LlmSpanAllowedInputType
The input content for the LLM span. Accepts string, Message, or arrays of these.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
model?
string
(Optional) The name or identifier of the LLM model used (e.g., ‘gpt-4o’, ‘claude-3-sonnet’).
name?
string
(Optional) Name for the span.
numInputTokens?
number
(Optional) Number of tokens in the input.
numOutputTokens?
number
(Optional) Number of tokens in the output.
output
LlmSpanAllowedOutputType
The output content from the LLM span. Accepts string, Message, or arrays of these.
redactedInput?
LlmSpanAllowedInputType
(Optional) Redacted version of the input content.
redactedOutput?
LlmSpanAllowedOutputType
(Optional) Redacted version of the output content.
statusCode?
number
(Optional) HTTP status code or execution status (e.g., 200 for success).
stepNumber?
number
(Optional) The step number in a multi-step process.
tags?
string[]
(Optional) Array of tags to categorize the span.
temperature?
number
(Optional) The temperature parameter used for the LLM (typically 0.0-2.0).
timeToFirstTokenNs?
number
(Optional) Time to first token in nanoseconds (for streaming responses).
tools?
any[]
(Optional) Array of tool definitions available to the LLM.
totalTokens?
number
(Optional) Total number of tokens used (input + output).
Returns
LlmSpan
The created LLM span, which is automatically added to the current parent.
addRetrieverSpan()
Parameters
options
Configuration for the retriever span. All parameters are optional exceptinput and output.
createdAt?
Date
(Optional) The timestamp when the span was created.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
string
The input query for the retriever.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
name?
string
(Optional) Name for the span.
output
RetrieverSpanAllowedOutputType
The output documents or results. Accepts string, Record<string, string>, Document, or arrays of these. Document has properties: { content: string, metadata?: Record<string, string | number | boolean> }.
redactedInput?
string
(Optional) Redacted version of the input query.
redactedOutput?
RetrieverSpanAllowedOutputType
(Optional) Redacted version of the output.
statusCode?
number
(Optional) HTTP status code or execution status (e.g., 200 for success).
stepNumber?
number
(Optional) The step number in a multi-step process.
tags?
string[]
(Optional) Array of tags to categorize the span.
Returns
RetrieverSpan
The created retriever span.
addSingleLlmSpanTrace()
Parameters
options
Configuration for the single LLM span trace. All parameters are optional exceptinput and output.
createdAt?
Date
(Optional) The timestamp when the span was created.
datasetInput?
string
(Optional) Input data for dataset evaluation.
datasetMetadata?
Record<string, string>
(Optional) Metadata for dataset evaluation.
datasetOutput?
string
(Optional) Expected output for dataset evaluation.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
LlmSpanAllowedInputType
The input content for the LLM span.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
model?
string
(Optional) The name or identifier of the LLM model used (e.g., ‘gpt-4o’, ‘claude-3-sonnet’).
name?
string
(Optional) Name for the span.
numInputTokens?
number
(Optional) Number of tokens in the input.
numOutputTokens?
number
(Optional) Number of tokens in the output.
output
LlmSpanAllowedOutputType
The output content from the LLM span.
redactedInput?
LlmSpanAllowedInputType
(Optional) Redacted version of the input content.
redactedOutput?
LlmSpanAllowedOutputType
(Optional) Redacted version of the output content.
spanStepNumber?
number
(Optional) The step number for the span in a multi-step process.
statusCode?
number
(Optional) HTTP status code or execution status (e.g., 200 for success).
tags?
string[]
(Optional) Array of tags to categorize the span.
temperature?
number
(Optional) The temperature parameter used for the LLM (typically 0.0-2.0).
timeToFirstTokenNs?
number
(Optional) Time to first token in nanoseconds (for streaming).
tools?
any[]
(Optional) Array of tool definitions. Expected format: Array<{ type: ‘function’, function: { name: string, description?: string, parameters?: object } }>.
totalTokens?
number
(Optional) Total number of tokens used (input + output).
Returns
Trace
The created trace containing the single LLM span.
Throws
Error if a trace or span is already in progress.addToolSpan()
Parameters
options
Configuration for the tool span. Onlyinput is required.
createdAt?
Date
(Optional) The timestamp when the span was created.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
string
The input parameters for the tool.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
name?
string
(Optional) Name for the span (e.g., the tool name or function name).
output?
string
(Optional) The output result from the tool.
redactedInput?
string
(Optional) Redacted version of the input.
redactedOutput?
string
(Optional) Redacted version of the output.
statusCode?
number
(Optional) HTTP status code or execution status (e.g., 200 for success).
stepNumber?
number
(Optional) The step number in a multi-step process.
tags?
string[]
(Optional) Array of tags to categorize the span.
toolCallId?
string
(Optional) Unique identifier for the tool call, typically from LLM tool_calls (e.g., ‘call_abc123’).
Returns
ToolSpan
The created tool span.
addWorkflowSpan()
Parameters
options
Configuration for the workflow span. Onlyinput is required. This creates a parent span that can contain child spans.
createdAt?
Date
(Optional) The timestamp when the span was created.
durationNs?
number
(Optional) Duration of the span in nanoseconds.
input
string
The input content for the workflow.
metadata?
Record<string, string>
(Optional) Additional metadata as key-value pairs.
name?
string
(Optional) Name for the span (e.g., ‘Data Processing Workflow’).
output?
string
(Optional) The output result from the workflow.
redactedInput?
string
(Optional) Redacted version of the input.
redactedOutput?
string
(Optional) Redacted version of the output.
stepNumber?
number
(Optional) The step number in a multi-step process.
tags?
string[]
(Optional) Array of tags to categorize the span.
Returns
WorkflowSpan
The created workflow span.
clearSession()
Returns
void
conclude()
Parameters
__namedParameters
concludeAll?
boolean
durationNs?
number
output?
string
redactedOutput?
string
statusCode?
number
Returns
|undefined
| StepWithChildSpans
currentParent()
Returns
|undefined
| StepWithChildSpans
currentSessionId()
Returns
undefined | string
flush()
Returns
Promise<Trace[]>
isLoggingDisabled()
Returns
boolean
setSessionId()
Parameters
sessionId
string
Returns
void
startSession()
Parameters
__namedParameters
externalId?
string
name?
string
previousSessionId?
string
Returns
Promise<string>
startTrace()
Parameters
__namedParameters
createdAt?
Date
datasetInput?
string
datasetMetadata?
Record<string, string>
datasetOutput?
string
durationNs?
number
input
string
metadata?
Record<string, string>
name?
string
output?
string
redactedInput?
string
redactedOutput?
string
tags?
string[]
Returns
Trace
terminate()
Returns
Promise<void>
getLastOutput()
Parameters
node?
BaseSpan
Returns
|undefined
| {
output?: string;
redactedOutput?: string;
}