From b9470ffb443f706ec18c9a0a47706b73382989bf Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Sun, 24 Aug 2025 14:25:35 -0700 Subject: [PATCH] fix cannot access local variable 'prompt_tokens' where it is not associated with a value (#3286) --- skyvern/forge/sdk/api/llm/api_handler_factory.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/skyvern/forge/sdk/api/llm/api_handler_factory.py b/skyvern/forge/sdk/api/llm/api_handler_factory.py index 95762bac..a87a7572 100644 --- a/skyvern/forge/sdk/api/llm/api_handler_factory.py +++ b/skyvern/forge/sdk/api/llm/api_handler_factory.py @@ -198,6 +198,13 @@ class LLMAPIHandlerFactory: thought=thought, ai_suggestion=ai_suggestion, ) + prompt_tokens = 0 + completion_tokens = 0 + reasoning_tokens = 0 + cached_tokens = 0 + completion_token_detail = None + cached_token_detail = None + llm_cost = 0 if step or thought: try: # FIXME: volcengine doesn't support litellm cost calculation.