-
-
Notifications
You must be signed in to change notification settings - Fork 281
Open
Description
copilot-api/src/lib/tokenizer.ts
Lines 5 to 18 in 3b673be
| export const getTokenCount = (messages: Array<Message>) => { | |
| const input = messages.filter( | |
| (m) => m.role !== "assistant" && typeof m.content === "string", | |
| ) | |
| const output = messages.filter((m) => m.role === "assistant") | |
| const inputTokens = countTokens(input) | |
| const outputTokens = countTokens(output) | |
| return { | |
| input: inputTokens, | |
| output: outputTokens, | |
| } | |
| } |
I may be misreading, but are you counting assistant messages as output tokens and other roles as input tokens, is that it?
If so, the correct should be:.
- Everything sent to the api is input
- Everything sent by the api is output
If I'm misunderstanding the code, please just ignore. And thanks for this project!
Metadata
Metadata
Assignees
Labels
No labels