diff --git a/openbb_sdk/sdk/core/openbb_core/app/command_runner.py b/openbb_sdk/sdk/core/openbb_core/app/command_runner.py index e4e79afbbaa..5e06f1706c8 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/command_runner.py +++ b/openbb_sdk/sdk/core/openbb_core/app/command_runner.py @@ -111,6 +111,7 @@ class ParametersBuilder: @staticmethod def update_provider_choices( + func: Callable, command_coverage: Dict[str, List[str]], route: str, kwargs: Dict[str, Any], @@ -118,6 +119,11 @@ class ParametersBuilder: ) -> Dict[str, Any]: """Update the provider choices with the available providers and set default provider.""" + def _needs_provider(func: Callable) -> bool: + """Check if the function needs a provider.""" + parameters = signature(func).parameters.keys() + return "provider_choices" in parameters + def _has_provider(kwargs: Dict[str, Any]) -> bool: """Check if the kwargs already have a provider.""" if ( @@ -146,7 +152,7 @@ class ParametersBuilder: return command_cov_provider - if not _has_provider(kwargs): + if not _has_provider(kwargs) and _needs_provider(func): provider = ( _get_default_provider( command_coverage, @@ -210,6 +216,7 @@ class ParametersBuilder: user_settings=user_settings, ) kwargs = cls.update_provider_choices( + func=func, command_coverage=command_map.command_coverage, route=route, kwargs=kwargs,