@gluneau/n8n-nodes-venice
Version:
Venice.ai integration for n8n
65 lines • 2.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.N8nLlmTracing = void 0;
const base_1 = require("@langchain/core/tracers/base");
class N8nLlmTracing extends base_1.BaseTracer {
constructor(context) {
super();
}
get name() {
return 'n8n_llm_tracing';
}
async persistRun(run) {
}
async _handleLLMStart(run) {
console.debug(`LLM started: ${run.name}`);
}
async _handleLLMEnd(run, response) {
if (response.llmOutput?.tokenUsage) {
const { tokenUsage } = response.llmOutput;
console.debug('LLM token usage:', {
prompt: tokenUsage.promptTokens,
completion: tokenUsage.completionTokens,
total: tokenUsage.totalTokens,
});
}
}
async _handleLLMError(run, error) {
console.error(`LLM error: ${error.message}`);
}
async _handleChainStart(run) {
console.debug(`Chain started: ${run.name}`);
}
async _handleChainEnd(run, output) {
console.debug(`Chain ended: ${run.name}`);
}
async _handleChainError(run, error) {
console.error(`Chain error: ${error.message}`);
}
async _handleToolStart(run) {
console.debug(`Tool started: ${run.name}`);
}
async _handleToolEnd(run, output) {
console.debug(`Tool ended: ${run.name}`);
}
async _handleToolError(run, error) {
console.error(`Tool error: ${error.message}`);
}
async _handleAgentAction(run) {
console.debug(`Agent action: ${run.runId || run.id}`);
}
async _handleText(run, text) {
console.debug(`Text generated: ${text.substring(0, 50)}...`);
}
async _handleRetrieverStart(run) {
console.debug(`Retriever started: ${run.name}`);
}
async _handleRetrieverEnd(run, documents) {
console.debug(`Retriever ended: ${run.name} - ${documents.length} documents retrieved`);
}
async _handleRetrieverError(run, error) {
console.error(`Retriever error: ${error.message}`);
}
}
exports.N8nLlmTracing = N8nLlmTracing;
//# sourceMappingURL=N8nLlmTracing.js.map