Summary
Hugging Face publishes @huggingface/transformers on npm — a JavaScript/TypeScript library for running ML models locally via ONNX/WebGPU without any server or API key (v3.x / v4 released March 2025). This is distinct from @huggingface/inference (remote Hugging Face Inference API, already instrumented via js/src/auto-instrumentations/configs/huggingface.ts). The Transformers.js package runs text generation, embeddings, and other model pipelines in-process (Node.js, Bun, Deno, or the browser) and has zero instrumentation in this repository. Users who call @huggingface/transformers pipelines for text generation or embeddings get no Braintrust spans.
What instrumentation is missing
The @huggingface/transformers npm package exposes these execution surfaces, none of which are instrumented:
| SDK Surface |
Description |
pipeline('text-generation', model)(prompt, options) |
Local autoregressive text generation |
pipeline('text2text-generation', model)(prompt, options) |
Local seq2seq text generation (T5, BART, etc.) |
pipeline('feature-extraction', model)(text, options) |
Local text embeddings (pooled hidden states) |
pipeline('question-answering', model)(question, context) |
Local extractive QA |
pipeline('summarization', model)(text, options) |
Local text summarization |
TextGenerationPipeline, FeatureExtractionPipeline, etc. |
Individual pipeline classes with __call__() |
The pipeline() factory is the primary API. Each call downloads (or loads from cache) a model, runs tokenization and inference locally, and returns the decoded output. The execution has clear start/end boundaries and meaningful inputs/outputs (prompt → generated text, or text → embedding vector) making it a strong candidate for span-level tracing.
No coverage in any instrumentation layer:
- No wrapper function (e.g.
wrapTransformers())
- No diagnostics channels for Transformers.js pipeline execution
- No plugin handler in
js/src/instrumentation/plugins/
- No auto-instrumentation config in
js/src/auto-instrumentations/configs/
- No e2e test scenarios
- Grep for
@huggingface/transformers or transformers.js across js/src/ returns zero matches
Distinction from existing @huggingface/inference instrumentation:
The existing huggingface.ts config patches @huggingface/inference, which makes HTTP calls to Hugging Face's hosted Inference API (requires an API key, network I/O). @huggingface/transformers runs models in-process via ONNX — no HTTP, no API key. The two packages have different module paths, different API shapes, and different execution models. A user who switches from @huggingface/inference to @huggingface/transformers (e.g. for local/offline inference) loses all tracing.
Braintrust docs status
not_found — Braintrust's Hugging Face integration page references @huggingface/inference (remote API) only. The Transformers.js package is not mentioned in any Braintrust docs.
Upstream references
Local files inspected
js/src/auto-instrumentations/configs/huggingface.ts — instruments @huggingface/inference only; module paths target @huggingface/inference dist files exclusively
js/src/instrumentation/plugins/huggingface-plugin.ts — handles textGeneration, textGenerationStream, featureExtraction from @huggingface/inference; no @huggingface/transformers coverage
js/src/instrumentation/plugins/huggingface-channels.ts — channels for @huggingface/inference only
js/src/auto-instrumentations/configs/all.ts — @huggingface/transformers not listed
e2e/scenarios/huggingface-instrumentation/ — tests cover @huggingface/inference only
- Full repo grep for
@huggingface/transformers, transformers.js — zero matches
Summary
Hugging Face publishes
@huggingface/transformerson npm — a JavaScript/TypeScript library for running ML models locally via ONNX/WebGPU without any server or API key (v3.x / v4 released March 2025). This is distinct from@huggingface/inference(remote Hugging Face Inference API, already instrumented viajs/src/auto-instrumentations/configs/huggingface.ts). The Transformers.js package runs text generation, embeddings, and other model pipelines in-process (Node.js, Bun, Deno, or the browser) and has zero instrumentation in this repository. Users who call@huggingface/transformerspipelines for text generation or embeddings get no Braintrust spans.What instrumentation is missing
The
@huggingface/transformersnpm package exposes these execution surfaces, none of which are instrumented:pipeline('text-generation', model)(prompt, options)pipeline('text2text-generation', model)(prompt, options)pipeline('feature-extraction', model)(text, options)pipeline('question-answering', model)(question, context)pipeline('summarization', model)(text, options)TextGenerationPipeline,FeatureExtractionPipeline, etc.__call__()The
pipeline()factory is the primary API. Each call downloads (or loads from cache) a model, runs tokenization and inference locally, and returns the decoded output. The execution has clear start/end boundaries and meaningful inputs/outputs (prompt → generated text, or text → embedding vector) making it a strong candidate for span-level tracing.No coverage in any instrumentation layer:
wrapTransformers())js/src/instrumentation/plugins/js/src/auto-instrumentations/configs/@huggingface/transformersortransformers.jsacrossjs/src/returns zero matchesDistinction from existing
@huggingface/inferenceinstrumentation:The existing
huggingface.tsconfig patches@huggingface/inference, which makes HTTP calls to Hugging Face's hosted Inference API (requires an API key, network I/O).@huggingface/transformersruns models in-process via ONNX — no HTTP, no API key. The two packages have different module paths, different API shapes, and different execution models. A user who switches from@huggingface/inferenceto@huggingface/transformers(e.g. for local/offline inference) loses all tracing.Braintrust docs status
not_found— Braintrust's Hugging Face integration page references@huggingface/inference(remote API) only. The Transformers.js package is not mentioned in any Braintrust docs.@huggingface/inferenceonly)Upstream references
@huggingface/transformersnpm: https://www.npmjs.com/package/@huggingface/transformersLocal files inspected
js/src/auto-instrumentations/configs/huggingface.ts— instruments@huggingface/inferenceonly; module paths target@huggingface/inferencedist files exclusivelyjs/src/instrumentation/plugins/huggingface-plugin.ts— handlestextGeneration,textGenerationStream,featureExtractionfrom@huggingface/inference; no@huggingface/transformerscoveragejs/src/instrumentation/plugins/huggingface-channels.ts— channels for@huggingface/inferenceonlyjs/src/auto-instrumentations/configs/all.ts—@huggingface/transformersnot listede2e/scenarios/huggingface-instrumentation/— tests cover@huggingface/inferenceonly@huggingface/transformers,transformers.js— zero matches