@@ -646,7 +646,7 @@ def delete_dataset(self, dataset_id: str, delete_documents: bool = False) -> Dic
646
646
647
647
:param dataset_id: Id of the dataset
648
648
:type dataset_id: str
649
- :param delete_documents: Set to true to delete documents in dataset before deleting dataset
649
+ :param delete_documents: Set to True to delete documents in dataset before deleting dataset
650
650
:type delete_documents: bool
651
651
:return: Dataset response from REST API
652
652
:rtype: dict
@@ -1342,20 +1342,23 @@ def create_training(
1342
1342
body .update (** optional_args )
1343
1343
return self ._make_request (requests .post , f'/models/{ model_id } /trainings' , body = body )
1344
1344
1345
- def get_training (self , model_id : str , training_id : str ) -> Dict :
1345
+ def get_training (self , model_id : str , training_id : str , statistics_last_n_days : Optional [ int ] = None ) -> Dict :
1346
1346
"""Get training, calls the GET /models/{modelId}/trainings/{trainingId} endpoint.
1347
1347
1348
1348
:param model_id: ID of the model
1349
1349
:type model_id: str
1350
1350
:param training_id: ID of the training
1351
1351
:type training_id: str
1352
+ :param statistics_last_n_days: Integer between 1 and 30
1353
+ :type statistics_last_n_days: int, optional
1352
1354
:return: Training response from REST API
1353
1355
:rtype: dict
1354
1356
1355
1357
:raises: :py:class:`~las.InvalidCredentialsException`, :py:class:`~las.TooManyRequestsException`,\
1356
1358
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
1357
1359
"""
1358
- return self ._make_request (requests .get , f'/models/{ model_id } /trainings/{ training_id } ' )
1360
+ params = {'statisticsLastNDays' : statistics_last_n_days }
1361
+ return self ._make_request (requests .get , f'/models/{ model_id } /trainings/{ training_id } ' , params = params )
1359
1362
1360
1363
def list_trainings (self , model_id , * , max_results : Optional [int ] = None , next_token : Optional [str ] = None ) -> Dict :
1361
1364
"""List trainings available, calls the GET /models/{modelId}/trainings endpoint.
@@ -1528,6 +1531,7 @@ def create_prediction(
1528
1531
training_id : Optional [str ] = None ,
1529
1532
preprocess_config : Optional [dict ] = None ,
1530
1533
postprocess_config : Optional [dict ] = None ,
1534
+ run_async : Optional [bool ] = None ,
1531
1535
) -> Dict :
1532
1536
"""Create a prediction on a document using specified model, calls the POST /predictions endpoint.
1533
1537
@@ -1568,6 +1572,8 @@ def create_prediction(
1568
1572
{'strategy': 'BEST_N_PAGES', 'parameters': {'n': 3}}
1569
1573
{'strategy': 'BEST_N_PAGES', 'parameters': {'n': 3, 'collapse': False}}
1570
1574
:type postprocess_config: dict, optional
1575
+ :param run_async: If True run the prediction async, if False run sync. if omitted run synchronously.
1576
+ :type run_async: bool
1571
1577
:return: Prediction response from REST API
1572
1578
:rtype: dict
1573
1579
@@ -1580,6 +1586,7 @@ def create_prediction(
1580
1586
'trainingId' : training_id ,
1581
1587
'preprocessConfig' : preprocess_config ,
1582
1588
'postprocessConfig' : postprocess_config ,
1589
+ 'async' : run_async ,
1583
1590
}
1584
1591
return self ._make_request (requests .post , '/predictions' , body = dictstrip (body ))
1585
1592
@@ -1623,6 +1630,23 @@ def list_predictions(
1623
1630
}
1624
1631
return self ._make_request (requests .get , '/predictions' , params = dictstrip (params ))
1625
1632
1633
+ def get_prediction (self , prediction_id : str ) -> Dict :
1634
+ """Get prediction, calls the GET /predictions/{predictionId} endpoint.
1635
+
1636
+ >>> from las.client import Client
1637
+ >>> client = Client()
1638
+ >>> client.get_prediction(prediction_id='<prediction id>')
1639
+
1640
+ :param prediction_id: Id of the prediction
1641
+ :type prediction_id: str
1642
+ :return: Asset response from REST API with content
1643
+ :rtype: dict
1644
+
1645
+ :raises: :py:class:`~las.InvalidCredentialsException`, :py:class:`~las.TooManyRequestsException`,\
1646
+ :py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
1647
+ """
1648
+ return self ._make_request (requests .get , f'/predictions/{ prediction_id } ' )
1649
+
1626
1650
def get_plan (self , plan_id : str ) -> Dict :
1627
1651
"""Get information about a specific plan, calls the GET /plans/{plan_id} endpoint.
1628
1652
0 commit comments