Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BOT ISSUE] Google GenAI embedContent spans lack embedding-specific input, metrics, and span type

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
java
Domain
observability

Research direction

Start in braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java, especially tagSpan() and getOperation(). Review BraintrustGenAITest.java and the Google GenAI embedContent request and response formats. Done means embedding spans capture the requested input fields and billable-character metric, use an embedding span type, and have focused test coverage.

Written by the indexing model from the issue text.

Description

Summary

When client.models.embedContent() is called through the instrumented Google GenAI client, the call is captured at the HTTP level but the span contains almost no useful embedding-specific detail. The tagSpan() method in BraintrustApiClient only extracts fields relevant to generateContent (like contents, generationConfig, usageMetadata), which are absent from embedding requests and responses.

The span is created with the correct operation name (embed_content) but has:

  • Empty input_json: only {"model": "..."} — the actual content being embedded, taskType, title, and outputDimensionality are not extracted
  • No metrics: embedding responses use metadata.billableCharacterCount instead of usageMetadata, so no token/character counts are captured
  • Incorrect span type: marked as type: "llm" rather than type: "embedding" (or equivalent)

The full response is stored in output_json as a raw dump, so the embedding vector data is technically present but not meaningfully structured.

What is missing

In BraintrustApiClient.tagSpan() (lines 50–161):

Request parsing (lines 97–112):

  • Checks for contents (generateContent field) but embedContent uses content (singular)
  • Checks for generationConfig but embedContent uses taskType, title, outputDimensionality
  • Result: input_json only contains {"model": "..."} for embedding calls

Response parsing (lines 116–149):

  • Checks for usageMetadata with promptTokenCount/candidatesTokenCount but embedContent responses have metadata with billableCharacterCount
  • Result: no metrics are captured

Span attributes (line 156):

  • Hardcodes type: "llm" for all calls including embeddings

Braintrust docs status

  • The Braintrust Gemini integration docs at braintrust.dev/docs/integrations/ai-providers/gemini do not mention embeddings: not_found
  • No embeddings instrumentation is documented for any provider in Java

Upstream sources

  • Google GenAI embeddings docs: https://ai.google.dev/gemini-api/docs/embeddings — documents embedContent as a stable, first-class API with models like gemini-embedding-001
  • Google GenAI Java SDK: client.models.embedContent() is available with EmbedContentConfig (taskType, title, outputDimensionality) and returns EmbedContentResponse with embeddings and metadata
  • embedContent request format: uses content (singular), taskType, title, outputDimensionality — none of which match the generateContent fields currently extracted
  • embedContent response format: returns embedding.values array and metadata.billableCharacterCount — not usageMetadata

Local files inspected

  • braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java — lines 50–161 (tagSpan only extracts generateContent-relevant fields), lines 325–333 (getOperation correctly parses embedContent to embed_content)
  • braintrust-sdk/instrumentation/genai_1_18_0/src/test/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAITest.java — no embedContent test exists
  • braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustInstrumentation.java — wraps ApiClient generically, no embedding-specific logic
Dominant language
Java
Stars
21
Forks
5
Avg merge
2d 7h
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from braintrustdata/braintrust-sdk-java

All issues in braintrustdata/braintrust-sdk-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.