Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance log storage to support more data types #1530

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crewai/memory/storage/kickoff_task_outputs_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def add(
task.expected_output,
json.dumps(output, cls=CrewJSONEncoder),
task_index,
json.dumps(inputs),
json.dumps(inputs, cls=CrewJSONEncoder),
was_replayed,
),
)
Expand Down
3 changes: 2 additions & 1 deletion src/crewai/utilities/crew_json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import json
from uuid import UUID
from pydantic import BaseModel
from decimal import Decimal


class CrewJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, BaseModel):
return self._handle_pydantic_model(obj)
elif isinstance(obj, UUID):
elif isinstance(obj, UUID) or isinstance(obj, Decimal):
return str(obj)

elif isinstance(obj, datetime) or isinstance(obj, date):
Expand Down
Loading