Skip to content

Commit

Permalink
Merge pull request #266 from parea-ai/fix-json-error
Browse files Browse the repository at this point in the history
fix: not JSON serializable inputs
  • Loading branch information
joschkabraun committed Jan 8, 2024
2 parents 995a738 + fdcd4ef commit 7a0e9c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions parea/utils/trace_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ def init_trace(func_name, args, kwargs, func) -> tuple[str, float]:

inputs = {k: v for k, v in zip(parameters.keys(), args)}
inputs.update(kwargs)
# filter out any values which aren't JSON serializable
for k, v in inputs.items():
try:
json.dumps(v)
except TypeError:
inputs[k] = str(v)

trace_data.get()[trace_id] = TraceLog(
trace_id=trace_id,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.27"
version = "0.2.28"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit 7a0e9c3

Please sign in to comment.