[BOT ISSUE] Google GenAI embedContent spans lack embedding-specific input, metrics, and span type
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- java
- Lĩnh vực
- observability
Hướng nghiên cứu
Bắt đầu trong braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java, đặc biệt là tagSpan() và getOperation(). Xem lại BraintrustGenAITest.java cũng như các định dạng request và response của embedContent của Google GenAI. Công việc được hoàn thành khi các embedding span thu thập các trường input được yêu cầu và metric số ký tự có thể tính phí, sử dụng loại embedding span và có phạm vi bao phủ kiểm thử tập trung.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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 actualcontentbeing embedded,taskType,title, andoutputDimensionalityare not extracted - No metrics: embedding responses use
metadata.billableCharacterCountinstead ofusageMetadata, so no token/character counts are captured - Incorrect span type: marked as
type: "llm"rather thantype: "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 usescontent(singular) - Checks for
generationConfigbut embedContent usestaskType,title,outputDimensionality - Result:
input_jsononly contains{"model": "..."}for embedding calls
Response parsing (lines 116–149):
- Checks for
usageMetadatawithpromptTokenCount/candidatesTokenCountbut embedContent responses havemetadatawithbillableCharacterCount - 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/geminido 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
embedContentas a stable, first-class API with models likegemini-embedding-001 - Google GenAI Java SDK:
client.models.embedContent()is available withEmbedContentConfig(taskType, title, outputDimensionality) and returnsEmbedContentResponsewithembeddingsandmetadata - embedContent request format: uses
content(singular),taskType,title,outputDimensionality— none of which match the generateContent fields currently extracted - embedContent response format: returns
embedding.valuesarray andmetadata.billableCharacterCount— notusageMetadata
Local files inspected
braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java— lines 50–161 (tagSpanonly extracts generateContent-relevant fields), lines 325–333 (getOperationcorrectly parsesembedContenttoembed_content)braintrust-sdk/instrumentation/genai_1_18_0/src/test/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAITest.java— no embedContent test existsbraintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustInstrumentation.java— wraps ApiClient generically, no embedding-specific logic
- Ngôn ngữ chính
- Java
- Star
- 21
- Fork
- 5
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của braintrustdata/braintrust-sdk-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Tất cả issue của braintrustdata/braintrust-sdk-java
Issue tương tự
-
certification
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Đang mởbug ecr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Needs: Triage Type: Feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
github/copilot-sdk#2760 ·