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
_deprecated_triton_attn_use_td() ¶
Warn that VLLM_TRITON_ATTN_USE_TD was renamed to VLLM_TRITON_USE_TD.
The old name is ignored; VLLM_TRITON_USE_TD is the supported variable.
Source code in vllm/envs.py
_is_envs_cache_enabled() ¶
_resolve_rust_cli_path() ¶
Resolve the vllm-rs binary path.
Returns None unless VLLM_USE_RUST_FRONTEND or VLLM_USE_RUST_BENCH is 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
2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | |
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.