vllm.envs ¶
VLLM_SKIP_MODEL_NAME_VALIDATION module-attribute ¶
VLLM_SKIP_MODEL_NAME_VALIDATION: bool = False
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__ ¶
__getattr__(name: str)
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
_resolve_rust_frontend_path ¶
_resolve_rust_frontend_path() -> str | None
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
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 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 | |
deprecated_env ¶
deprecated_env(
env_name: str,
removal_version: str,
replacement: str,
getter: Callable[[], Any],
) -> Callable[[], Any]
Wrap an env-var getter to emit a FutureWarning when the var is set.
Source code in vllm/envs.py
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_list_with_choices(
env_name: str,
default: list[str],
choices: list[str] | Callable[[], list[str]],
case_sensitive: bool = True,
) -> Callable[[], list[str]]
Create a lambda that validates environment variable containing comma-separated values against allowed choices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_name | str | Name of the environment variable | required |
default | list[str] | Default list of values if not set | required |
choices | list[str] | Callable[[], list[str]] | List of valid string options or callable that returns list | required |
case_sensitive | bool | Whether validation should be case sensitive | True |
Returns:
| Type | Description |
|---|---|
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_set_with_choices(
env_name: str,
default: list[str],
choices: list[str] | Callable[[], list[str]],
case_sensitive: bool = True,
) -> Callable[[], set[str]]
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_with_choices(
env_name: str,
default: str | None,
choices: list[str] | Callable[[], list[str]],
case_sensitive: bool = True,
) -> Callable[[], str | None]
Create a lambda that validates environment variable against allowed choices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_name | str | Name of the environment variable | required |
default | str | None | Default value if not set (can be None) | required |
choices | list[str] | Callable[[], list[str]] | List of valid string options or callable that returns list | required |
case_sensitive | bool | Whether validation should be case sensitive | True |
Returns:
| Type | Description |
|---|---|
Callable[[], str | None] | Lambda function for environment_variables dict |
Source code in vllm/envs.py
get_env_or_set_default ¶
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_vllm_port() -> int | None
Get the port from VLLM_PORT environment variable.
Returns:
| Type | Description |
|---|---|
int | None | The port number as an integer if VLLM_PORT is set, None otherwise. |
Raises:
| Type | Description |
|---|---|
ValueError | If VLLM_PORT is a URI, suggest k8s service discovery issue. |