diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py index 9417731cd..3a1c456aa 100644 --- a/litellm/proxy/litellm_pre_call_utils.py +++ b/litellm/proxy/litellm_pre_call_utils.py @@ -33,11 +33,11 @@ def _get_metadata_variable_name(request: Request) -> str: """ Helper to return what the "metadata" field should be called in the request data - For all /thread endpoints we need to call this "litellm_metadata" + For all /thread or /assistant endpoints we need to call this "litellm_metadata" For ALL other endpoints we call this "metadata """ - if "thread" in request.url.path: + if "thread" in request.url.path or "assistant" in request.url.path: return "litellm_metadata" else: return "metadata" diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 34352bb8a..65a29e549 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -3975,10 +3975,10 @@ async def create_assistant( API Reference docs - https://platform.openai.com/docs/api-reference/assistants/createAssistant """ global proxy_logging_obj - data: Dict = {} try: # Use orjson to parse JSON data, orjson speeds up requests significantly body = await request.body() + data = orjson.loads(body) # Include original request and headers in the data data = await add_litellm_data_to_request(