Skip to content

Commit 65fa9ef

Browse files
committed
Document arguments
1 parent 7fb7b8a commit 65fa9ef

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/huggingface_hub/hf_api.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@ def list_models(
171171
172172
>>> # List only the models from the AllenNLP library
173173
>>> api.list_models(filter="allennlp")
174+
sort (:obj:`Literal["lastModified"]` or :obj:`str`, `optional`):
175+
The key with which to sort the resulting models. Possible values are the properties of the `ModelInfo`
176+
class.
177+
direction (:obj:`Literal[-1]` or :obj:`int`, `optional`):
178+
Direction in which to sort. The value `-1` sorts by descending order while all other values
179+
sort by ascending order.
180+
limit (:obj:`int`, `optional`):
181+
The limit on the number of models fetched. Leaving this option to `None` fetches all models.
182+
full (:obj:`bool`, `optional`):
183+
Whether to fetch all model data, including the `lastModified`, the `sha`, the files and the `tags`.
184+
This is set to `True` by default when using a filter.
185+
174186
"""
175187
path = "{}/api/models".format(self.endpoint)
176188
params = {}
@@ -184,7 +196,10 @@ def list_models(
184196
if limit is not None:
185197
params.update({"limit": limit})
186198
if full is not None:
187-
params.update({"full": full})
199+
if full:
200+
params.update({"full": True})
201+
elif "full" in params:
202+
del params["full"]
188203
r = requests.get(path, params=params)
189204
r.raise_for_status()
190205
d = r.json()

0 commit comments

Comments
 (0)