Allow for last_input_token_count=None (#644)

This commit is contained in:
Robert Hodgson 2025-02-14 11:21:41 +00:00 committed by GitHub
parent cb2218a86f
commit a2e92c74a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ def stream_to_gradio(
for step_log in agent.run(task, stream=True, reset=reset_agent_memory, additional_args=additional_args): for step_log in agent.run(task, stream=True, reset=reset_agent_memory, additional_args=additional_args):
# Track tokens if model provides them # Track tokens if model provides them
if getattr(agent.model, "last_input_token_count", None): if getattr(agent.model, "last_input_token_count", None) is not None:
total_input_tokens += agent.model.last_input_token_count total_input_tokens += agent.model.last_input_token_count
total_output_tokens += agent.model.last_output_token_count total_output_tokens += agent.model.last_output_token_count
if isinstance(step_log, ActionStep): if isinstance(step_log, ActionStep):