@@ -378,9 +378,11 @@ class _GenerativeAnyscale(_GenerativeConfigCreate):
378378
379379
380380class _GenerativeCustom (_GenerativeConfigCreate ):
381- module_config : Dict [str , Any ]
381+ module_config : Optional [ Dict [str , Any ] ]
382382
383383 def _to_dict (self ) -> Dict [str , Any ]:
384+ if self .module_config is None :
385+ return {}
384386 return self .module_config
385387
386388
@@ -495,9 +497,11 @@ class _RerankerCohereConfig(_RerankerConfigCreate):
495497
496498
497499class _RerankerCustomConfig (_RerankerConfigCreate ):
498- module_config : Dict [str , Any ]
500+ module_config : Optional [ Dict [str , Any ] ]
499501
500502 def _to_dict (self ) -> Dict [str , Any ]:
503+ if self .module_config is None :
504+ return {}
501505 return self .module_config
502506
503507
@@ -534,7 +538,7 @@ def anyscale(
534538 @staticmethod
535539 def custom (
536540 module_name : str ,
537- module_config : Dict [str , Any ],
541+ module_config : Optional [ Dict [str , Any ]] = None ,
538542 ) -> _GenerativeConfigCreate :
539543 """Create a `_GenerativeCustom` object for use when generating using a custom module.
540544
@@ -799,7 +803,9 @@ def transformers() -> _RerankerConfigCreate:
799803 return _RerankerTransformersConfig (reranker = Rerankers .TRANSFORMERS )
800804
801805 @staticmethod
802- def custom (module_name : str , module_config : Dict [str , Any ]) -> _RerankerConfigCreate :
806+ def custom (
807+ module_name : str , module_config : Optional [Dict [str , Any ]] = None
808+ ) -> _RerankerConfigCreate :
803809 """Create a `_RerankerCustomConfig` object for use when reranking using a custom module.
804810
805811 Arguments:
0 commit comments