mirror of https://github.com/kortix-ai/suna.git
Merge branch 'PRODUCTION'
This commit is contained in:
commit
524e1beb67
|
@ -357,6 +357,7 @@ class ResponseProcessor:
|
||||||
):
|
):
|
||||||
logger.info("🔥 No usage data from provider, counting with litellm.token_counter")
|
logger.info("🔥 No usage data from provider, counting with litellm.token_counter")
|
||||||
|
|
||||||
|
try:
|
||||||
# prompt side
|
# prompt side
|
||||||
prompt_tokens = token_counter(
|
prompt_tokens = token_counter(
|
||||||
model=llm_model,
|
model=llm_model,
|
||||||
|
@ -377,6 +378,10 @@ class ResponseProcessor:
|
||||||
f"🔥 Estimated tokens – prompt: {prompt_tokens}, "
|
f"🔥 Estimated tokens – prompt: {prompt_tokens}, "
|
||||||
f"completion: {completion_tokens}, total: {prompt_tokens + completion_tokens}"
|
f"completion: {completion_tokens}, total: {prompt_tokens + completion_tokens}"
|
||||||
)
|
)
|
||||||
|
self.trace.event(name="usage_calculated_with_litellm_token_counter", level="DEFAULT", status_message=(f"Usage calculated with litellm.token_counter"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Failed to calculate usage: {str(e)}")
|
||||||
|
self.trace.event(name="failed_to_calculate_usage", level="WARNING", status_message=(f"Failed to calculate usage: {str(e)}"))
|
||||||
|
|
||||||
|
|
||||||
# Wait for pending tool executions from streaming phase
|
# Wait for pending tool executions from streaming phase
|
||||||
|
@ -1273,7 +1278,7 @@ class ResponseProcessor:
|
||||||
"arguments": params # The extracted parameters
|
"arguments": params # The extracted parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(f"Parsed old format tool call: {tool_call}")
|
logger.debug(f"Parsed old format tool call: {tool_call["function_name"]}")
|
||||||
return tool_call, parsing_details # Return both dicts
|
return tool_call, parsing_details # Return both dicts
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -243,7 +243,7 @@ async def run_agent_background(
|
||||||
|
|
||||||
# Wait for all pending redis operations to complete, with timeout
|
# Wait for all pending redis operations to complete, with timeout
|
||||||
try:
|
try:
|
||||||
await asyncio.wait_for(asyncio.gather(*pending_redis_operations), timeout=5.0)
|
await asyncio.wait_for(asyncio.gather(*pending_redis_operations), timeout=30.0)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
logger.warning(f"Timeout waiting for pending Redis operations for {agent_run_id}")
|
logger.warning(f"Timeout waiting for pending Redis operations for {agent_run_id}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue