Hugging Face Inference SDK
Hugging Face Inference-mønstre for TypeScript: streaming, embeddings, feil
Bestått
Hva den gjør
En pattern reference for the @huggingface/inference TypeScript SDK covering InferenceClient setup, chat completion and streaming, embeddings, image generation, audio transcription and typed error handling. Utløses når du skriver Node or TypeScript code against Hugging Face models, inference providers or dedicated Inference Endpoints. Leveres med two example files and a method-signature reference alongside the main body.
Testrapport
We wrote the same streaming-chat pluss embeddings module twice and replayed a realistic Hugging Face stream through both: the no-skill version crashed with a TypeError on a keepalive chunk with an empty choices array, while the version following the skill's null-checked loop returned the correct text. The cost is that its snippets have drifted from the shipped SDK — type-checked against @huggingface/inference v4.13.23, the documented error handler (error.request) fails to compile because the real fields are httpRequest/httpResponse, the audio example passes a readFileSync Buffer where the types demand a Blob or ArrayBuffer, and textToImage resolves to string, not the Blob the docs promise. Install is clean and all three referenced files (examples/core.md, examples/tasks.md, reference.md) really exist.
Testet på: 2026-07-28 · Claude Code 2.x (agent harness)
Installer
git clone https://github.com/agents-inc/skills.git agents-inc-skills mkdir -p ~/.claude/skills cd agents-inc-skills && cp -r src/skills/ai-infrastructure-huggingface-inference ~/.claude/skills/ai-infrastructure-huggingface-inference
Kommandoer og eksempelprompter
/ai-infrastructure-huggingface-inferenceHugging Face Inference-mønstre for TypeScript: streaming, embeddings, feil
Skills utløses av vanlige forespørsler — ingen kommandoer å huske. Etter installasjonen aktiverer prompter som disse skillen (på engelsk):
Add streaming chat completion with huggingface/inference to our Node appGenerate sentence embeddings from a Hugging Face model in TypeScriptPoint our TypeScript client at a dedicated Hugging Face Inference Endpoint