mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix pre call utils on embedding
This commit is contained in:
parent
01f36797ae
commit
3dfeee03d0
1 changed files with 11 additions and 3 deletions
|
@ -43,6 +43,16 @@ def _get_metadata_variable_name(request: Request) -> str:
|
|||
return "metadata"
|
||||
|
||||
|
||||
def safe_add_api_version_from_query_params(data: dict, request: Request):
|
||||
try:
|
||||
if hasattr(request, "query_params"):
|
||||
query_params = dict(request.query_params)
|
||||
if "api-version" in query_params:
|
||||
data["api_version"] = query_params["api-version"]
|
||||
except Exception as e:
|
||||
verbose_logger.error("error checking api version in query params: %s", str(e))
|
||||
|
||||
|
||||
async def add_litellm_data_to_request(
|
||||
data: dict,
|
||||
request: Request,
|
||||
|
@ -67,9 +77,7 @@ async def add_litellm_data_to_request(
|
|||
"""
|
||||
from litellm.proxy.proxy_server import premium_user
|
||||
|
||||
query_params = dict(request.query_params)
|
||||
if "api-version" in query_params:
|
||||
data["api_version"] = query_params["api-version"]
|
||||
safe_add_api_version_from_query_params(data, request)
|
||||
|
||||
# Include original request and headers in the data
|
||||
data["proxy_server_request"] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue