Complete API reference for the TypeScript SDK
init()
opts
(optional): InitOptions
apiKey
(optional): string
- Your ZeroEval API key. If not provided, uses ZEROEVAL_API_KEY
environment variableapiUrl
(optional): string
- Custom API URL. Defaults to https://api.zeroeval.com
flushInterval
(optional): number
- Interval in milliseconds to flush spansmaxSpans
(optional): number
- Maximum number of spans to buffer before flushingcollectCodeDetails
(optional): boolean
- Whether to collect code location detailsintegrations
(optional): Record<string, boolean>
- Enable/disable specific integrationsdebug
(optional): boolean
- Enable debug loggingwrap()
openai
package)ai
package)getCurrentSpan()
getCurrentTrace()
getCurrentSession()
setTag()
target
: The target to set tags on
Span
: Sets tags on the specific spanstring
: Sets tags on the trace (if valid trace ID) or session (if valid session ID)undefined
: Sets tags on the current spantags
: Object containing key-value pairs of tagswithSpan()
opts
(SpanOptions): Configuration for the span
name
(string): Name of the spansessionId
(string, optional): Session ID to associate with the spansessionName
(string, optional): Human-readable session nametags
(object, optional): Tags to attach to the spanattributes
(object, optional): Additional attributesinputData
(any, optional): Manual input data overrideoutputData
(any, optional): Manual output data overridefn
(Function): The function to execute within the span@span
Decoratoropts
(SpanOptions): Same configuration options as withSpan()
tsconfig.json
includes:
sendSignal()
entityType
: Type of entity to attach the signal toentityId
: UUID of the entityname
: Name of the signalvalue
: Signal value (string, boolean, or number)signalType
(optional): Signal type, auto-detected if not providedsendTraceSignal()
sendSessionSignal()
sendSpanSignal()
getEntitySignals()
ZeroEvalCallbackHandler
debug
(optional): boolean
- Enable debug loggingexcludeMetadataProps
(optional): RegExp
- Pattern for metadata properties to excludemaxConcurrentSpans
(optional): number
- Maximum concurrent spans. Defaults to 1000spanCleanupIntervalMs
(optional): number
- Cleanup interval in milliseconds. Defaults to 60000setGlobalCallbackHandler()
getGlobalHandler()
clearGlobalHandler()
InitOptions
SignalCreate
Signal
ZeroEvalCallbackHandlerOptions
ZEROEVAL_API_KEY
: Your ZeroEval API keyZEROEVAL_API_URL
: API endpoint URL (defaults to https://api.zeroeval.com
)ZEROEVAL_DEBUG
: Set to true
to enable debug logging