in src/open_r1/utils/code_providers.py [0:0]
def get_provider(provider_type: str = "e2b", **kwargs) -> CodeExecutionProvider:
"""Factory function to get the appropriate code execution provider.
Args:
provider_type: Type of provider to use ("e2b", "morph")
**kwargs: Additional arguments to pass to the provider
Returns:
An instance of CodeExecutionProvider
"""
num_parallel = kwargs.pop("num_parallel", 2)
if provider_type == "e2b":
# Extract E2B-specific arguments
e2b_router_url = kwargs.pop("e2b_router_url", None)
return E2BProvider(
num_parallel=num_parallel,
e2b_router_url=e2b_router_url,
)
elif provider_type == "morph":
# Extract Morph-specific arguments
morph_router_url = kwargs.pop("morph_router_url", None)
return MorphProvider(
num_parallel=num_parallel,
morph_router_url=morph_router_url,
)
else:
raise ValueError(f"Unknown provider type: {provider_type}")