mirror of
https://github.com/BerriAI/litellm.git
synced 2025-12-06 11:33:26 +08:00
Ensure detector-id is passed as header to IBM detector server (#16649)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user