litellm/litellm/integrations
Tuhin Subhra Patra 9b78dc78c2
fix(proxy): invoke post-call guardrails on pass-through endpoint responses (#20270) (#26262)
* fix(proxy): invoke post-call guardrails on pass-through endpoint responses (#20270)

Wire post_call_success_hook into non-streaming pass-through response path,
gated on explicit guardrail config (opt-in only, no backwards-compat break).

- Call post_call_success_hook after reading non-streaming response body
- Build enriched hook_data with guardrails metadata and litellm_logging_obj
  at call site (avoids mutation of _parsed_body which is shared by logging)
- Handle ModifyResponseException with provider-agnostic error envelope,
  post_call_failure_hook, and defensive try/except
- Strip stale content-length when guardrail modifies response body
- Move ModifyResponseException to litellm.exceptions to break cyclic import;
  re-export from custom_guardrail for backwards compat
- Add call_type fallback in UnifiedLLMGuardrails for pass-through endpoints
  using CallTypes.pass_through.value enum

* test: add unit tests for pass-through post-call guardrails

5 tests covering the post-call guardrail invocation on pass-through endpoints:
- post_call_success_hook fires when guardrails configured
- post_call_success_hook skipped when no guardrails (backwards compat)
- ModifyResponseException returns 200 with provider-agnostic error
- UnifiedLLMGuardrails resolves call_type from logging_obj for pass-through
- ModifyResponseException re-export from custom_guardrail stays in sync
2026-04-27 08:58:22 +05:30
..
_types style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
agentops style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
arize style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
azure_sentinel style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
azure_storage style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
bitbucket [Fix] CI/CD - mypy & check_code_and_doc_quality & mcp_testing (#17920) 2025-12-13 08:18:43 -08:00
cloudzero style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
compression_interception Prompt Compression - add it to the proxy (#25729) 2026-04-20 15:08:00 -07:00
datadog style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
deepeval fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
dotprompt fix(proxy): improve input validation on management endpoints 2026-04-09 14:14:53 -07:00
email_templates style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
focus [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
gcs_bucket style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
gcs_pubsub Fix gcs pub sub logging with env var GCS_PROJECT_ID (#10042) 2025-04-15 21:50:48 -07:00
generic_api Add Ramp as a built-in generic API callback with docs (#23769) 2026-04-08 20:06:48 -07:00
generic_prompt_management style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
gitlab style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
langfuse style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
levo docs: remove docs/my-website, point contributors to litellm-docs 2026-04-24 14:17:46 -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
opentelemetry_utils [Feat] s3 logger, add support for ssl_verify when using minio logger (#16211) 2025-11-03 13:56:00 -08:00
opik style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
prometheus_helpers [Fix] Apply black formatting to fix CI lint failures 2026-04-20 15:53:12 -07:00
SlackAlerting style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vantage style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vector_store_integrations style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
weave style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
websearch_interception [Fix] Apply black formatting to fix CI lint failures 2026-04-20 15:53:12 -07:00
__init__.py
additional_logging_utils.py (Feat) - Allow viewing Request/Response Logs stored in GCS Bucket (#8449) 2025-02-10 20:38:55 -08:00
anthropic_cache_control_hook.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
argilla.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
athina.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
braintrust_logging.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
braintrust_mock_client.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
callback_configs.json feat: ability to trace metrics 2026-02-25 22:03:51 +05:30
custom_batch_logger.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
custom_guardrail.py fix(proxy): invoke post-call guardrails on pass-through endpoint responses (#20270) (#26262) 2026-04-27 08:58:22 +05:30
custom_logger.py Litellm krrish staging 04 20 2026 (#26138) 2026-04-20 16:22:12 -07:00
custom_prompt_management.py [Fix] CI/CD - mypy & check_code_and_doc_quality & mcp_testing (#17920) 2025-12-13 08:18:43 -08:00
custom_secret_manager.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
custom_sso_handler.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
dynamodb.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
email_alerting.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
galileo.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
greenscale.py LITELLM: Remove requests library usage (#7235) 2024-12-17 12:50:04 -08:00
helicone.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
helicone_mock_client.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
humanloop.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
lago.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
langsmith.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
langsmith_mock_client.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
langtrace.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
literal_ai.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
logfire_logger.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
lunary.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
mlflow.py Fix: MLflow streaming spans for Anthropic passthrough (#17288) 2025-12-05 14:59:36 -08:00
mock_client_factory.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
openmeter.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
opentelemetry.py April 21st Ishaan Branch (#26213) 2026-04-21 20:18:56 -07:00
posthog.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
posthog_mock_client.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
prometheus.py [Fix] Apply black formatting to fix CI lint failures 2026-04-20 15:53:12 -07:00
prometheus_services.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
prompt_layer.py LITELLM: Remove requests library usage (#7235) 2024-12-17 12:50:04 -08:00
prompt_management_base.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
Readme.md (Feat) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery (#7976) 2025-01-24 20:57:20 -08:00
s3.py Add allowing Key based prefix to s3 path (#16237) 2025-11-05 14:43:21 -08:00
s3_v2.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
sqs.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
supabase.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
test_httpx.py fix(utils.py): improved predibase exception mapping 2024-06-08 14:32:43 -07:00
traceloop.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
weights_biases.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00

Integrations

This folder contains logging integrations for litellm

eg. logging to Datadog, Langfuse, Prometheus, s3, GCS Bucket, etc.