diff --git a/.github/template.yaml b/.github/template.yaml index d4db2c2ac1f..c77e578e53c 100644 --- a/.github/template.yaml +++ b/.github/template.yaml @@ -21,7 +21,7 @@ Parameters: WorkerConfigParameter: Type: String Description: 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/livekit_agent_sdk/config.example.yaml b/cookbook/livekit_agent_sdk/config.example.yaml index 1361f36af34..072625018a7 100644 --- a/cookbook/livekit_agent_sdk/config.example.yaml +++ b/cookbook/livekit_agent_sdk/config.example.yaml @@ -15,7 +15,6 @@ model_list: litellm_settings: drop_params: True - telemetry: False general_settings: master_key: sk-1234 # Change this to a secure key diff --git a/cookbook/misc/config.yaml b/cookbook/misc/config.yaml index d1d06eb5842..27a6332a882 100644 --- a/cookbook/misc/config.yaml +++ b/cookbook/misc/config.yaml @@ -55,7 +55,6 @@ litellm_settings: # budget_duration: 30d num_retries: 5 request_timeout: 600 - telemetry: False context_window_fallbacks: [{"gpt-3.5-turbo": ["gpt-3.5-turbo-large"]}] general_settings: diff --git a/litellm/__init__.py b/litellm/__init__.py index e17ab613dac..738dd0cac76 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -240,7 +240,6 @@ email: Optional[str] = ( token: Optional[str] = ( None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648 ) -telemetry = True max_tokens: int = DEFAULT_MAX_TOKENS # OpenAI Defaults drop_params = drop_params_env_flag(os.environ, verbose_logger) modify_params = bool(os.getenv("LITELLM_MODIFY_PARAMS", False)) diff --git a/litellm/proxy/dev_config.yaml b/litellm/proxy/dev_config.yaml index a9aa78480b6..1fc9e09b897 100644 --- a/litellm/proxy/dev_config.yaml +++ b/litellm/proxy/dev_config.yaml @@ -212,7 +212,6 @@ sandbox_tools: litellm_settings: drop_params: True - telemetry: False code_interpreter_interception_params: enabled: true sandbox_tool_name: e2b_sandbox diff --git a/litellm/proxy/example_config_yaml/oai_misc_config.yaml b/litellm/proxy/example_config_yaml/oai_misc_config.yaml index 26597a31430..584c8172f43 100644 --- a/litellm/proxy/example_config_yaml/oai_misc_config.yaml +++ b/litellm/proxy/example_config_yaml/oai_misc_config.yaml @@ -38,7 +38,6 @@ litellm_settings: # budget_duration: 30d num_retries: 5 request_timeout: 600 - telemetry: False context_window_fallbacks: [{"gpt-5-mini": ["gpt-5.5"]}] default_team_settings: - team_id: team-1 diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.py index 0477b6c62e9..464d1141f8d 100644 --- a/litellm/proxy/proxy_cli.py +++ b/litellm/proxy/proxy_cli.py @@ -56,8 +56,6 @@ if litellm_mode == "DEV": load_dotenv() from enum import Enum -telemetry: Final = None - class LiteLLMDatabaseConnectionPool(Enum): database_connection_pool_limit = 10 @@ -758,9 +756,11 @@ class ProxyInitializationHelpers: ) @click.option( "--telemetry", - default=True, + default=None, type=bool, - help="Helps us know if people are using this feature. Turn this off by doing `--telemetry False`", + hidden=True, + expose_value=False, + help="Deprecated no-op kept so existing start commands still parse", ) @click.option( "--log_config", @@ -977,7 +977,6 @@ def run_server( add_function_to_prompt, config, max_budget, - telemetry, test, local, num_workers, @@ -1082,7 +1081,6 @@ def run_server( max_tokens=max_tokens, request_timeout=request_timeout, max_budget=max_budget, - telemetry=telemetry, drop_params=drop_params, add_function_to_prompt=add_function_to_prompt, headers=headers, diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index dae88da5974..7634237a59f 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1230,12 +1230,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 string worker_config = json.loads(worker_config) if isinstance(worker_config, dict): - await initialize(**worker_config) + await initialize_from_worker_config(worker_config) enforce_master_key_boot_verdict( await with_stored_secrets_counted( @@ -2426,7 +2426,6 @@ user_debug = False user_max_tokens = None user_request_timeout = None user_temperature = None -user_telemetry = True user_config: Final = None user_headers = None user_config_file_path: str | None = None @@ -8621,6 +8620,14 @@ 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: Mapping[str, object]) -> None: + supported: Final = MappingProxyType({k: v for k, v in worker_config.items() if k not in LEGACY_WORKER_CONFIG_KEYS}) + await initialize(**supported) + + async def initialize( model=None, alias=None, @@ -8632,7 +8639,6 @@ async def initialize( max_tokens=None, request_timeout=600, max_budget=None, - telemetry=False, drop_params=True, add_function_to_prompt=True, headers=None, @@ -8648,7 +8654,6 @@ async def initialize( user_user_max_tokens, \ user_request_timeout, \ user_temperature, \ - user_telemetry, \ user_headers, \ experimental, \ llm_model_list, \ @@ -8755,7 +8760,6 @@ async def initialize( dynamic_config["general"]["max_budget"] = litellm.max_budget if experimental: pass - user_telemetry = telemetry # for streaming diff --git a/litellm/proxy/wildcard_config.yaml b/litellm/proxy/wildcard_config.yaml index 9ded21d6560..dc0206388c3 100644 --- a/litellm/proxy/wildcard_config.yaml +++ b/litellm/proxy/wildcard_config.yaml @@ -49,4 +49,3 @@ general_settings: litellm_settings: drop_params: True - telemetry: False diff --git a/proxy_server_config.yaml b/proxy_server_config.yaml index b2ff4a0979b..24e26ea8e22 100644 --- a/proxy_server_config.yaml +++ b/proxy_server_config.yaml @@ -173,7 +173,6 @@ litellm_settings: # budget_duration: 30d num_retries: 5 request_timeout: 600 - telemetry: False context_window_fallbacks: [{"gpt-3.5-turbo": ["gpt-3.5-turbo-large"]}] default_team_settings: - team_id: team-1 diff --git a/scripts/benchmark_anthropic_messages_perf.py b/scripts/benchmark_anthropic_messages_perf.py index 3c8a22f0cc2..3e4b4b25b6a 100644 --- a/scripts/benchmark_anthropic_messages_perf.py +++ b/scripts/benchmark_anthropic_messages_perf.py @@ -256,7 +256,6 @@ general_settings: master_key: {api_key} litellm_settings: - telemetry: false """, encoding="utf-8", ) diff --git a/scripts/benchmark_chat_completions_perf.py b/scripts/benchmark_chat_completions_perf.py index 2c211f674fe..c9f025a145f 100644 --- a/scripts/benchmark_chat_completions_perf.py +++ b/scripts/benchmark_chat_completions_perf.py @@ -228,7 +228,6 @@ general_settings: litellm_settings: drop_params: true - telemetry: false """, encoding="utf-8", ) diff --git a/tests/integration/_support/process.py b/tests/integration/_support/process.py index 84ee2ad1b79..e0923c9d055 100644 --- a/tests/integration/_support/process.py +++ b/tests/integration/_support/process.py @@ -74,8 +74,6 @@ def owned_proxy(gateway: Gateway, directory: Path, overrides: Mapping[str, str], str(port), "--num_workers", "1", - "--telemetry", - "False", "--use_prisma_db_push", "--enforce_prisma_migration_check", ], diff --git a/tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py b/tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py index 9faaaf492e8..5571c15beff 100644 --- a/tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py +++ b/tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py @@ -883,7 +883,6 @@ async def test_provider_specific_fields_in_proxy_http_response( max_tokens=None, request_timeout=600, max_budget=None, - telemetry=False, drop_params=True, add_function_to_prompt=False, headers=None, diff --git a/tests/proxy_unit_tests/test_proxy_utils.py b/tests/proxy_unit_tests/test_proxy_utils.py index 160753e3442..7cdd7365209 100644 --- a/tests/proxy_unit_tests/test_proxy_utils.py +++ b/tests/proxy_unit_tests/test_proxy_utils.py @@ -1112,7 +1112,6 @@ def test_settings_store_preserves_yaml_team_configuration_when_db_value_is_null( }, "param_name": "litellm_settings", "db_param_value": { - "telemetry": False, "drop_params": True, "num_retries": 5, "request_timeout": 600, diff --git a/tests/test_litellm/llms/wandb/test_wandb_chat_transformation.py b/tests/test_litellm/llms/wandb/test_wandb_chat_transformation.py index dd0d1bdbb9d..a25ed585ecc 100644 --- a/tests/test_litellm/llms/wandb/test_wandb_chat_transformation.py +++ b/tests/test_litellm/llms/wandb/test_wandb_chat_transformation.py @@ -47,7 +47,6 @@ WANDB_REASONING_MODELS: Final = ( @pytest.fixture def wandb_test_config(local_model_cost_map, monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(litellm, "disable_aiohttp_transport", True) - monkeypatch.setattr(litellm, "telemetry", False) monkeypatch.setattr(litellm, "drop_params", False) diff --git a/tests/test_litellm/proxy/proxy_server/test_lifecycle.py b/tests/test_litellm/proxy/proxy_server/test_lifecycle.py index 6121608b658..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, @@ -376,7 +377,7 @@ def _lit4152_worker_config_dict(): "master_key": _LIT4152_SECRETS[0], "database_url": _LIT4152_SECRETS[3], "api_key": _LIT4152_SECRETS[2], - "telemetry": True, + "drop_params": True, } @@ -394,7 +395,7 @@ def test__redact_worker_config_for_logging_dict_masks_all_secret_shapes(): assert secret not in rendered, f"leak: {secret} in {rendered!r}" assert isinstance(redacted, dict) assert redacted["model"] == "openai/gpt-4o-mini" - assert redacted["telemetry"] is True + assert redacted["drop_params"] is True def test__redact_worker_config_for_logging_json_string_round_trips_masked(): @@ -501,7 +502,7 @@ def test__redact_worker_config_for_logging_masks_nested_secret_fields(): def test_initialize_signature_is_async_with_expected_params(): sig = inspect.signature(initialize) # Hard-coded so a signature change (param added/removed) trips the gate. - expected_param_count = 17 + expected_param_count = 16 observed = { "is_async": inspect.iscoroutinefunction(initialize), "param_count": len(sig.parameters), @@ -522,6 +523,16 @@ async def test_initialize_invalid_unexpected_kwarg_raises_type_error(): await initialize(this_is_not_a_real_kwarg=True) +@pytest.mark.asyncio +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 # --------------------------------------------------------------------------- diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.py index c806725d594..8cbae859b5c 100644 --- a/tests/test_litellm/proxy/test_proxy_cli.py +++ b/tests/test_litellm/proxy/test_proxy_cli.py @@ -617,6 +617,15 @@ class TestProxyInitializationHelpers: assert "Skipping server startup" in result.output mock_uvicorn_run.assert_not_called() + result = runner.invoke( + run_server, ["--local", "--skip_server_startup", "--telemetry", "False"] + ) + assert ( + result.exit_code == 0 + ), f"exit_code={result.exit_code}, output={result.output}" + assert "Skipping server startup" in result.output + assert "telemetry" not in runner.invoke(run_server, ["--help"]).output + # --- normal startup --- mock_uvicorn_run.reset_mock()