Skip to content

Commit d3e92be

Browse files
committed
fix(llamaindex): update JSONEncoder to use model_dump_json
1 parent eb5cdef commit d3e92be

File tree

1 file changed

+2
-0
lines changed
  • packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex

1 file changed

+2
-0
lines changed

packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class JSONEncoder(json.JSONEncoder):
6464
def default(self, o):
6565
if dataclasses.is_dataclass(o):
6666
return dataclasses.asdict(o)
67+
if hasattr(o, "model_dump_json"):
68+
return o.model_dump_json()
6769
elif hasattr(o, "json"):
6870
return o.json()
6971
elif hasattr(o, "to_json"):

0 commit comments

Comments
 (0)