From de59691c4beeee153f77a78dcff18c6f19778f51 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Sat, 15 Feb 2025 15:48:32 -0800 Subject: [PATCH 1/3] Enable update/delete org members on UI (#8560) * feat(organization_endpoints.py): expose new `/organization/delete` endpoint. Cascade org deletion to member, teams and keys Ensures any org deletion is handled correctly * test(test_organizations.py): add simple test to ensure org deletion works * feat(organization_endpoints.py): expose /organization/update endpoint, and define response models for org delete + update * fix(organizations.tsx): support org delete on UI + move org/delete endpoint to use DELETE * feat(organization_endpoints.py): support `/organization/member_update` endpoint Allow admin to update member's role within org * feat(organization_endpoints.py): support deleting member from org * test(test_organizations.py): add e2e test to ensure org member flow works * fix(organization_endpoints.py): fix code qa check * fix(schema.prisma): don't introduce ondelete:cascade - breaking change * docs(organization_endpoints.py): document missing params From 6b78ade91883daadb7d0a3fd912ed5dfe07d2939 Mon Sep 17 00:00:00 2001 From: drorbaron Date: Tue, 19 Aug 2025 12:20:19 +0300 Subject: [PATCH 2/3] migrate to use new aim FW API --- litellm/proxy/guardrails/guardrail_hooks/aim/aim.py | 9 ++++++--- tests/local_testing/test_aim_guardrails.py | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py b/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py index 621defa2d4c..e40bafcc463 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py +++ b/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py @@ -118,7 +118,7 @@ class AimGuardrail(CustomGuardrail): litellm_call_id=call_id, ) response = await self.async_handler.post( - f"{self.api_base}/detect/openai/v2", + f"{self.api_base}/fw/v1/analyze", headers=headers, json={"messages": data.get("messages", [])}, ) @@ -183,14 +183,17 @@ class AimGuardrail(CustomGuardrail): ) call_id = request_data.get("litellm_call_id") response = await self.async_handler.post( - f"{self.api_base}/detect/output/v2", + f"{self.api_base}/fw/v1/analyze", headers=self._build_aim_headers( hook=hook, key_alias=key_alias, user_email=user_email, litellm_call_id=call_id, ), - json={"output": output, "messages": request_data.get("messages", [])}, + json={ + "messages": request_data.get("messages", []) + + [{"role": "assistant", "content": output}] + }, ) response.raise_for_status() res = response.json() diff --git a/tests/local_testing/test_aim_guardrails.py b/tests/local_testing/test_aim_guardrails.py index b11a424ac3b..3a9b6e9a3d1 100644 --- a/tests/local_testing/test_aim_guardrails.py +++ b/tests/local_testing/test_aim_guardrails.py @@ -216,12 +216,13 @@ async def test_post_call__with_anonymized_entities__it_deanonymizes_output(): ) as mock_post: def mock_post_detect_side_effect(url, *args, **kwargs): - if url.endswith("/detect/openai/v2"): + request_body = kwargs.get("json", {}) + if request_body["messages"][-1]["role"] == "user": return response_with_detections - elif url.endswith("/detect/output/v2"): + elif request_body["messages"][-1]["role"] == "assistant": return response_without_detections else: - raise ValueError("Unexpected URL: {}".format(url)) + raise ValueError("Unexpected request: {}".format(request_body)) mock_post.side_effect = mock_post_detect_side_effect From 7fedcf1ea96fc7852c4c43487c38427b0b6ea836 Mon Sep 17 00:00:00 2001 From: drorbaron Date: Tue, 19 Aug 2025 12:36:29 +0300 Subject: [PATCH 3/3] migrate stream ws --- litellm/proxy/guardrails/guardrail_hooks/aim/aim.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py b/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py index e40bafcc463..3c03d70cef8 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py +++ b/litellm/proxy/guardrails/guardrail_hooks/aim/aim.py @@ -300,7 +300,7 @@ class AimGuardrail(CustomGuardrail): ) call_id = request_data.get("litellm_call_id") async with connect( - f"{self.ws_api_base}/detect/output/ws", + f"{self.ws_api_base}/fw/v1/analyze/stream", additional_headers=self._build_aim_headers( hook="output", key_alias=user_api_key_dict.key_alias,