The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(proxy): drop legacy telemetry key from persisted WORKER_CONFIG before initialize
mateob2e123da4332
diff --git a/.github/template.yaml b/.github/template.yamlindex d4db2c2ac1f..c77e578e53c 100644--- a/.github/template.yaml+++ b/.github/template.yaml@@ -21,7 +21,7 @@ Parameters:WorkerConfigParameter:Type: StringDescription: Sample environment variable- Default: '{"model": null, "alias": null, "api_base": null, "api_version": "2023-07-01-preview", "debug": false, "temperature": null, "max_tokens": null, "request_timeout": 600, "max_budget": null, "telemetry": true, "drop_params": false, "add_function_to_prompt": false, "headers": null, "save": false, "config": null, "use_queue": false}'+ Default: '{"model": null, "alias": null, "api_base": null, "api_version": "2023-07-01-preview", "debug": false, "temperature": null, "max_tokens": null, "request_timeout": 600, "max_budget": null, "drop_params": false, "add_function_to_prompt": false, "headers": null, "save": false, "config": null, "use_queue": false}'Resources:MyUrlFunctionPermissions:diff --git a/cookbook/misc/config.yaml b/cookbook/misc/config.yamlindex d1d06eb5842..27a6332a882 100644--- a/cookbook/misc/config.yaml+++ b/cookbook/misc/config.yaml@@ -55,7 +55,6 @@ litellm_settings:# budget_duration: 30dnum_retries: 5request_timeout: 600- telemetry: Falsecontext_window_fallbacks: [{"gpt-3.5-turbo": ["gpt-3.5-turbo-large"]}]general_settings:diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex df326615764..9c4ea7e8599 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -1208,12 +1208,12 @@ async def proxy_startup_event(app: FastAPI) -> AsyncGenerator[None, None]:general_settings,) = await proxy_config.load_config(router=llm_router, config_file_path=worker_config)elif isinstance(worker_config, dict):- await initialize(**worker_config)+ await initialize_from_worker_config(worker_config)else:# if not, assume it's a json stringworker_config = json.loads(worker_config)if isinstance(worker_config, dict):- await initialize(**worker_config)+ await initialize_from_worker_config(worker_config)# check if DATABASE_URL in environment - load from thereif prisma_client is None:@@ -8568,6 +8568,13 @@ def save_worker_config(**data):os.environ["WORKER_CONFIG"] = json.dumps(data)+LEGACY_WORKER_CONFIG_KEYS: Final = frozenset({"telemetry"})+++async def initialize_from_worker_config(worker_config: dict[str, object]) -> None:+ await initialize(**{k: v for k, v in worker_config.items() if k not in LEGACY_WORKER_CONFIG_KEYS})++async def initialize(model=None,alias=None,diff --git a/tests/test_litellm/proxy/proxy_server/test_lifecycle.py b/tests/test_litellm/proxy/proxy_server/test_lifecycle.pyindex ba560cebd52..e9695685ca5 100644--- a/tests/test_litellm/proxy/proxy_server/test_lifecycle.py+++ b/tests/test_litellm/proxy/proxy_server/test_lifecycle.py@@ -43,6 +43,7 @@ from litellm.proxy.proxy_server import (cost_tracking,get_litellm_model_info,initialize,+ initialize_from_worker_config,load_from_azure_key_vault,proxy_shutdown_event,proxy_startup_event,@@ -522,6 +523,16 @@ async def test_initialize_invalid_unexpected_kwarg_raises_type_error():await initialize(this_is_not_a_real_kwarg=True)+async def test_initialize_from_worker_config_drops_legacy_telemetry_key():+ with pytest.raises(TypeError):+ await initialize(telemetry=True)+ await initialize_from_worker_config({"telemetry": True, "request_timeout": 77})+ assert ps.user_request_timeout == 77+ with pytest.raises(TypeError):+ await initialize_from_worker_config({"this_is_not_a_real_kwarg": True})++# ---------------------------------------------------------------------------# load_from_azure_key_vault# ---------------------------------------------------------------------------