[InferenceSnippet] do not fail entirely if snippets did not work#574
Open
[InferenceSnippet] do not fail entirely if snippets did not work#574
Conversation
Wauplin
commented
Jun 18, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that errors during inference snippet generation do not block documentation updates by catching exceptions and returning empty snippets. Key changes include:
- Adding a new interface (InferenceProviderMappingEntry) to support mapping information.
- Creating a helper function (getInferenceSnippetsOrEmpty) that wraps snippet retrieval in a try-catch.
- Updating code calls to use the new helper function, preventing complete failure on snippet generation failures.
Comments suppressed due to low confidence (1)
kit/src/lib/InferenceSnippet/InferenceSnippet.svelte:76
- Add a brief comment explaining the purpose of getInferenceSnippetsOrEmpty(), particularly why errors are caught and an empty array is returned.
function getInferenceSnippetsOrEmpty(
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Wauplin
added a commit
to huggingface/huggingface.js
that referenced
this pull request
Jun 18, 2025
Currently `InferenceProviderMappingEntry` is defined in a module that is not exported. This PR moves it to the `types.ts` module for better reusability (will be useful for huggingface/doc-builder#574 (comment))
…lder into do-not-fail-on-error
Contributor
Author
|
@mishig25 PR is ready for review |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently doc-builder fails on Inference Provider docs with:
This is due to provider Replicate having a
automatic-speech-recognitionmodel listed even though the JS / Python clients do not support it (and therefore we cannot generate the snippets). Instead of failing entirely it would be best to warn on error and continue. This allows other snippets to be correctly updated.Note: a solution in parallel is to unlist the failing model on Replicate side. I already pinged them on Slack about that but in any case, we should not block doc updates just because of a mistake from a provider.