feat: send analytics event for token usage (#37)

This commit is contained in:
Connor Fogarty
2024-08-15 00:19:12 -05:00
committed by GitHub
parent fb2d957351
commit cf265515cb
4 changed files with 17 additions and 6 deletions

View File

@@ -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,
});
}

View File

@@ -24,8 +24,6 @@ export default class SwitchableStream extends TransformStream {
await this._currentReader.cancel();
}
console.log('Switching stream');
this._currentReader = newStream.getReader();
this._pumpStream();