diff --git a/ai4papi/routers/v1/inference/oscar.py b/ai4papi/routers/v1/inference/oscar.py index 9a760d2..527dd9d 100644 --- a/ai4papi/routers/v1/inference/oscar.py +++ b/ai4papi/routers/v1/inference/oscar.py @@ -205,7 +205,12 @@ def get_services_list( services.append(s) - return services + # Sort services by creation time, recent to old + dates = [s['environment']['Variables']['PAPI_CREATED'] for s in services] + idxs = sorted(range(len(dates)), key=dates.__getitem__) # argsort + sorted_services = [services[i] for i in idxs[::-1]] + + return sorted_services @router.get("/services/{service_name}")