Litellm dev 01 13 2025 p2 (#7758)
All checks were successful
Read Version from pyproject.toml / read-version (push) Successful in 12s

* fix(factory.py): fix bedrock document url check

Make check more generic - if starts with 'text' or 'application' assume it's a document and let it go through

 Fixes https://github.com/BerriAI/litellm/issues/7746

* feat(key_management_endpoints.py): support writing new key alias to aws secret manager - on key rotation

adds rotation endpoint to aws key management hook - allows for rotated litellm virtual keys with new key alias to be written to it

* feat(key_management_event_hooks.py): support rotating keys and updating secret manager

* refactor(base_secret_manager.py): support rotate secret at the base level

since it's just an abstraction function, it's easy to implement at the base manager level

* style: cleanup unused imports
This commit is contained in:
Krish Dholakia 2025-01-14 17:04:01 -08:00 committed by GitHub
parent 7b27cfb0ae
commit 35919d9fec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 209 additions and 54 deletions

View file

@ -523,6 +523,8 @@ async def generate_key_fn( # noqa: PLR0915
data.soft_budget
) # include the user-input soft budget in the response
response = GenerateKeyResponse(**response)
asyncio.create_task(
KeyManagementEventHooks.async_key_generated_hook(
data=data,
@ -532,7 +534,7 @@ async def generate_key_fn( # noqa: PLR0915
)
)
return GenerateKeyResponse(**response)
return response
except Exception as e:
verbose_proxy_logger.exception(
"litellm.proxy.proxy_server.generate_key_fn(): Exception occured - {}".format(
@ -1517,7 +1519,7 @@ async def regenerate_key_fn(
updated_token_dict = dict(updated_token)
updated_token_dict["key"] = new_token
updated_token_dict.pop("token")
updated_token_dict["token_id"] = updated_token_dict.pop("token")
### 3. remove existing key entry from cache
######################################################################
@ -1535,9 +1537,21 @@ async def regenerate_key_fn(
proxy_logging_obj=proxy_logging_obj,
)
return GenerateKeyResponse(
response = GenerateKeyResponse(
**updated_token_dict,
)
asyncio.create_task(
KeyManagementEventHooks.async_key_rotated_hook(
data=data,
existing_key_row=_key_in_db,
response=response,
user_api_key_dict=user_api_key_dict,
litellm_changed_by=litellm_changed_by,
)
)
return response
except Exception as e:
raise handle_exception_on_proxy(e)