@@ -49,12 +49,12 @@ def __init__(self, payload: Dict[str, Any]):
4949 self .type : Optional [str ] = payload .get ("type" )
5050 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
5151
52- def to_dict (self ):
52+ def to_dict (self ) -> Dict [ str , Any ] :
5353 return {
5454 "description" : self .description ,
5555 "knowledge_source_details" : self .knowledge_source_details ,
5656 "name" : self .name ,
57- "policy" : self .policy .to_dict () if self .policy is not None else None ,
57+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
5858 "type" : self .type ,
5959 "embedding_model" : self .embedding_model ,
6060 }
@@ -78,7 +78,7 @@ def __init__(self, payload: Dict[str, Any]):
7878 )
7979 self .type : Optional [str ] = payload .get ("type" )
8080
81- def to_dict (self ):
81+ def to_dict (self ) -> Dict [ str , Any ] :
8282 return {
8383 "description" : self .description ,
8484 "id" : self .id ,
@@ -110,12 +110,12 @@ def __init__(self, payload: Dict[str, Any]):
110110 self .type : Optional [str ] = payload .get ("type" )
111111 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
112112
113- def to_dict (self ):
113+ def to_dict (self ) -> Dict [ str , Any ] :
114114 return {
115115 "description" : self .description ,
116116 "knowledge_source_details" : self .knowledge_source_details ,
117117 "name" : self .name ,
118- "policy" : self .policy .to_dict () if self .policy is not None else None ,
118+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
119119 "type" : self .type ,
120120 "embedding_model" : self .embedding_model ,
121121 }
@@ -296,12 +296,12 @@ def __init__(self, payload: Dict[str, Any]):
296296 self .type : Optional [str ] = payload .get ("type" )
297297 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
298298
299- def to_dict (self ):
299+ def to_dict (self ) -> Dict [ str , Any ] :
300300 return {
301301 "description" : self .description ,
302302 "knowledge_source_details" : self .knowledge_source_details ,
303303 "name" : self .name ,
304- "policy" : self .policy .to_dict () if self .policy is not None else None ,
304+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
305305 "type" : self .type ,
306306 "embedding_model" : self .embedding_model ,
307307 }
@@ -325,7 +325,7 @@ def __init__(self, payload: Dict[str, Any]):
325325 )
326326 self .type : Optional [str ] = payload .get ("type" )
327327
328- def to_dict (self ):
328+ def to_dict (self ) -> Dict [ str , Any ] :
329329 return {
330330 "description" : self .description ,
331331 "id" : self .id ,
@@ -357,12 +357,12 @@ def __init__(self, payload: Dict[str, Any]):
357357 self .type : Optional [str ] = payload .get ("type" )
358358 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
359359
360- def to_dict (self ):
360+ def to_dict (self ) -> Dict [ str , Any ] :
361361 return {
362362 "description" : self .description ,
363363 "knowledge_source_details" : self .knowledge_source_details ,
364364 "name" : self .name ,
365- "policy" : self .policy .to_dict () if self .policy is not None else None ,
365+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
366366 "type" : self .type ,
367367 "embedding_model" : self .embedding_model ,
368368 }
@@ -585,12 +585,12 @@ def __init__(self, payload: Dict[str, Any]):
585585 self .type : Optional [str ] = payload .get ("type" )
586586 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
587587
588- def to_dict (self ):
588+ def to_dict (self ) -> Dict [ str , Any ] :
589589 return {
590590 "description" : self .description ,
591591 "knowledge_source_details" : self .knowledge_source_details ,
592592 "name" : self .name ,
593- "policy" : self .policy .to_dict () if self .policy is not None else None ,
593+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
594594 "type" : self .type ,
595595 "embedding_model" : self .embedding_model ,
596596 }
@@ -646,12 +646,12 @@ def __init__(self, payload: Dict[str, Any]):
646646 self .type : Optional [str ] = payload .get ("type" )
647647 self .embedding_model : Optional [str ] = payload .get ("embedding_model" )
648648
649- def to_dict (self ):
649+ def to_dict (self ) -> Dict [ str , Any ] :
650650 return {
651651 "description" : self .description ,
652652 "knowledge_source_details" : self .knowledge_source_details ,
653653 "name" : self .name ,
654- "policy" : self .policy .to_dict () if self .policy is not None else None ,
654+ "policy" : self .policy .to_dict () if ( self .policy is not None and hasattr ( self . policy , "to_dict" )) else None ,
655655 "type" : self .type ,
656656 "embedding_model" : self .embedding_model ,
657657 }
0 commit comments