Reference documentation for the HoneyHiveLangChainTracer class in JS
HoneyHiveLangChainTracer
class is a utility designed to trace and log LangChain operations with the HoneyHive API. It extends the BaseCallbackHandler
from LangChain and provides methods for session management and updating various properties.
constructor(input: HoneyHiveTracerInput)
HoneyHiveLangChainTracer
.
Parameters:
input: HoneyHiveTracerInput
- An object with the following properties:
project: string
- Name of the project associated with this tracing session.sessionName: string
- Name for this specific session.source?: string
- Source identifier (default: ‘langchain’).userProperties?: Record<string, any>
- User properties for the session.metrics?: Record<string, any>
- Initial metrics for the session.config?: Record<string, any>
- Configuration for the session.metadata?: Record<string, any>
- Initial metadata for the session.apiKey?: string
- API key for authenticating with HoneyHive (falls back to HONEYHIVE_API_KEY
environment variable if not provided).verbose?: boolean
- Whether to log verbose output (default: false).baseUrl?: string
- HoneyHive API base URL (default: ‘https://api.honeyhive.ai’).Error
if the HoneyHive API key is not set.async setFeedback(feedback: Record<string, any>): Promise<void>
feedback: Record<string, any>
- Feedback to be sent to HoneyHive.Promise<void>
Usage Example:
async setMetric(metrics: Record<string, any>): Promise<void>
metrics: Record<string, any>
- Dictionary of metrics to be sent to HoneyHive.Promise<void>
Usage Example:
async setMetadata(metadata: Record<string, any>): Promise<void>
metadata: Record<string, any>
- Dictionary of metadata to be sent to HoneyHive.Promise<void>
Usage Example:
async setUserProperties(userProperties: Record<string, any>): Promise<void>
userProperties: Record<string, any>
- Dictionary of user properties to be sent to HoneyHive.Promise<void>
Usage Example:
async startNewSession(): Promise<void>
Promise<void>
Notes:
sessionId
property of the tracer instance.verbose
is set to true
in the constructor, additional error details will be logged.
HoneyHiveLangChainTracer
class automatically traces various LangChain operations (LLM calls, chain executions, tool usage, etc.) and sends the traces to HoneyHive.startNewSession()
before using other methods if you want to explicitly start a new session. Otherwise, the session will be implicitly started when the first trace is sent.sessionId
is automatically generated and managed by the tracer. You don’t need to provide or manage it manually.