boto3
boto3 copied to clipboard
list_models API returns inconsistent results from AWS CLI and python SDK
Describe the bug
I have to use list_models API with below request body
aws sagemaker list-models --name-contains "model-abc" --sort-by "CreationTime" --sort-order Descending --max-items 1
in CLI case it returns me latest model which contains the required name. it first filters by name and then applies pagination of max-items=1
but in case of python SDK response = sm_client.list_models( NameContains="model-abc", SortBy="CreationTime", SortOrder="Descending", MaxResults=1, ) its first applying the pagination because of MaxResults =1 and then applying filter of name contains which is then returning my model summary as empty [] because the top result is not that name.
This seems like inconsistent behavior in API calls. Conceptually you always filter first and then apply pagination on results as in CLI behavior today.
Expected Behavior
{
"Models": [
{
"ModelName": "model-abc-123",
"ModelArn": "
Current Behavior
{ "Models": [] }
Reproduction Steps
added in description
Possible Solution
No response
Additional Information/Context
No response
SDK version used
python 3.9 on aws
Environment details (OS name and version, etc.)
Amazon Linux 2