-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refacto Inference snippets tests (autogeneration + 1 snippet == 1 file) #1046
Conversation
Co-authored-by: Mishig <[email protected]>
Co-authored-by: Mishig <[email protected]>
import type { InferenceSnippet } from "@huggingface/tasks"; | ||
import { snippets } from "@huggingface/tasks"; | ||
|
||
type LANGUAGE = "sh" | "js" | "py"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the info, this is how the same thing is declared in moon. In subseq PR, we can probably declare InferenceSnippetLanguage
in tasks
and use it in tasks-gen
& moon
export const inferenceSnippetLanguages = ["python", "js", "curl"] as const;
export type InferenceSnippetLanguage = (typeof inferenceSnippetLanguages)[number];
Co-authored-by: Mishig <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm !
thanks for this refactor
Co-authored-by: Mishig <[email protected]>
thanks for the review :) |
This PR is a refacto of the inference snippet tests. The main goal is to reduce friction when updating the inference snippets logic. In particular:
This PR is quite large given the auto-generated files. The main parts to review are:
generate-snippets-fixtures.ts
=> the script that generates the snippets and test them.tasks-gen
depend ontasks
)python.spec.ts
/js.specs.ts
andcurl.specs.ts
have been removedpackages/tasks-gen/snippets-fixtures/
=> the test cases. I've only committed the ones that where previously tested.Thanks to this PR, I fixed a typo in the JS snippets (a missing comma) and curl snippets (consistency between
"
and'
).cc @mishig25 with whom I quickly discussed this