feat: send analytics event for token usage (#37)
This commit is contained in:
@@ -30,9 +30,6 @@ export function streamText(messages: Messages, env: Env, options?: StreamingOpti
|
||||
'anthropic-beta': 'max-tokens-3-5-sonnet-2024-07-15',
|
||||
},
|
||||
messages: convertToCoreMessages(messages),
|
||||
onFinish: ({ finishReason, usage, warnings }) => {
|
||||
console.log({ finishReason, usage, warnings });
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ export default class SwitchableStream extends TransformStream {
|
||||
await this._currentReader.cancel();
|
||||
}
|
||||
|
||||
console.log('Switching stream');
|
||||
|
||||
this._currentReader = newStream.getReader();
|
||||
|
||||
this._pumpStream();
|
||||
|
||||
@@ -13,6 +13,7 @@ const MESSAGE_PREFIX = 'Bolt';
|
||||
|
||||
export enum AnalyticsTrackEvent {
|
||||
MessageSent = `${MESSAGE_PREFIX} Message Sent`,
|
||||
MessageComplete = `${MESSAGE_PREFIX} Message Complete`,
|
||||
ChatCreated = `${MESSAGE_PREFIX} Chat Created`,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user