Skip to content

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]

Ensure detector-id is passed as header to IBM detector server (#16649)

Rob Geadad35d9008c961
diff --git a/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py b/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py
index 72e0b3f013c..c61ef3334cb 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py
@@ -127,13 +127,9 @@ class IBMGuardrailDetector(CustomGuardrail):
headers = {
"Authorization": f"Bearer {self.auth_token}",
"content-type": "application/json",
+ "detector-id": self.detector_id,
}
- query_params = {"detector_id": self.detector_id}
-
- # update the api_url with the query params
- self.api_url = f"{self.api_url}?{urlencode(query_params)}"
-
verbose_proxy_logger.debug(
"IBM Detector Server request to %s with payload: %s",
self.api_url,
diff --git a/scripts/mock_ibm_guardrails_server.py b/scripts/mock_ibm_guardrails_server.py
index 9850b62747d..a9251c14cef 100644
--- a/scripts/mock_ibm_guardrails_server.py
+++ b/scripts/mock_ibm_guardrails_server.py
@@ -234,8 +234,8 @@ async def root():
@app.post("/api/v1/text/contents")
async def text_detection(
- detector_id: str, # query parameter
request: TextDetectionRequest,
+ detector_id: str = Header(None), # query parameter
authorization: Optional[str] = Header(None),
):
"""
@@ -243,6 +243,7 @@ async def text_detection(
Args:
request: Detection request with content and detector ID
+ detector_id: ID of detector
authorization: Bearer token for authentication
Returns: