mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 10:17:46 +00:00
Tighten validation of request body parameters in the proxy routing layer. Use context variables for internal call state management instead of passing flags through request kwargs. Clean up metadata handling at the proxy boundary.
14 lines
512 B
Python
14 lines
512 B
Python
"""
|
|
Internal request context for LiteLLM.
|
|
|
|
Provides a ContextVar-based mechanism for internal signals that must not
|
|
be settable from user input. Context variables are scoped to the current
|
|
asyncio task and cannot be injected via HTTP request bodies.
|
|
"""
|
|
|
|
from contextvars import ContextVar
|
|
|
|
# When True, suppresses async logging and billing for internal sub-calls
|
|
# (e.g., emulated file-search steps that make nested LLM calls).
|
|
is_internal_call: ContextVar[bool] = ContextVar("is_internal_call", default=False)
|