Skip to content

[bot] Google GenAI video generation (Veo, GenerateVideos) not instrumented in Go SDK #217

Description

@braintrust-bot

What instrumentation is missing

The Google GenAI Go SDK (google.golang.org/genai v1.41.0, pinned in trace/contrib/genai/go.mod) exposes video generation (Veo models) via client.Models.GenerateVideos() and client.Models.GenerateVideosFromSource(), returning a long-running operation that is polled to completion. The genai HTTP router in trace/contrib/genai/tracegenai.go only matches path patterns for generateContent/streamGenerateContent and embedContent/batchEmbedContents:

func genaiRouter(cfg *config, path string) internal.MiddlewareTracer {
	if containsGenerateContent(path) {
		...
	}
	if containsEmbedContent(path) {
		...
	}
	return nil
}

Video generation uses a :predictLongRunning method suffix (matching the long-running-operation pattern used by Vertex AI/Gemini generative media APIs), which is not :generateContent, :streamGenerateContent, :embedContent, or :batchEmbedContents. genaiRouter therefore returns nil for these requests and GenerateVideos calls are completely untraced — no span, no input/output capture, no metadata.

This is distinct from the already-filed Imagen gap (#157, generateImages, which uses the :predict suffix) and the Live API gap (#114, real-time bidirectional streaming) — video generation is a separate long-running-operation execution surface not covered by either.

Go SDK usage

op, err := client.Models.GenerateVideos(ctx, "veo-3.1-generate-preview",
	"A time-lapse of a flower blooming", nil, &genai.GenerateVideosConfig{})
// poll op until done, then op.Response.GeneratedVideos[...]

What could be traced

A dedicated tracer matching :predictLongRunning (and the corresponding operation-polling :fetchPredictOperation/GET operation path, if feasible) could capture, similar to the existing generateContentTracer/embedContentTracer pattern:

  • braintrust.input_json: {"model": "veo-3.1-generate-preview", "prompt": "...", "config": {...}}
  • braintrust.output_json: a shape-only summary (e.g. {"videos_count": N, "mime_type": "video/mp4"}), matching the raw-payload-omission convention already used for embeddings (embedding_length) and proposed for Imagen (images_count) rather than logging video bytes
  • braintrust.metadata: model, aspectRatio, durationSeconds, numberOfVideos, personGeneration

Braintrust docs status

not_found — the Braintrust Gemini/GenAI integration docs (https://www.braintrust.dev/docs/integrations/ai-providers/gemini) list, per language, only: Python (generate_content, generate_content_stream, embed_content, generate_images, interactions.*), TypeScript (generate_content, generate_content_stream, embed_content, create_interaction), Go (generate_content/GenerateContentStream, embed_content/batchEmbedContents), and Java (generate_content). No language's section mentions video generation, Veo, or GenerateVideos anywhere on the page.

Upstream sources

Braintrust docs source

Local repo files inspected

  • trace/contrib/genai/tracegenai.gogenaiRouter, containsGenerateContent, containsEmbedContent: no :predictLongRunning case
  • trace/contrib/genai/generatecontent.go — reference pattern for request/response parsing
  • trace/contrib/genai/embedcontent.go — reference pattern for shape-only output summaries
  • trace/contrib/genai/go.modgoogle.golang.org/genai v1.41.0 (Models.GenerateVideos available in this version)
  • trace/contrib/genai/tracegenai_test.go — no tests for :predictLongRunning / video paths
  • examples/internal/genai/main.go — no GenerateVideos example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions