Skip to content

[bot] HuggingFace Hub: InferenceClient.text_to_video() not instrumented #525

Description

@braintrust-bot

Summary

The HuggingFace Hub InferenceClient.text_to_video() (and its async counterpart) is not instrumented. Calls to this method produce zero Braintrust tracing. This is a stable generative video API on the same InferenceClient class that the integration already instruments for chat, text generation, and embeddings.

This gap is adjacent to but distinct from #487 (text_to_image, image_to_text, text_to_speech) and #506 (automatic_speech_recognition). text_to_video is not included in either existing issue.

What is missing

InferenceClient method Task type Instrumented?
chat_completion() Chat generation Yes
text_generation() Text generation Yes
feature_extraction() Embeddings Yes
sentence_similarity() Semantic similarity Yes
text_to_image() Image generation No (tracked in #487)
image_to_text() Vision captioning No (tracked in #487)
text_to_speech() Audio synthesis No (tracked in #487)
automatic_speech_recognition() Audio transcription No (tracked in #506)
text_to_video() Video generation No — not tracked
AsyncInferenceClient.text_to_video() Video generation (async) No — not tracked

API details

  • Method: InferenceClient.text_to_video(text: str, *, model: str | None = None, **kwargs) -> bytes
  • Returns: raw video bytes (the caller writes to file or streams)
  • Async counterpart: AsyncInferenceClient.text_to_video(...) with identical signature
  • Availability: present in huggingface-hub ≥ 0.19.0 — both matrix pins (floor 0.32.0 and latest 1.19.0) include it
  • The method is in huggingface_hub.inference._client.InferenceClient (sync) and huggingface_hub.inference._generated._async_client.AsyncInferenceClient (async), matching the pattern used by all existing patchers

Minimum instrumentation

Both sync and async text_to_video() should create spans capturing:

Span field Content
input Text prompt
output Video byte length or content-type metadata (raw bytes are large; a summary is preferable)
metadata provider: "huggingface_hub", model (from model parameter), task-specific generation params
metrics Latency

The pattern should follow the existing _text_generation_wrapper / _async_text_generation_wrapper structure in py/src/braintrust/integrations/huggingface_hub/tracing.py, with a new composite patcher in patchers.py.

Braintrust docs status

not_found — The Braintrust HuggingFace Hub integration docs describe tracing for chat_completion, text_generation, and embeddings. No mention of video generation.

Upstream sources

  • huggingface_hub.inference._client.InferenceClient.text_to_video — sync surface
  • huggingface_hub.inference._generated._async_client.AsyncInferenceClient.text_to_video — async surface
  • HuggingFace Hub inference API docs: https://huggingface.co/docs/huggingface_hub/package_reference/inference_client
  • huggingface-hub current matrix: latest = "huggingface-hub==1.19.0", floor "0.32.0" = "huggingface-hub==0.32.0"

Local files inspected

  • py/src/braintrust/integrations/huggingface_hub/patchers.py — defines 8 patchers (4 sync + 4 async) for chat_completion, text_generation, feature_extraction, sentence_similarity only; zero references to text_to_video
  • py/src/braintrust/integrations/huggingface_hub/tracing.py — wrapper implementations for the 4 covered tasks; no text_to_video wrapper
  • py/src/braintrust/integrations/huggingface_hub/integration.py — registers the 4 patchers; no video patcher
  • py/src/braintrust/integrations/huggingface_hub/test_huggingface_hub.py — no text_to_video test cases
  • py/pyproject.toml[tool.braintrust.matrix.huggingface-hub] pins both latest = "huggingface-hub==1.19.0" and "0.32.0" = "huggingface-hub==0.32.0"

Relationship to existing issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions