From 64637155678832241422b89c94f0c19179fa242b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 20:09:14 +0000 Subject: [PATCH] Fix serialization to use str() instead of repr() for better custom object output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change to_serializable() to use str(obj) instead of repr(obj) for unknown objects - This provides more meaningful serialization output for custom objects with __str__ methods - Regenerate VCR cassette for DataFrame test to include complete API interactions - Fixes test_interpolate_custom_object_validation expecting '5' in serialized output Co-Authored-By: João --- src/crewai/utilities/serialization.py | 2 +- ...st_crew_kickoff_with_pandas_dataframe.yaml | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/crewai/utilities/serialization.py b/src/crewai/utilities/serialization.py index c3c0c3d47..85f2abc7b 100644 --- a/src/crewai/utilities/serialization.py +++ b/src/crewai/utilities/serialization.py @@ -68,7 +68,7 @@ def to_serializable( _current_depth=_current_depth + 1, ) else: - return repr(obj) + return str(obj) def _to_serializable_key(key: Any) -> str: diff --git a/tests/cassettes/test_crew_kickoff_with_pandas_dataframe.yaml b/tests/cassettes/test_crew_kickoff_with_pandas_dataframe.yaml index 1f7563e03..bae9c7da1 100644 --- a/tests/cassettes/test_crew_kickoff_with_pandas_dataframe.yaml +++ b/tests/cassettes/test_crew_kickoff_with_pandas_dataframe.yaml @@ -48,7 +48,7 @@ interactions: Content-Length: - '144138' Date: - - Sat, 31 May 2025 19:53:39 GMT + - Sat, 31 May 2025 20:07:51 GMT Permissions-Policy: - publickey-credentials-create=(self),publickey-credentials-get=(self),accelerometer=(),ambient-light-sensor=(),autoplay=(),battery=(),camera=(),display-capture=(),document-domain=(),encrypted-media=(),execution-while-not-rendered=(),execution-while-out-of-viewport=(),fullscreen=(),gamepad=(),geolocation=(),gyroscope=(),hid=(),identity-credentials-get=(),idle-detection=(),local-fonts=(),magnetometer=(),microphone=(),midi=(),otp-credentials=(),payment=(),picture-in-picture=(),screen-wake-lock=(),serial=(),speaker-selection=(),storage-access=(),usb=(),web-share=(),xr-spatial-tracking=() Strict-Transport-Security: @@ -66,9 +66,9 @@ interactions: X-Permitted-Cross-Domain-Policies: - none X-Served-By: - - cache-iad-kjyo7100125-IAD, cache-iad-kjyo7100044-IAD, cache-bfi-krnt7300077-BFI + - cache-iad-kjyo7100125-IAD, cache-iad-kjyo7100044-IAD, cache-bfi-krnt7300026-BFI X-Timer: - - S1748721219.226870,VS0,VE2 + - S1748722071.124994,VS0,VE1 X-XSS-Protection: - 1; mode=block access-control-allow-headers: @@ -167,8 +167,10 @@ interactions: \ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": \"invalid_api_key\"\n }\n}\n" headers: + CF-Cache-Status: + - DYNAMIC CF-RAY: - - 948904c4999d1f9a-SEA + - 94891990e9ca75f1-SEA Connection: - keep-alive Content-Length: @@ -176,27 +178,25 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Sat, 31 May 2025 19:53:39 GMT + - Sat, 31 May 2025 20:07:51 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=pl08GXjlh8ZlFKjF10N5pD2MdKFHsw4idM1LLzh0z6o-1748721219-1.0.1.1-HPLjxK1pX1vDBORs3o6rDB2hZxTNU9iCzEmvGNX1dldI8HgAZ6YInBKraZ_pZIKskdbpVoTZl6IwaBfA9n6HK95pOaeqVDJgZsyi1Cjoz8w; - path=/; expires=Sat, 31-May-25 20:23:39 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=09gKIib81QGM572HIGBmZOYd9OFA7Yu3XcPOFlzpELk-1748722071-1.0.1.1-8a5HPfQDIdpVsOQZDkHvoTzET0ZU363KSXEMJzYLp0RhAw6gVGNMIBSvsHvXU01Wo2GDYjbKAjiNNO847YpGaf0z.yRdd1vuku2SZOrS600; + path=/; expires=Sat, 31-May-25 20:37:51 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=vKsJDmmldBMI8LqS2p.XKRV7ieUbTg6805.MZE2adFk-1748721219407-0.0.1.1-604800000; + - _cfuvid=0u9K62rx.6sck3G_HbM4lY3P6JdhwBgTmKwn2f.u3EU-1748722071298-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None X-Content-Type-Options: - nosniff alt-svc: - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC strict-transport-security: - max-age=31536000; includeSubDomains; preload vary: - Origin x-request-id: - - req_4bf812b1540c3c2fec987186cd3be168 + - req_b6500475f0c7bf43eafd2d28496f4d80 status: code: 401 message: Unauthorized