newrelic
Version:
New Relic agent
23 lines (19 loc) • 672 B
JavaScript
/*
* Copyright 2023 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
const LlmEvent = require('./event')
module.exports = class LlmEmbedding extends LlmEvent {
constructor({ agent, segment, request = {}, response = {}, withError = false, transaction }) {
super({ agent, segment, request, response, responseAttrs: true, transaction })
this.error = withError
if (agent.config.ai_monitoring.record_content.enabled === true) {
this.input = request.input?.toString()
}
this.token_count = agent.llm?.tokenCountCallback?.(
this['request.model'],
request.input?.toString()
)
}
}