litellm/tests/test_litellm/integrations
yuneng-jiang 7899463c6a
fix(callbacks): forward callback_settings to callback initializers and guard consumers against non-dict values (#30161)
* fix(datadog): pass callback_specific_params so DatadogCostManagementLogger receives cost_tag_keys (#29590)

* fix(datadog): pass callback_specific_params so DatadogCostManagementLogger receives cost_tag_keys

* test(proxy): regression test that load_config forwards callback_specific_params

* fix(proxy): guard lakera_prompt_injection callback_specific_params against non-dict

Addresses review feedback: forwarding callback_settings as callback_specific_params
(so DatadogCostManagementLogger receives cost_tag_keys) exposed the
lakera_prompt_injection branch, which did lakeraAI_Moderation(**callback_specific_params
["lakera_prompt_injection"]) with no type guard. A config like
`callback_settings: {lakera_prompt_injection: "any-string"}` then hit `**"any-string"`
-> TypeError: argument after ** must be a mapping, not str.

Guard the lakera branch with isinstance(dict), matching the existing presidio and
datadog_cost_management branches (non-dict values fall back to {}). Add a regression
test asserting initialize_callbacks_on_proxy ignores a non-dict value instead of crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: inject fake lakera_ai module to avoid importing the real one

CI fix for the lakera regression test: it stubbed litellm.proxy.proxy_server with
a SimpleNamespace and then monkeypatch.setattr'd the real lakera_ai module, which
forces importing it — and lakera_ai does `from litellm.proxy.proxy_server import
LiteLLM_TeamTable`, absent on the stub -> ImportError under proxy-infra tests.

Inject a fake lakera_ai module into sys.modules instead, so the callbacks branch's
`from ...lakera_ai import lakeraAI_Moderation` resolves to the stub without loading
the real module. The guard under test (isinstance(dict) in the lakera branch) is
unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(callbacks): guard compression/websearch interceptors against non-dict callback_settings (#30153)

#29590 forwards the full callback_settings dict into initialize_callbacks_on_proxy, which activates the compression_interception and websearch_interception consumers. Their initialize_from_proxy_config read the callback_settings subkey without an isinstance(dict) guard, so a non-dict value such as `compression_interception: true` reached from_config_yaml(...).get(...) and aborted proxy startup with AttributeError. #29590 added that guard for lakera_prompt_injection but not for these two

Mirror the isinstance(dict) guard already used by the lakera, presidio, and datadog branches so a non-dict value is ignored and the callback initializes with defaults. A parametrized test feeds every callback_settings consumer a non-dict value through initialize_callbacks_on_proxy to catch a future consumer that forgets the guard

* fix(callbacks): normalize non-dict callback_specific_params to empty dict

A blank callback_settings: key in YAML loads as None, and
config.get('callback_settings', {}) returns None because dict.get only
falls back to the default when the key is absent. Forwarding that value
verbatim to initialize_callbacks_on_proxy made the first
'<name>' in callback_specific_params membership test raise
TypeError: argument of type 'NoneType' is not iterable, aborting proxy
startup. Same failure for any non-dict root such as callback_settings: true.

Normalize the value at the function boundary so both callsites (and any
future ones) initialize callbacks with their defaults instead of crashing.

---------

Co-authored-by: Hedi Daoud <150018939+hdaoud23@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 15:22:00 -07:00
..
arize feat(arize/phoenix): OpenInference rendering parity — tool_calls, cost, passthrough I/O, session/user, multimodal, cache tokens (#28800) 2026-06-03 12:09:50 -07:00
azure_storage style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
bitbucket fix: block path traversal SSRF in BitBucket, Arize Phoenix, and AssemblyAI clients (#26943) 2026-05-01 11:45:12 -07:00
cloudzero style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
compression_interception fix(callbacks): forward callback_settings to callback initializers and guard consumers against non-dict values (#30161) 2026-06-10 15:22:00 -07:00
datadog fix(datadog): split oversized batches on 413 instead of re-queueing forever (#29444) 2026-06-01 14:01:31 -07:00
dotprompt style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
focus feat(vantage): include organization metadata in FOCUS Tags export (#28184) 2026-06-09 02:59:21 +03:00
gcs_bucket fix cloud storage file guards 2026-05-01 15:34:11 -07:00
gcs_pubsub
gitlab style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
langfuse Litellm oss staging 050626 (#29774) 2026-06-05 13:51:51 -07:00
levo style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
litellm_agent Agent Builder - support new experimental agent builder, to ensure agents pass compliance checks (#21817) 2026-02-21 15:32:47 -08:00
open_telemetry fix(otel): capture 401 error details in management endpoint spans (#29535) 2026-06-02 16:40:30 -07:00
opik Litellm oss staging 030626 (#29578) 2026-06-03 11:01:51 -07:00
otel fix: missing mcp otel attributes (#29554) 2026-06-02 18:51:48 -07:00
SlackAlerting style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
websearch_interception fix(callbacks): forward callback_settings to callback initializers and guard consumers against non-dict values (#30161) 2026-06-10 15:22:00 -07:00
rubrik_test_helpers.py Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
test_agentops.py
test_anthropic_cache_control_hook.py fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID 2026-04-28 14:24:19 -07:00
test_athina.py
test_azure_sentinel.py Add Azure Sentinel audit log support (#27280) 2026-05-06 15:50:06 -07:00
test_braintrust_logging.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_braintrust_span_name.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_custom_guardrail_recursion.py fix: recursive pydantic issue (#19531) 2026-01-22 19:56:41 -08:00
test_custom_guardrail.py [internal copy of #29511] feat(guardrails): add sensitive data routing to on-premise models (#29531) 2026-06-04 22:22:28 -07:00
test_custom_prompt_management.py [Fix] CI/CD - Fix failing proxy and core integration tests (#17926) 2025-12-13 10:11:01 -08:00
test_deepeval.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_galileo.py feat(galileo): add health check support for UI callback test (#29908) 2026-06-08 13:57:03 -07:00
test_langfuse_otel.py fix: prevent sys.modules["langfuse"] import failures in langfuse unit tests 2026-02-18 08:22:23 -03:00
test_langfuse.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_langsmith_init.py Remove unneeded metadata info from LangSmith 2026-05-01 15:42:12 -07:00
test_mlflow.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openmeter.py Litellm oss staging 050626 (#29774) 2026-06-05 13:51:51 -07:00
test_opentelemetry_dynamic_imports.py Make grpc dependency optional (#19447) 2026-01-20 19:03:52 -08:00
test_opentelemetry.py Litellm oss staging 030626 (#29578) 2026-06-03 11:01:51 -07:00
test_otel_guardrail_violation_spans.py feat: add guardrail violation span attributes and fix missing spans on pre-call blocks (#28364) 2026-05-21 15:49:42 -07:00
test_otel_team_attributes_matrix.py feat: propagate team_id and team_alias to all child OTEL spans (#28273) 2026-05-19 15:31:25 -07:00
test_prometheus_api_promql_escape.py fix(prometheus): quote api_key for PromQL string literal in spend lookup 2026-05-01 21:38:19 +00:00
test_prometheus_cache_metrics.py Litellm OSS Staging 010626 (#29422) 2026-06-01 21:42:51 -07:00
test_prometheus_client_ip_user_agent.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_custom_metadata_label_counts.py Fix Prometheus remaining metric zero values (#27348) 2026-05-06 17:22:20 -07:00
test_prometheus_end_user_cardinality.py perf: cap Prometheus end-user metric cardinality with TTL + LRU eviction (#27272) 2026-05-06 13:35:13 -07:00
test_prometheus_invalid_key_filtering.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_labels.py feat: standardize rate limit errors with category, rate_limit_type, model, and llm_provider fields (#27687) 2026-06-06 17:50:29 -07:00
test_prometheus_metric_name_consistency.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_missing_metrics.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_none_metadata.py fix: guard against None metadata in prometheus metrics (#21489) 2026-02-18 12:40:45 -08:00
test_prometheus_queue_guardrail_metrics.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_rate_limit_labels.py feat: standardize rate limit errors with category, rate_limit_type, model, and llm_provider fields (#27687) 2026-06-06 17:50:29 -07:00
test_prometheus_remaining_tokens_router_fallback.py fix(prometheus): emit litellm_remaining_tokens_metric for Bedrock and Vertex (#27705) 2026-05-13 17:40:59 -07:00
test_prometheus_services.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_spend_logs_metadata.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_stream_label.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prometheus_token_detail_metrics.py feat(prometheus): emit per-token-type detail metrics (LIT-3220) (#28372) (#28378) 2026-05-23 12:17:42 -07:00
test_prometheus_user_team_metrics.py feat: standardize rate limit errors with category, rate_limit_type, model, and llm_provider fields (#27687) 2026-06-06 17:50:29 -07:00
test_prompt_manager_ssti.py fix(security): sandbox jinja2 in gitlab/arize/bitbucket prompt managers 2026-05-02 09:14:02 +00:00
test_responses_background_cost.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_rubrik.py Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
test_s3_v2.py decouple S3 audit-log config via s3_audit_callback_params 2026-05-05 13:23:32 -07:00
test_weave_otel.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00