-
Notifications
You must be signed in to change notification settings - Fork 583
Expand file tree
/
Copy path__init__.py
More file actions
43 lines (34 loc) · 1.53 KB
/
__init__.py
File metadata and controls
43 lines (34 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from typing import Any, Literal
from rlm.environments.base_env import BaseEnv, SupportsPersistence
from rlm.environments.local_repl import LocalREPL
__all__ = ["BaseEnv", "LocalREPL", "SupportsPersistence", "get_environment"]
def get_environment(
environment: Literal["local", "modal", "docker", "daytona", "prime", "monty"],
environment_kwargs: dict[str, Any],
) -> BaseEnv:
"""
Routes a specific environment and the args (as a dict) to the appropriate environment if supported.
Currently supported environments: ['local', 'modal', 'docker', 'daytona', 'prime', 'monty']
"""
if environment == "local":
return LocalREPL(**environment_kwargs)
elif environment == "modal":
from rlm.environments.modal_repl import ModalREPL
return ModalREPL(**environment_kwargs)
elif environment == "docker":
from rlm.environments.docker_repl import DockerREPL
return DockerREPL(**environment_kwargs)
elif environment == "daytona":
from rlm.environments.daytona_repl import DaytonaREPL
return DaytonaREPL(**environment_kwargs)
elif environment == "prime":
from rlm.environments.prime_repl import PrimeREPL
return PrimeREPL(**environment_kwargs)
elif environment == "monty":
from rlm.environments.monty_repl import MontyREPL
return MontyREPL(**environment_kwargs)
else:
raise ValueError(
f"Unknown environment: {environment}. Supported: "
"['local', 'modal', 'docker', 'daytona', 'prime', 'monty']"
)