mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
add LITELLM_UI_ALLOW_HEADERS
This commit is contained in:
parent
e25f7f1f7a
commit
5aca737650
2 changed files with 26 additions and 3 deletions
|
|
@ -81,6 +81,11 @@ MAX_MCP_SEMANTIC_FILTER_TOOLS_HEADER_LENGTH = int(
|
|||
os.getenv("MAX_MCP_SEMANTIC_FILTER_TOOLS_HEADER_LENGTH", 150)
|
||||
)
|
||||
|
||||
LITELLM_UI_ALLOW_HEADERS = [
|
||||
"x-litellm-semantic-filter",
|
||||
"x-litellm-semantic-filter-tools",
|
||||
]
|
||||
|
||||
# Gemini model-specific minimal thinking budget constants
|
||||
DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET_GEMINI_2_5_FLASH = int(
|
||||
os.getenv("DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET_GEMINI_2_5_FLASH", 1)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ from litellm.constants import (
|
|||
DEFAULT_SLACK_ALERTING_THRESHOLD,
|
||||
LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS,
|
||||
LITELLM_SETTINGS_SAFE_DB_OVERRIDES,
|
||||
LITELLM_UI_ALLOW_HEADERS,
|
||||
)
|
||||
from litellm.litellm_core_utils.litellm_logging import (
|
||||
_init_custom_logger_compatible_class,
|
||||
|
|
@ -1214,6 +1215,7 @@ app.add_middleware(
|
|||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=LITELLM_UI_ALLOW_HEADERS,
|
||||
)
|
||||
|
||||
app.add_middleware(PrometheusAuthMiddleware)
|
||||
|
|
@ -3958,10 +3960,26 @@ class ProxyConfig:
|
|||
# Check if settings have changed (compare with in-memory state)
|
||||
if hasattr(self, "_last_semantic_filter_config"):
|
||||
if self._last_semantic_filter_config == mcp_semantic_filter_config:
|
||||
verbose_proxy_logger.debug(
|
||||
"Semantic filter settings unchanged, skipping reinitialization"
|
||||
# If hook is missing or router isn't built yet, reinitialize anyway
|
||||
active_hooks = (
|
||||
litellm.logging_callback_manager.get_custom_loggers_for_type(
|
||||
SemanticToolFilterHook
|
||||
)
|
||||
)
|
||||
if active_hooks:
|
||||
for active_hook in active_hooks:
|
||||
if isinstance(active_hook, SemanticToolFilterHook):
|
||||
if (
|
||||
active_hook.filter is not None
|
||||
and active_hook.filter.tool_router is not None
|
||||
):
|
||||
verbose_proxy_logger.debug(
|
||||
"Semantic filter settings unchanged, skipping reinitialization"
|
||||
)
|
||||
return
|
||||
verbose_proxy_logger.info(
|
||||
"Semantic filter settings unchanged, but hook is missing or uninitialized. Reinitializing."
|
||||
)
|
||||
return
|
||||
|
||||
# Remove old hooks using logging callback manager
|
||||
litellm.logging_callback_manager.remove_callbacks_by_type(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue