mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-24 07:36:47 +00:00
79e4d77bcf
* fix: Handle circular references in spend tracking metadata JSON serialization - Fixes issue #12634 where circular references in metadata caused ValueError: Circular reference detected when logging spend data - Adds _safe_json_dumps() function that detects and handles circular references by replacing them with placeholder strings - Maintains full functionality for normal objects while preventing crashes from circular references - Adds comprehensive tests for circular reference handling - Critical fix for v1.74.3 stable release * fix: Replace bare except clauses with specific Exception handling - Fixes E722 linting errors in _safe_json_dumps function - Maintains same error handling behavior while following best practices - All tests continue to pass * refactor: Use existing safe_dumps utility instead of custom implementation - Replace custom _safe_json_dumps() with existing safe_dumps() from litellm_core_utils - Remove duplicate code and leverage existing circular reference handling - Update tests to use safe_dumps function - Maintains same functionality while reducing code duplication - All tests continue to pass