litellm/llms/pass_through/guardrail_translation/README.md
This module is located under litellm/llms/ (instead of with the main passthrough code) because:
load_guardrail_translation_mappings() function in litellm/llms/__init__.py scans for guardrail_translation/ directories under litellm/llms/openai/chat/guardrail_translation/, anthropic/chat/guardrail_translation/)The main passthrough endpoint implementation is in:
litellm/proxy/pass_through_endpoints/
├── pass_through_endpoints.py # Core passthrough routing logic
├── passthrough_guardrails.py # Guardrail collection and field targeting
├── jsonpath_extractor.py # JSONPath field extraction utility
└── ...
The PassThroughEndpointHandler enables guardrails to run on passthrough endpoint requests by:
request_fields / response_fieldsget_passthrough_guardrails_config() / set_passthrough_guardrails_config() helpers to access the passthrough guardrails configuration stored in request metadatapassthrough_endpoints:
- path: "/v1/rerank"
target: "https://api.cohere.com/v1/rerank"
guardrails:
bedrock-pre-guard:
request_fields: ["query", "documents[*].text"]
response_fields: ["results[*].text"]