mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(litellm_pre_call_utils.py): handle no query params in request
This commit is contained in:
parent
2d75e7a8d4
commit
2b4d692353
2 changed files with 8 additions and 4 deletions
|
@ -1275,6 +1275,8 @@ def _get_request_ip_address(
|
|||
client_ip = request.headers["x-forwarded-for"]
|
||||
elif request.client is not None:
|
||||
client_ip = request.client.host
|
||||
else:
|
||||
client_ip = ""
|
||||
|
||||
return client_ip
|
||||
|
||||
|
|
|
@ -171,10 +171,12 @@ async def add_litellm_data_to_request(
|
|||
}
|
||||
|
||||
## Dynamic api version (Azure OpenAI endpoints) ##
|
||||
try:
|
||||
query_params = request.query_params
|
||||
|
||||
# Convert query parameters to a dictionary (optional)
|
||||
query_dict = dict(query_params)
|
||||
except KeyError:
|
||||
query_dict = {}
|
||||
|
||||
## check for api version in query params
|
||||
dynamic_api_version: Optional[str] = query_dict.get("api-version")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue