* Add LiteLLM Managed file support for `retrieve`, `list` and `cancel` finetuning jobs (#11033) * feat: initial commit adding managed file support to fine tuning endpoints * feat(fine_tuning/endpoints.py): working call to openai finetuning route Uses litellm managed files for finetuning api support * feat(fine-tuning/main.py): refactor to use LiteLLMFineTuningJob pydantic object includes 'hidden_params' * fix: initial commit adding unified finetuning id support return a unified finetuning id we can use to understand which deployment to route the ft request to * test: fix test * feat(managed_files.py): return unified finetuning job id on create finetuning job enables retrieve, delete to work with litellm managed files * feat(managed_files.py): support managed files for cancel ft job endpoint * feat(managed_files.py): support managed files for cancel ft job endpoint * feat(fine_tuning_endpoints/endpoints.py): add managed files support to list finetuning jobs * feat(finetuning_endpoints/main): add managed files support for retrieving ft job Makes it easier to control permissions for ft endpoint * LiteLLM Managed Files - Enforce validation check if user can access finetuning job (#11034) * feat: initial commit adding managed file support to fine tuning endpoints * feat(fine_tuning/endpoints.py): working call to openai finetuning route Uses litellm managed files for finetuning api support * feat(fine-tuning/main.py): refactor to use LiteLLMFineTuningJob pydantic object includes 'hidden_params' * fix: initial commit adding unified finetuning id support return a unified finetuning id we can use to understand which deployment to route the ft request to * test: fix test * feat(managed_files.py): return unified finetuning job id on create finetuning job enables retrieve, delete to work with litellm managed files * feat(managed_files.py): support managed files for cancel ft job endpoint * feat(managed_files.py): support managed files for cancel ft job endpoint * feat(fine_tuning_endpoints/endpoints.py): add managed files support to list finetuning jobs * feat(finetuning_endpoints/main): add managed files support for retrieving ft job Makes it easier to control permissions for ft endpoint * feat(managed_files.py): store create fine-tune / batch response object in db storing this allows us to filter files returned on list based on what user created * feat(managed_files.py): Ensures users can't retrieve / modify each others jobs * fix: fix check * fix: fix ruff check errors * test: update to handle testing * fix: suppress linting warning - openai 'seed' is none on azure * test: update tests * test: update test
29 lines
746 B
Python
29 lines
746 B
Python
from typing import Dict, Literal, Type, Union
|
|
|
|
from litellm.integrations.custom_logger import CustomLogger
|
|
|
|
from .managed_files import _PROXY_LiteLLMManagedFiles
|
|
|
|
ENTERPRISE_PROXY_HOOKS: Dict[str, Type[CustomLogger]] = {
|
|
"managed_files": _PROXY_LiteLLMManagedFiles,
|
|
}
|
|
|
|
|
|
def get_enterprise_proxy_hook(
|
|
hook_name: Union[
|
|
Literal[
|
|
"managed_files",
|
|
"max_parallel_requests",
|
|
],
|
|
str,
|
|
]
|
|
):
|
|
"""
|
|
Factory method to get a enterprise hook instance by name
|
|
"""
|
|
if hook_name not in ENTERPRISE_PROXY_HOOKS:
|
|
raise ValueError(
|
|
f"Unknown hook: {hook_name}. Available hooks: {list(ENTERPRISE_PROXY_HOOKS.keys())}"
|
|
)
|
|
return ENTERPRISE_PROXY_HOOKS[hook_name]
|