UNPKG

@botonic/plugin-hubtype-analytics

Version:

Plugin for tracking in the Hubtype backend to see the results in the Hubtype Dashbord

44 lines 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HtEventAiAgent = void 0; /* eslint-disable @typescript-eslint/naming-convention */ const types_1 = require("../types"); const ht_event_1 = require("./ht-event"); class HtEventAiAgent extends ht_event_1.HtEvent { constructor(event, requestData) { super(event, requestData); this.type = types_1.EventType.BotEvent; this.action = types_1.EventAction.AiAgent; this.flow_thread_id = event.flowThreadId; this.flow_id = event.flowId; this.flow_name = event.flowName; this.flow_node_id = event.flowNodeId; this.flow_node_content_id = event.flowNodeContentId; this.flow_node_is_meaningful = event.flowNodeIsMeaningful; this.tools_executed = event.toolsExecuted.map(this.getToolExecutionInfo); this.memory_length = event.memoryLength; this.input_message_id = event.inputMessageId; this.input_guardrails_triggered = event.inputGuardrailsTriggered; this.output_guardrails_triggered = event.outputGuardrailsTriggered; this.exit = event.exit; this.error = event.error; } getToolExecutionInfo(toolExecution) { const knowledgeBaseArgs = {}; if (toolExecution.knowledgebaseSourcesIds) { knowledgeBaseArgs.knowledgebase_sources_ids = toolExecution.knowledgebaseSourcesIds; } if (toolExecution.knowledgebaseChunksIds) { knowledgeBaseArgs.knowledgebase_chunks_ids = toolExecution.knowledgebaseChunksIds; } return { tool_name: toolExecution.toolName, tool_arguments: toolExecution.toolArguments, ...knowledgeBaseArgs, }; } } exports.HtEventAiAgent = HtEventAiAgent; //# sourceMappingURL=ht-event-ai-agent.js.map