33from .client import PlexeAI
44
55def build (goal : str ,
6+ model_name : str ,
67 data_files : Optional [Union [str , Path , List [Union [str , Path ]]]] = None ,
7- data_dir : Optional [str ] = None ,
8- api_key : str = "" ,
9- steps : int = 5 ,
8+ upload_id : Optional [str ] = None ,
9+ api_key : str = "" ,
1010 eval_criteria : Optional [str ] = None ) -> str :
1111 """Build a new ML model.
1212
1313 Args:
1414 goal: Description of what the model should do
15+ model_name: Name for the model
1516 data_files: Optional path(s) to data file(s) to upload
16- data_dir : Optional data directory ( if files already uploaded)
17+ upload_id : Optional upload_id if files were already uploaded
1718 api_key: API key for authentication
18- steps: Number of improvement iterations
1919 eval_criteria: Optional evaluation criteria
2020
2121 Returns:
22- experiment_id: ID of the created experiment
22+ model_version: Version ID of the created model
2323 """
2424 client = PlexeAI (api_key = api_key )
25- return client .build (goal = goal , data_files = data_files , data_dir = data_dir ,
26- steps = steps , eval_criteria = eval_criteria )
25+ return client .build (goal = goal , model_name = model_name ,
26+ data_files = data_files , upload_id = upload_id ,
27+ eval_criteria = eval_criteria )
2728
2829async def abuild (goal : str ,
30+ model_name : str ,
2931 data_files : Optional [Union [str , Path , List [Union [str , Path ]]]] = None ,
30- data_dir : Optional [str ] = None ,
31- api_key : str = "" ,
32- steps : int = 5 ,
32+ upload_id : Optional [str ] = None ,
33+ api_key : str = "" ,
3334 eval_criteria : Optional [str ] = None ) -> str :
3435 """Build a new ML model asynchronously."""
3536 client = PlexeAI (api_key = api_key )
36- return await client .abuild (goal = goal , data_files = data_files , data_dir = data_dir ,
37- steps = steps , eval_criteria = eval_criteria )
37+ return await client .abuild (goal = goal , model_name = model_name ,
38+ data_files = data_files , upload_id = upload_id ,
39+ eval_criteria = eval_criteria )
3840
39- def infer (experiment_id : str , input_data : dict , api_key : str = "" ) -> dict :
41+ def infer (model_name : str , model_version : str , input_data : dict , api_key : str = "" ) -> dict :
4042 """Run inference using a built model."""
4143 client = PlexeAI (api_key = api_key )
42- return client .infer (experiment_id = experiment_id , input_data = input_data )
44+ return client .infer (model_name = model_name , model_version = model_version , input_data = input_data )
4345
44- async def ainfer (experiment_id : str , input_data : dict , api_key : str = "" ) -> dict :
46+ async def ainfer (model_name : str , model_version : str , input_data : dict , api_key : str = "" ) -> dict :
4547 """Run inference using a model asynchronously."""
4648 client = PlexeAI (api_key = api_key )
47- return await client .ainfer (experiment_id = experiment_id , input_data = input_data )
49+ return await client .ainfer (model_name = model_name , model_version = model_version , input_data = input_data )
4850
49- def batch_infer (experiment_id : str , inputs : List [dict ], api_key : str = "" ) -> List [dict ]:
51+ def batch_infer (model_name : str , model_version : str , inputs : List [dict ], api_key : str = "" ) -> List [dict ]:
5052 """Run batch predictions."""
5153 client = PlexeAI (api_key = api_key )
52- return client .batch_infer (experiment_id = experiment_id , inputs = inputs )
54+ return client .batch_infer (model_name = model_name , model_version = model_version , inputs = inputs )
5355
54- def get_status (experiment_id : str , api_key : str = "" ) -> dict :
55- """Get status of an experiment build."""
56+ def get_status (model_name : str , model_version : str , api_key : str = "" ) -> dict :
57+ """Get status of a model build."""
5658 client = PlexeAI (api_key = api_key )
57- return client .get_status (experiment_id = experiment_id )
59+ return client .get_status (model_name = model_name , model_version = model_version )
5860
59- async def aget_status (experiment_id : str , api_key : str = "" ) -> dict :
60- """Get status of an experiment build asynchronously."""
61+ async def aget_status (model_name : str , model_version : str , api_key : str = "" ) -> dict :
62+ """Get status of a model build asynchronously."""
6163 client = PlexeAI (api_key = api_key )
62- return await client .aget_status (experiment_id = experiment_id )
64+ return await client .aget_status (model_name = model_name , model_version = model_version )
65+
66+ def cleanup_upload (upload_id : str , api_key : str = "" ) -> dict :
67+ """Clean up uploaded files."""
68+ client = PlexeAI (api_key = api_key )
69+ return client .cleanup_upload (upload_id = upload_id )
70+
71+ async def acleanup_upload (upload_id : str , api_key : str = "" ) -> dict :
72+ """Clean up uploaded files asynchronously."""
73+ client = PlexeAI (api_key = api_key )
74+ return await client .acleanup_upload (upload_id = upload_id )
6375
6476__all__ = ['PlexeAI' , 'build' , 'abuild' , 'infer' , 'ainfer' ,
65- 'batch_infer' , 'get_status' , 'aget_status' ]
77+ 'batch_infer' , 'get_status' , 'aget_status' ,
78+ 'cleanup_upload' , 'acleanup_upload' ]
0 commit comments