-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[model libraries] simplified setup for countDownloads (#485)
Second part of #482 note to reviewers: I only expose the `filter` option because: - it's simpler: every library except for diffusers is using it. - i had typings issues/conflicts with the Chai library when defining a type that contains a property named `should`. cc @coyotte508. Rather than fightining the tooling, i decided to work around it
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* This file contains the (simplified) types used | ||
* to represent queries that are made to Elastic | ||
* in order to count number of model downloads | ||
* | ||
* Read this doc about download stats on the Hub: | ||
* | ||
* https://huggingface.co/docs/hub/models-download-stats | ||
* | ||
* see also: | ||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html | ||
*/ | ||
|
||
export type ElasticBoolQueryFilter = | ||
// match a single filename | ||
| { term?: { path: string } } | ||
// match multiple possible filenames | ||
| { terms?: { path: string[] } } | ||
// match a wildcard | ||
| { wildcard?: { path: string } }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters