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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
use jsonify_team_object for updating teams
Ishaan Jaff09403e209752
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.pyindex 399e87b145f..57399a62c88 100644--- a/litellm/proxy/utils.py+++ b/litellm/proxy/utils.py@@ -32,7 +32,13 @@ from fastapi import HTTPException, statusimport litellmimport litellm.litellm_core_utilsimport litellm.litellm_core_utils.litellm_logging-from litellm import EmbeddingResponse, ImageResponse, ModelResponse, Router, ModelResponseStream+from litellm import (+ EmbeddingResponse,+ ImageResponse,+ ModelResponse,+ ModelResponseStream,+ Router,+)from litellm._logging import verbose_proxy_loggerfrom litellm._service_logger import ServiceLogging, ServiceTypesfrom litellm.caching.caching import DualCache, RedisCache@@ -1009,19 +1015,24 @@ class ProxyLogging:for callback in litellm.callbacks:_callback: Optional[CustomLogger] = Noneif isinstance(callback, str):- _callback = litellm.litellm_core_utils.litellm_logging.get_custom_logger_compatible_class(callback)+ _callback = litellm.litellm_core_utils.litellm_logging.get_custom_logger_compatible_class(+ callback+ )else:_callback = callback # type: ignoreif _callback is not None and isinstance(_callback, CustomLogger):- if not isinstance(_callback, CustomGuardrail) or _callback.should_run_guardrail(- data=request_data, event_type=GuardrailEventHooks.post_call+ if not isinstance(+ _callback, CustomGuardrail+ ) or _callback.should_run_guardrail(+ data=request_data, event_type=GuardrailEventHooks.post_call):response = _callback.async_post_call_streaming_iterator_hook(- user_api_key_dict=user_api_key_dict, response=response, request_data=request_data+ user_api_key_dict=user_api_key_dict,+ response=response,+ request_data=request_data,)return response-async def post_call_streaming_hook(self,response: str,@@ -1733,13 +1744,7 @@ class PrismaClient:verbose_proxy_logger.info("Data Inserted into User Table")return new_user_rowelif table_name == "team":- db_data = self.jsonify_object(data=data)- if db_data.get("members_with_roles", None) is not None and isinstance(- db_data["members_with_roles"], list- ):- db_data["members_with_roles"] = json.dumps(- db_data["members_with_roles"]- )+ db_data = self.jsonify_team_object(db_data=data)new_team_row = await self.db.litellm_teamtable.upsert(where={"team_id": data["team_id"]},data={@@ -2010,8 +2015,8 @@ class PrismaClient:batcher = self.db.batch_()for idx, team in enumerate(data_list):try:- data_json = self.jsonify_object(- data=team.model_dump(exclude_none=True)+ data_json = self.jsonify_team_object(+ db_data=team.model_dump(exclude_none=True))except Exception:data_json = self.jsonify_object(