vllm.envs ¶
Functions:
-
__getattr__–Gets environment variables lazily.
-
compile_factors–Return env vars used for torch.compile cache keys.
-
disable_envs_cache–Resets the environment variables cache. It could be used to isolate environments
-
enable_envs_cache–Enables caching of environment variables. This is useful for performance
-
env_list_with_choices–Create a lambda that validates environment variable
-
env_set_with_choices–Creates a lambda which that validates environment variable
-
env_with_choices–Create a lambda that validates environment variable against allowed choices
-
get_env_or_set_default–Create a lambda that returns an environment variable value if set,
-
get_vllm_port–Get the port from VLLM_PORT environment variable.
-
is_set–Check if an environment variable is explicitly set.
Attributes:
-
VLLM_SKIP_MODEL_NAME_VALIDATION(bool) –If set, vLLM will skip model name validation in API requests.
VLLM_SKIP_MODEL_NAME_VALIDATION = False module-attribute ¶
If set, vLLM will skip model name validation in API requests. This allows any model name to be accepted in the 'model' field of requests, making the server model-name agnostic. Useful for proxy/gateway scenarios.
__getattr__(name) ¶
Gets environment variables lazily.
NOTE: After enable_envs_cache() invocation (which triggered after service initialization), all environment variables will be cached.
Source code in vllm/envs.py
_is_envs_cache_enabled() ¶
_resolve_rust_frontend_path() ¶
Resolve the Rust frontend binary path.
Returns None if VLLM_USE_RUST_FRONTEND is not enabled. When enabled, resolves VLLM_RUST_FRONTEND_PATH ("auto" by default) to the actual binary path.
Source code in vllm/envs.py
compile_factors() ¶
Return env vars used for torch.compile cache keys.
Start with every known vLLM env var; drop entries in ignored_factors; hash everything else. This keeps the cache key aligned across workers.
Source code in vllm/envs.py
1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 | |
disable_envs_cache() ¶
Resets the environment variables cache. It could be used to isolate environments between unit tests.
Source code in vllm/envs.py
enable_envs_cache() ¶
Enables caching of environment variables. This is useful for performance reasons, as it avoids the need to re-evaluate environment variables on every call.
NOTE: Currently, it's invoked after service initialization to reduce runtime overhead. This also means that environment variables should NOT be updated after the service is initialized.
Source code in vllm/envs.py
env_list_with_choices(env_name, default, choices, case_sensitive=True) ¶
Create a lambda that validates environment variable containing comma-separated values against allowed choices
Parameters:
-
(env_name¶str) –Name of the environment variable
-
(default¶list[str]) –Default list of values if not set
-
(choices¶list[str] | Callable[[], list[str]]) –List of valid string options or callable that returns list
-
(case_sensitive¶bool, default:True) –Whether validation should be case sensitive
Returns:
-
Callable[[], list[str]]–Lambda function for environment_variables
-
Callable[[], list[str]]–dict that returns list of strings
Source code in vllm/envs.py
env_set_with_choices(env_name, default, choices, case_sensitive=True) ¶
Creates a lambda which that validates environment variable containing comma-separated values against allowed choices which returns choices as a set.
Source code in vllm/envs.py
env_with_choices(env_name, default, choices, case_sensitive=True) ¶
Create a lambda that validates environment variable against allowed choices
Parameters:
-
(env_name¶str) –Name of the environment variable
-
(default¶str | None) –Default value if not set (can be None)
-
(choices¶list[str] | Callable[[], list[str]]) –List of valid string options or callable that returns list
-
(case_sensitive¶bool, default:True) –Whether validation should be case sensitive
Returns:
Source code in vllm/envs.py
get_env_or_set_default(env_name, default_factory) ¶
Create a lambda that returns an environment variable value if set, or generates and sets a default value using the provided factory function.
Source code in vllm/envs.py
get_vllm_port() ¶
Get the port from VLLM_PORT environment variable.
Returns:
-
int | None–The port number as an integer if VLLM_PORT is set, None otherwise.
Raises:
-
ValueError–If VLLM_PORT is a URI, suggest k8s service discovery issue.
Source code in vllm/envs.py
is_set(name) ¶
Check if an environment variable is explicitly set.