@@ -1470,8 +1470,9 @@ def _download_file_description_artifact(self) -> Tuple[Union[str, List[str]], in
14701470
14711471 def add_artifact (
14721472 self ,
1473- namespace : str ,
1474- bucket : str ,
1473+ uri : Optional [str ] = None ,
1474+ namespace : Optional [str ] = None ,
1475+ bucket : Optional [str ] = None ,
14751476 prefix : Optional [str ] = None ,
14761477 files : Optional [List [str ]] = None ,
14771478 ):
@@ -1499,6 +1500,16 @@ def add_artifact(
14991500 - If no objects are found to add to the model description, a ValueError is raised.
15001501 """
15011502
1503+ if uri and (namespace or bucket ):
1504+ raise ValueError ("Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided." )
1505+ if uri :
1506+ object_storage_details = ObjectStorageDetails .from_path (uri )
1507+ bucket = object_storage_details .bucket
1508+ namespace = object_storage_details .namespace
1509+ prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
1510+ if ((not namespace ) or (not bucket )):
1511+ raise ValueError ("Both 'namespace' and 'bucket' must be provided." )
1512+
15021513 # Check if both prefix and files are provided
15031514 if prefix is not None and files is not None :
15041515 raise ValueError ("Both 'prefix' and 'files' cannot be provided. Please provide only one." )
@@ -1590,7 +1601,13 @@ def list_obj_versions_unpaginated():
15901601 )
15911602 self .set_spec (self .CONST_MODEL_FILE_DESCRIPTION , tmp_model_file_description )
15921603
1593- def remove_artifact (self , namespace : str , bucket : str , prefix : Optional [str ] = None ):
1604+ def remove_artifact (
1605+ self ,
1606+ uri : Optional [str ] = None ,
1607+ namespace : Optional [str ] = None ,
1608+ bucket : Optional [str ] = None ,
1609+ prefix : Optional [str ] = None
1610+ ):
15941611 """
15951612 Removes information about objects in a specified bucket from the model description JSON.
15961613
@@ -1607,6 +1624,16 @@ def remove_artifact(self, namespace: str, bucket: str, prefix: Optional[str] = N
16071624 ValueError: If the model description JSON is None.
16081625 """
16091626
1627+ if uri and (namespace or bucket ):
1628+ raise ValueError ("Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided." )
1629+ if uri :
1630+ object_storage_details = ObjectStorageDetails .from_path (uri )
1631+ bucket = object_storage_details .bucket
1632+ namespace = object_storage_details .namespace
1633+ prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
1634+ if ((not namespace ) or (not bucket )):
1635+ raise ValueError ("Both 'namespace' and 'bucket' must be provided." )
1636+
16101637 def findModelIdx ():
16111638 for idx , model in enumerate (self .model_file_description ["models" ]):
16121639 if (
0 commit comments