From ee468a4e05b710cb44fffc61ff7c75f090b4f5a5 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Wed, 6 Mar 2024 12:08:22 -0800 Subject: [PATCH] (feat) circular ref error on prisa --- litellm/proxy/utils.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 9a2752148a..1e701515e1 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -507,24 +507,16 @@ class PrismaClient: return hashed_token - def handle_circular_references(obj: Any): - try: - # Try to serialize the object using default serialization - return json.dumps(obj) - except Exception as e: - # If a TypeError is raised, return an error message JSON - error_message: dict = { - "error": "Error converting to JSON", - "error_message": str(e), - } - return json.dumps(error_message) - def jsonify_object(self, data: dict) -> dict: db_data = copy.deepcopy(data) for k, v in db_data.items(): if isinstance(v, dict): - db_data[k] = json.dumps(v) + try: + db_data[k] = json.dumps(v) + except: + # This avoids Prisma retrying this 5 times, and making 5 clients + db_data[k] = "failed-to-serialize-json" return db_data @backoff.on_exception(