Enhance log storage to support more data types #1530
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Our team is using crewAI for financial applications where non-basic data types like date, datetime and Decimal are heavily used. Input data to the crew contains such non-basic types which are usually retrieved from upstreaming data source.
After upgrading crewAI, the code execution failed because such data types in crew inputs are not handled during log storage inside crewAI. This has been a blocking issue for us and we would like to propose change to solve this and enhance the log storage.
Proposed Change
Manage encoding for different data types in
CrewJSONEncoder
and useCrewJSONEncoder
when seralizing the crew inputs during log storage.Test Case
The following sample code fails due to errors like
TypeError: Object of type {type} is not JSON serializable
wheretype
in the error message can be date, datetime, Decimal, etc. After applying the proposed change, the crew inputs can be successfully encoded and saved as defined and managed inCrewJSONEncoder
.