mirror of
https://github.com/langgenius/dify.git
synced 2025-06-27 05:30:04 +00:00
12 lines
234 B
Python
12 lines
234 B
Python
![]() |
import json
|
||
|
|
||
|
from pydantic import BaseModel
|
||
|
|
||
|
|
||
|
class PydanticModelEncoder(json.JSONEncoder):
|
||
|
def default(self, o):
|
||
|
if isinstance(o, BaseModel):
|
||
|
return o.model_dump()
|
||
|
else:
|
||
|
super().default(o)
|