1
1
#!/usr/bin/env python
2
- # Copyright (c) 2024 Oracle and/or its affiliates.
2
+ # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
3
3
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4
4
5
5
10
10
from ads .aqua .common .decorator import handle_exceptions
11
11
from ads .aqua .extension .base_handler import AquaAPIhandler
12
12
from ads .aqua .extension .errors import Errors
13
- from ads .aqua .extension .utils import validate_function_parameters
14
13
from ads .aqua .finetuning import AquaFineTuningApp
15
14
from ads .aqua .finetuning .entities import CreateFineTuningDetails
16
15
@@ -33,7 +32,7 @@ def get(self, id=""):
33
32
raise HTTPError (400 , f"The request { self .request .path } is invalid." )
34
33
35
34
@handle_exceptions
36
- def post (self , * args , ** kwargs ):
35
+ def post (self , * args , ** kwargs ): # noqa: ARG002
37
36
"""Handles post request for the fine-tuning API
38
37
39
38
Raises
@@ -43,16 +42,12 @@ def post(self, *args, **kwargs):
43
42
"""
44
43
try :
45
44
input_data = self .get_json_body ()
46
- except Exception :
47
- raise HTTPError (400 , Errors .INVALID_INPUT_DATA_FORMAT )
45
+ except Exception as ex :
46
+ raise HTTPError (400 , Errors .INVALID_INPUT_DATA_FORMAT ) from ex
48
47
49
48
if not input_data :
50
49
raise HTTPError (400 , Errors .NO_INPUT_DATA )
51
50
52
- validate_function_parameters (
53
- data_class = CreateFineTuningDetails , input_data = input_data
54
- )
55
-
56
51
self .finish (AquaFineTuningApp ().create (CreateFineTuningDetails (** input_data )))
57
52
58
53
def get_finetuning_config (self , model_id ):
@@ -71,7 +66,7 @@ def get(self, model_id):
71
66
)
72
67
73
68
@handle_exceptions
74
- def post (self , * args , ** kwargs ):
69
+ def post (self , * args , ** kwargs ): # noqa: ARG002
75
70
"""Handles post request for the finetuning param handler API.
76
71
77
72
Raises
@@ -81,8 +76,8 @@ def post(self, *args, **kwargs):
81
76
"""
82
77
try :
83
78
input_data = self .get_json_body ()
84
- except Exception :
85
- raise HTTPError (400 , Errors .INVALID_INPUT_DATA_FORMAT )
79
+ except Exception as ex :
80
+ raise HTTPError (400 , Errors .INVALID_INPUT_DATA_FORMAT ) from ex
86
81
87
82
if not input_data :
88
83
raise HTTPError (400 , Errors .NO_INPUT_DATA )
0 commit comments