From 2b50a4fbc8e94df9b3eb6aad267e64c601ed3e5e Mon Sep 17 00:00:00 2001 From: Wauplin Date: Mon, 27 Nov 2023 11:49:02 +0100 Subject: [PATCH 1/5] Document GET /api/collections endpoint --- docs/hub/api.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/hub/api.md b/docs/hub/api.md index abe857bcc..95d343bd7 100644 --- a/docs/hub/api.md +++ b/docs/hub/api.md @@ -288,6 +288,32 @@ Return information about a collection. This is equivalent to `huggingface_hub.get_collection()`. +### GET /api/collections + +List collections from the Hub, based on some criteria. The supported parameters are: +- `owner` (string): filter collections created by a specific user. +- `item` (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: `"models/teknium/OpenHermes-2.5-Mistral-7B"`, `"datasets/squad"` or `"papers/2311.12983"`. +- `sort` (string): sort the returned collections. Supported values are `"lastModified"`, `"trending"` (default) and `"upvotes"`. +- `limit` (int): maximum number of collections per pages. + +If no parameter is set, all collections are returned. + +The returned result is paginated. To get all collections, you must follow the +The response is paginated. To get all collections, you must follow the [`Link` header](https://docs.github.com/en/rest/guides/using-pagination-in-the-rest-api?apiVersion=2022-11-28#link-header). + +Payload: + +```js +params = { + "owner": "TheBloke", + "item": "models/teknium/OpenHermes-2.5-Mistral-7B", + "sort": "lastUpdated", + "limit" : 1, +} +``` + +This is equivalent to `huggingface_hub.list_collections()`. + ### PATCH /api/collections/{namespace}/{slug}-{id} Update the metadata of a collection on the Hub. You can't add or modify the items of the collection with this method. All fields of the payload are optional. From b07b1b445076d36f09d013fddd39cfd740d28b95 Mon Sep 17 00:00:00 2001 From: Lucain Date: Mon, 27 Nov 2023 14:14:42 +0100 Subject: [PATCH 2/5] Update docs/hub/api.md Co-authored-by: Sylvestre Bouchot --- docs/hub/api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/hub/api.md b/docs/hub/api.md index 95d343bd7..276d95d47 100644 --- a/docs/hub/api.md +++ b/docs/hub/api.md @@ -294,7 +294,8 @@ List collections from the Hub, based on some criteria. The supported parameters - `owner` (string): filter collections created by a specific user. - `item` (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: `"models/teknium/OpenHermes-2.5-Mistral-7B"`, `"datasets/squad"` or `"papers/2311.12983"`. - `sort` (string): sort the returned collections. Supported values are `"lastModified"`, `"trending"` (default) and `"upvotes"`. -- `limit` (int): maximum number of collections per pages. +- `limit` (int): maximum number (100) of collections per page. +- `q` (string): Filter based on substrings for titles & description If no parameter is set, all collections are returned. From 0011475e2455e96150b5ee50d283091daadd036b Mon Sep 17 00:00:00 2001 From: Lucain Date: Mon, 27 Nov 2023 14:45:19 +0100 Subject: [PATCH 3/5] Apply suggestions from code review --- docs/hub/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/api.md b/docs/hub/api.md index 276d95d47..67078c26f 100644 --- a/docs/hub/api.md +++ b/docs/hub/api.md @@ -295,7 +295,7 @@ List collections from the Hub, based on some criteria. The supported parameters - `item` (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: `"models/teknium/OpenHermes-2.5-Mistral-7B"`, `"datasets/squad"` or `"papers/2311.12983"`. - `sort` (string): sort the returned collections. Supported values are `"lastModified"`, `"trending"` (default) and `"upvotes"`. - `limit` (int): maximum number (100) of collections per page. -- `q` (string): Filter based on substrings for titles & description +- `q` (string): filter based on substrings for titles & descriptions If no parameter is set, all collections are returned. From b700f39e1f70778ab7b1fa893617b8a1a08420a5 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Mon, 27 Nov 2023 14:45:54 +0100 Subject: [PATCH 4/5] dot --- docs/hub/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/api.md b/docs/hub/api.md index 67078c26f..737a64443 100644 --- a/docs/hub/api.md +++ b/docs/hub/api.md @@ -295,7 +295,7 @@ List collections from the Hub, based on some criteria. The supported parameters - `item` (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: `"models/teknium/OpenHermes-2.5-Mistral-7B"`, `"datasets/squad"` or `"papers/2311.12983"`. - `sort` (string): sort the returned collections. Supported values are `"lastModified"`, `"trending"` (default) and `"upvotes"`. - `limit` (int): maximum number (100) of collections per page. -- `q` (string): filter based on substrings for titles & descriptions +- `q` (string): filter based on substrings for titles & descriptions. If no parameter is set, all collections are returned. From 6b44ffe115abc3e2f97c000d5da2032a48df58ee Mon Sep 17 00:00:00 2001 From: Wauplin Date: Tue, 28 Nov 2023 09:11:48 +0100 Subject: [PATCH 5/5] feedback --- docs/hub/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/api.md b/docs/hub/api.md index 737a64443..d64b27b13 100644 --- a/docs/hub/api.md +++ b/docs/hub/api.md @@ -291,7 +291,7 @@ This is equivalent to `huggingface_hub.get_collection()`. ### GET /api/collections List collections from the Hub, based on some criteria. The supported parameters are: -- `owner` (string): filter collections created by a specific user. +- `owner` (string): filter collections created by a specific user or organization. - `item` (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: `"models/teknium/OpenHermes-2.5-Mistral-7B"`, `"datasets/squad"` or `"papers/2311.12983"`. - `sort` (string): sort the returned collections. Supported values are `"lastModified"`, `"trending"` (default) and `"upvotes"`. - `limit` (int): maximum number (100) of collections per page.