-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add message length events to MSFT internal telemetry #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add message length events to MSFT internal telemetry #473
Conversation
| export function sendEngineMessagesTelemetry(telemetryService: ITelemetryService, messages: CAPIChatMessage[], telemetryData: TelemetryData) { | ||
| export function sendEngineMessagesLengthTelemetry(telemetryService: ITelemetryService, messages: CAPIChatMessage[], telemetryData: TelemetryData, logService?: ILogService) { | ||
| // Determine if this is input or output based on message characteristics | ||
| const isOutput = messages.length === 1 && messages[0].role === 'assistant'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of trying to guess this from the input would it be easier to just pass a flag as a parameter or something?
| messages: messagesWithLength | ||
| }; | ||
| logService?.info(`[TELEMETRY] engine.messages.length: ${JSON.stringify(logData, null, 2)}`); | ||
| logService?.debug(`[TELEMETRY] engine.messages.length: ${JSON.stringify(logData, null, 2)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of noisy, why do you need to log it?
* add length telemetry event with log message * convert function arguments to length * add completionId * remove tokens * add modelCallId * fix modelCallId * fix modelCallId * move modelCallId from inside messages * add type guard for 'tool_calls' * add curly brackets * remove duplicate noChoice * use isOutput instead of guessing input/output * fix usage issue * change logging to debug mode --------- Co-authored-by: Yevhen Mohylevskyy <yevhenmohylevskyy@Yevhens-MacBook-Pro.local> Co-authored-by: Yevhen Mohylevskyy <yevhenmohylevskyy@mac.lan>
Add a telemetry event that would have a similar structure as engine.messages events but with content replaced by length of that content. This way the messages will be much shorter, not truncated, les likely to drop, and will allow to compute input cost of each tool - total number of characters contributed by a tool to all the conversation input messages it is included in.