-
Notifications
You must be signed in to change notification settings - Fork 68
LCORE-1137: store info about consumed tokens into token usage history #958
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1150,7 +1150,9 @@ async def test_query_v2_endpoint_quota_integration( | |
| mock_consume.assert_called_once() | ||
| consume_args = mock_consume.call_args | ||
| user_id, _, _, _ = test_auth | ||
| assert consume_args.args[1] == user_id | ||
| assert consume_args.args[2] == user_id | ||
| assert consume_args.kwargs["model_id"] == "test-model" | ||
| assert consume_args.kwargs["provider_id"] == "test-provider" | ||
| assert consume_args.kwargs["input_tokens"] == 100 | ||
| assert consume_args.kwargs["output_tokens"] == 50 | ||
|
Comment on lines
1150
to
1157
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add assertion to verify token_usage_history parameter is passed to consume_tokens. The PR objective is to "store info about consumed tokens into token usage history," and the AI summary confirms that The test verifies 🔎 Suggested assertion to add mock_consume.assert_called_once()
consume_args = mock_consume.call_args
user_id, _, _, _ = test_auth
assert consume_args.args[2] == user_id
+assert consume_args.kwargs.get("token_usage_history") is not None
assert consume_args.kwargs["model_id"] == "test-model"
assert consume_args.kwargs["provider_id"] == "test-provider"
assert consume_args.kwargs["input_tokens"] == 100
assert consume_args.kwargs["output_tokens"] == 50Alternatively, if mock_consume.assert_called_once()
consume_args = mock_consume.call_args
user_id, _, _, _ = test_auth
+# Verify token_usage_history is passed (adjust index based on actual signature)
+assert consume_args.args[0] is not None or consume_args.args[1] is not None
assert consume_args.args[2] == user_id
assert consume_args.kwargs["model_id"] == "test-model"
assert consume_args.kwargs["provider_id"] == "test-provider"
assert consume_args.kwargs["input_tokens"] == 100
assert consume_args.kwargs["output_tokens"] == 50🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.