Serialize BaseModel
This commit is contained in:
parent
6f9e18f0c5
commit
58d318dd0e
1 changed files with 5 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ from pprint import pformat
|
||||||
from typing import Any, Dict, Generic, List, Optional, TypeVar
|
from typing import Any, Dict, Generic, List, Optional, TypeVar
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from pydantic import Extra, validator
|
from pydantic import BaseModel, Extra, validator
|
||||||
|
|
||||||
from ..helper import HashableBaseModel
|
from ..helper import HashableBaseModel
|
||||||
from .model import Model
|
from .model import Model
|
||||||
|
|
@ -77,7 +77,10 @@ class Trace(Generic[T], HashableBaseModel):
|
||||||
"original_execution_time_ms": self.original_execution_time_ms,
|
"original_execution_time_ms": self.original_execution_time_ms,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
**self.logged_values,
|
**{
|
||||||
|
k: v.dict() if isinstance(v, BaseModel) else v
|
||||||
|
for k, v in self.logged_values.items()
|
||||||
|
},
|
||||||
"models_flat": self.models_flat,
|
"models_flat": self.models_flat,
|
||||||
"exception_flat": self.exception_flat,
|
"exception_flat": self.exception_flat,
|
||||||
"output_flat": self.output_flat,
|
"output_flat": self.output_flat,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue