Skip to content

Token Count Difference #4

@abhatia-07

Description

@abhatia-07

Thanks for implementing token count logic in Java, this is very helpful!

I found a few cases in which the count calculated was different from the actual OpenAI count. While I know this is an estimation, it would be good if you could check the logic.

  1. When an integer enum is passed as a function parameter, 1 less token is counted.
  2. When the message contains role assistant with tool_calls and a subsequent message with role tool, 6 extra tokens are counted.

If you want, I can provide examples for the above.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions