11#!/usr/bin/env python
2- # Copyright (c) 2024 Oracle and/or its affiliates.
2+ # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
33# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
44
55
1010from ads .aqua .common .decorator import handle_exceptions
1111from ads .aqua .extension .base_handler import AquaAPIhandler
1212from ads .aqua .extension .errors import Errors
13- from ads .aqua .extension .utils import validate_function_parameters
1413from ads .aqua .finetuning import AquaFineTuningApp
1514from ads .aqua .finetuning .entities import CreateFineTuningDetails
1615
@@ -33,7 +32,7 @@ def get(self, id=""):
3332 raise HTTPError (400 , f"The request { self .request .path } is invalid." )
3433
3534 @handle_exceptions
36- def post (self , * args , ** kwargs ):
35+ def post (self , * args , ** kwargs ): # noqa: ARG002
3736 """Handles post request for the fine-tuning API
3837
3938 Raises
@@ -43,16 +42,12 @@ def post(self, *args, **kwargs):
4342 """
4443 try :
4544 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
4847
4948 if not input_data :
5049 raise HTTPError (400 , Errors .NO_INPUT_DATA )
5150
52- validate_function_parameters (
53- data_class = CreateFineTuningDetails , input_data = input_data
54- )
55-
5651 self .finish (AquaFineTuningApp ().create (CreateFineTuningDetails (** input_data )))
5752
5853 def get_finetuning_config (self , model_id ):
@@ -71,7 +66,7 @@ def get(self, model_id):
7166 )
7267
7368 @handle_exceptions
74- def post (self , * args , ** kwargs ):
69+ def post (self , * args , ** kwargs ): # noqa: ARG002
7570 """Handles post request for the finetuning param handler API.
7671
7772 Raises
@@ -81,8 +76,8 @@ def post(self, *args, **kwargs):
8176 """
8277 try :
8378 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
8681
8782 if not input_data :
8883 raise HTTPError (400 , Errors .NO_INPUT_DATA )
0 commit comments