From ba108d6bf9cc2a22192ad6a004f7e1415c87828c Mon Sep 17 00:00:00 2001 From: Celina Hanouti Date: Wed, 3 Jun 2026 18:32:11 +0200 Subject: [PATCH] Skip provider/task combos with no @huggingface/inference snippet helper The inference-providers doc build prerenders an for every (provider, task) section. The doc-builder generates those snippets via @huggingface/inference's getProviderHelper(provider, task), which throws an InferenceClientInputError when the provider has no helper for that task. The uncaught error surfaces as a SvelteKit 500 and fails the whole build. This happens whenever a provider's partner API advertises a live model for a task that @huggingface/inference doesn't (yet) support as a snippet, e.g. `together` + `automatic-speech-recognition` (added in #2507), which has been breaking the inference-providers doc build on main since 2026-05-29. Guard generate.ts so it never emits such a section: mirror the doc-builder's helper lookup (resolving conversational text-generation / image-text-to-text to the "conversational" task) and skip any combo getProviderHelper can't handle. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../inference-providers/scripts/generate.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/inference-providers/scripts/generate.ts b/scripts/inference-providers/scripts/generate.ts index 9078a6f4ae..28edc602f9 100644 --- a/scripts/inference-providers/scripts/generate.ts +++ b/scripts/inference-providers/scripts/generate.ts @@ -1,5 +1,5 @@ import { PipelineType } from "@huggingface/tasks"; -import { PROVIDERS_HUB_ORGS } from "@huggingface/inference"; +import { PROVIDERS_HUB_ORGS, getProviderHelper } from "@huggingface/inference"; import Handlebars from "handlebars"; import * as fs from "node:fs/promises"; import * as path from "node:path/posix"; @@ -478,6 +478,19 @@ await Promise.all( }), ); +/// A provider may serve a live model for a task that `@huggingface/inference` +/// has no snippet helper for. Emitting an `` for such a combo +/// crashes the doc-builder prerender (`getProviderHelper` throws), so we mirror +/// that lookup here and skip any (provider, task) combo it can't handle. +function isSnippetSupported(provider: string, task: string): boolean { + try { + getProviderHelper(provider, task); + return true; + } catch { + return false; + } +} + async function fetchWarmModels( task: PipelineType, conversational: boolean = false, @@ -498,9 +511,18 @@ async function fetchWarmModels( ] : ["hf-inference", ...(PER_TASK_SUPPORTED_PROVIDERS[task] ?? [])] ).sort(); + // The doc-builder resolves conversational text-generation / image-text-to-text + // snippets to the "conversational" helper task; mirror that here. + const helperTask = conversational ? "conversational" : task; return ( await Promise.all( providers.map(async (provider) => { + if (!isSnippetSupported(provider, helperTask)) { + console.warn( + ` ⏭️ Skipping ${provider} for ${task}: @huggingface/inference has no snippet helper for this (provider, task) combo`, + ); + return; + } console.log( ` ⚡ Fetching most popular warm model for ${task} from ${provider}`, );