diff --git a/docs/my-website/docs/providers/azure/azure.md b/docs/my-website/docs/providers/azure/azure.md index 8471ca9406..1feec52b3e 100644 --- a/docs/my-website/docs/providers/azure/azure.md +++ b/docs/my-website/docs/providers/azure/azure.md @@ -931,7 +931,7 @@ curl http://localhost:4000/v1/batches \ ```python retrieved_batch = client.batches.retrieve( batch.id, - extra_body={"custom_llm_provider": "azure"} + extra_query={"custom_llm_provider": "azure"} ) ``` @@ -978,7 +978,7 @@ curl http://localhost:4000/v1/batches/batch_abc123/cancel \ ```python -client.batches.list(extra_body={"custom_llm_provider": "azure"}) +client.batches.list(extra_query={"custom_llm_provider": "azure"}) ``` diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py index f8e3a9109b..4f1c4dae08 100644 --- a/litellm/proxy/batches_endpoints/endpoints.py +++ b/litellm/proxy/batches_endpoints/endpoints.py @@ -17,7 +17,7 @@ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing from litellm.proxy.common_utils.http_parsing_utils import _read_request_body from litellm.proxy.common_utils.openai_endpoint_utils import ( - get_custom_llm_provider_from_request_body, + get_custom_llm_provider_from_request_query, ) from litellm.proxy.openai_files_endpoints.common_utils import ( _is_base64_encoded_unified_file_id, @@ -282,7 +282,7 @@ async def retrieve_batch( else: custom_llm_provider = ( provider - or await get_custom_llm_provider_from_request_body(request=request) + or get_custom_llm_provider_from_request_query(request=request) or "openai" ) response = await litellm.aretrieve_batch( @@ -392,7 +392,7 @@ async def list_batches( else: custom_llm_provider = ( provider - or await get_custom_llm_provider_from_request_body(request=request) + or get_custom_llm_provider_from_request_query(request=request) or "openai" ) response = await litellm.alist_batches( diff --git a/litellm/proxy/common_utils/openai_endpoint_utils.py b/litellm/proxy/common_utils/openai_endpoint_utils.py index 214a34d4d7..a18ccd0b0c 100644 --- a/litellm/proxy/common_utils/openai_endpoint_utils.py +++ b/litellm/proxy/common_utils/openai_endpoint_utils.py @@ -38,3 +38,14 @@ async def get_custom_llm_provider_from_request_body(request: Request) -> Optiona if "custom_llm_provider" in request_body: return request_body["custom_llm_provider"] return None + + +def get_custom_llm_provider_from_request_query(request: Request) -> Optional[str]: + """ + Get the `custom_llm_provider` from the request query parameters + + Safely reads the request query parameters + """ + if "custom_llm_provider" in request.query_params: + return request.query_params["custom_llm_provider"] + return None