File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
2
+ import json
3
3
4
- # Copyright (c) 2021, 2024 Oracle and/or its affiliates.
4
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
-
7
6
import sys
8
7
import traceback
9
- from dataclasses import is_dataclass
10
8
11
9
import fire
10
+ from pydantic import BaseModel
12
11
13
12
from ads .common import logger
14
13
@@ -84,7 +83,14 @@ def serialize(data):
84
83
The string representation of each dataclass object.
85
84
"""
86
85
if isinstance (data , list ):
86
+ for item in data :
87
+ if isinstance (item , BaseModel ):
88
+ print (json .dumps (item .dict (), indent = 4 ))
89
+ else :
90
+ print (str (item ))
87
91
[print (str (item )) for item in data ]
92
+ elif isinstance (data , BaseModel ):
93
+ print (json .dumps (data .dict (), indent = 4 ))
88
94
else :
89
95
print (str (data ))
90
96
You can’t perform that action at this time.
0 commit comments