mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 21:54:10 -05:00
fix: use the internal token usage tracker when using litellm
This commit is contained in:
@@ -1185,6 +1185,8 @@ class LLM(BaseLLM):
|
||||
start_time=0,
|
||||
end_time=0,
|
||||
)
|
||||
self._track_token_usage_internal(usage_info)
|
||||
|
||||
# --- 4) Check for tool calls
|
||||
tool_calls = getattr(response_message, "tool_calls", [])
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ def test_llm_call_with_string_input_and_callbacks():
|
||||
assert len(result.strip()) > 0
|
||||
assert usage_metrics.successful_requests == 1
|
||||
|
||||
usage_metrics_internal = llm.get_token_usage_summary()
|
||||
assert usage_metrics_internal == usage_metrics
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_llm_call_with_message_list():
|
||||
|
||||
Reference in New Issue
Block a user