(feat) /batches Add support for using /batches endpoints in OAI format (#7402)

* run azure testing on ci/cd

* update docs on azure batches endpoints

* add input azure.jsonl

* refactor - use separate file for batches endpoints

* fixes for passing custom llm provider to /batch endpoints

* pass custom llm provider to files endpoints

* update azure batches doc

* add info for azure batches api

* update batches endpoints

* use simple helper for raising proxy exception

* update config.yml

* fix imports

* update tests

* use existing settings

* update env var used

* update configs

* update config.yml

* update ft testing
This commit is contained in:
Ishaan Jaff 2024-12-24 16:58:05 -08:00 committed by GitHub
parent 34d8386926
commit 0627450808
17 changed files with 718 additions and 464 deletions

View file

@ -2,6 +2,12 @@
Contains utils used by OpenAI compatible endpoints
"""
from typing import Optional
from fastapi import Request
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
def remove_sensitive_info_from_deployment(deployment_dict: dict) -> dict:
"""
@ -19,3 +25,15 @@ def remove_sensitive_info_from_deployment(deployment_dict: dict) -> dict:
deployment_dict["litellm_params"].pop("aws_secret_access_key", None)
return deployment_dict
async def get_custom_llm_provider_from_request_body(request: Request) -> Optional[str]:
"""
Get the `custom_llm_provider` from the request body
Safely reads the request body
"""
request_body: dict = await _read_request_body(request=request) or {}
if "custom_llm_provider" in request_body:
return request_body["custom_llm_provider"]
return None