Skip to content
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

Claude 3: completion_tokens double counting #219

Open
adubovik opened this issue Jan 23, 2025 · 0 comments
Open

Claude 3: completion_tokens double counting #219

adubovik opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@adubovik
Copy link
Collaborator

Completion tokens are counted twice:

completion_tokens += usage.output_tokens

completion_tokens += message.usage.output_tokens

Only one should remain. Preferable one for MessageDeltaEvent.

Add an integration test, e.g. extend the one with max_token=1:

    test_case(
        name="pinocchio in one token",
        max_tokens=1,
        messages=[user("tell me the full story of Pinocchio")],
        expected=lambda s: len(s.content.split()) <= 1
+        and s.usage is not None
+        and s.usage.completion_tokens == 1,
    )
@adubovik adubovik added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant