@@ -1470,7 +1470,9 @@ def _download_file_description_artifact(self) -> Tuple[Union[str, List[str]], in
14701470
14711471 def add_artifact (
14721472 self ,
1473- uri : str ,
1473+ namespace : str ,
1474+ bucket : str ,
1475+ prefix : Optional [str ] = None ,
14741476 files : Optional [List [str ]] = None ,
14751477 ):
14761478 """
@@ -1496,11 +1498,11 @@ def add_artifact(
14961498 If `files` is provided, it only retrieves information about objects with matching file names.
14971499 - If no objects are found to add to the model description, a ValueError is raised.
14981500 """
1499- object_storage_details = ObjectStorageDetails .from_path (uri )
1500- bucket = object_storage_details .bucket
1501- namespace = object_storage_details .namespace
1502- prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
15031501
1502+ # Check if both prefix and files are provided
1503+ if prefix is not None and files is not None :
1504+ raise ValueError ("Both 'prefix' and 'files' cannot be provided. Please provide only one." )
1505+
15041506 if self .model_file_description == None :
15051507 self .empty_json = {
15061508 "version" : "1.0" ,
@@ -1513,7 +1515,7 @@ def add_artifact(
15131515 self .object_storage_client = oc .OCIClientFactory (** (self .dsc_model .auth )).object_storage
15141516
15151517 # Remove if the model already exists
1516- self .remove_artifact (uri = uri )
1518+ self .remove_artifact (namespace = namespace , bucket = bucket , prefix = prefix )
15171519
15181520 def check_if_file_exists (fileName ):
15191521 isExists = False
@@ -1588,7 +1590,7 @@ def list_obj_versions_unpaginated():
15881590 )
15891591 self .set_spec (self .CONST_MODEL_FILE_DESCRIPTION , tmp_model_file_description )
15901592
1591- def remove_artifact (self , uri : str ):
1593+ def remove_artifact (self , namespace : str , bucket : str , prefix : Optional [ str ] = None ):
15921594 """
15931595 Removes information about objects in a specified bucket from the model description JSON.
15941596
@@ -1604,10 +1606,6 @@ def remove_artifact(self, uri: str):
16041606 ------
16051607 ValueError: If the model description JSON is None.
16061608 """
1607- object_storage_details = ObjectStorageDetails .from_path (uri )
1608- bucket = object_storage_details .bucket
1609- namespace = object_storage_details .namespace
1610- prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
16111609
16121610 def findModelIdx ():
16131611 for idx , model in enumerate (self .model_file_description ["models" ]):
0 commit comments