mirror of https://github.com/kortix-ai/suna.git
Merge pull request #1785 from KrishavRajSingh/main
remove fallback info
This commit is contained in:
commit
ae04dddf65
|
@ -8,6 +8,7 @@ throughout the agent execution pipeline using LiteLLM's standardized exceptions.
|
|||
from typing import Dict, Any, Optional, Union
|
||||
from dataclasses import dataclass
|
||||
from core.utils.logger import logger
|
||||
import re
|
||||
|
||||
# Import LiteLLM exceptions as documented at https://docs.litellm.ai/docs/exception_mapping
|
||||
try:
|
||||
|
@ -175,9 +176,15 @@ class ErrorProcessor:
|
|||
|
||||
@staticmethod
|
||||
def safe_error_to_string(error: Exception) -> str:
|
||||
"""Safely convert an exception to a string with fallbacks."""
|
||||
"""Safely convert an exception to a string, cleaning up verbose LiteLLM error messages."""
|
||||
try:
|
||||
return str(error)
|
||||
error_str = str(error)
|
||||
# remove fallback information
|
||||
if "Fallbacks=[" in error_str:
|
||||
error_str = re.sub(r'Fallbacks=\[(?:[^\[\]]+|\[(?:[^\[\]]+|\[[^\[\]]*\])*\])*\]', '', error_str)
|
||||
|
||||
return error_str
|
||||
|
||||
except Exception:
|
||||
try:
|
||||
# Handle case where error.args[0] might be a list or other non-string type
|
||||
|
|
Loading…
Reference in New Issue