[bot] OpenAI and Anthropic generation parameters not captured in span metadata
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- java
調査の方向性
braintrust-sdk/src/main/java/dev/braintrust/instrumentation/InstrumentationSemConv.java の tagOpenAIRequest と tagAnthropicRequest から始め、次に BraintrustApiClient.java の Google GenAI ハンドラーにおけるパラメータ抽出と比較します。既存の OpenAI および Anthropic のテストファイルを確認し、一覧にある生成パラメータとプロバイダー固有の設定のカバレッジを追加します。対応しているリクエストメタデータが一貫して取得され、テストでそれが検証されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The OpenAI and Anthropic request taggers in InstrumentationSemConv only extract model and request routing info (request_path, request_base_uri, request_method) into span metadata. Generation parameters like temperature, max_tokens, tools, response_format, and provider-specific config like Anthropic's thinking are silently dropped.
In contrast, the Google GenAI handler in the same repo (BraintrustApiClient.tagSpan()) extracts temperature, topP, topK, maxOutputTokens, tools, toolConfig, safetySettings, responseMimeType, responseSchema, and more into metadata. This is an inconsistency within the repo — the Google GenAI handler provides materially more instrumentation detail for the same class of information.
What is missing
OpenAI — tagOpenAIRequest() (lines 78–108)
Currently captures only model in metadata. The following request parameters are silently dropped:
| Field | Purpose |
|---|---|
temperature |
Sampling temperature |
max_tokens / max_completion_tokens |
Output length limit |
top_p |
Nucleus sampling |
frequency_penalty, presence_penalty |
Repetition control |
tools |
Tool/function definitions |
response_format |
Structured output config (JSON mode, JSON Schema) |
reasoning_effort |
Reasoning effort for o-series models |
logprobs, top_logprobs |
Log probability settings |
stop |
Stop sequences |
For the Responses API, additional fields are missing: instructions, tools (with web_search, file_search, code_interpreter configs), reasoning (with effort and summary).
Anthropic — tagAnthropicRequest() (lines 163–205)
Currently captures only model in metadata. The following request parameters are silently dropped:
| Field | Purpose |
|---|---|
max_tokens |
Output length limit (required parameter) |
temperature |
Sampling temperature |
top_p, top_k |
Sampling parameters |
tools |
Tool definitions |
thinking |
Extended thinking config (type, budget_tokens) |
stop_sequences |
Stop sequences |
metadata |
User-provided metadata (e.g., user_id) |
The thinking config is particularly important: when a user enables extended thinking with a specific budget, this information is lost from the span. The Python SDK equivalent (issue braintrustdata/braintrust-sdk-python#107, now closed) captures thinking metadata.
Google GenAI — already captures these (for comparison)
BraintrustApiClient.tagSpan() (lines 64–95) extracts into metadata:
systemInstruction,tools,toolConfig,safetySettings,cachedContent- From
generationConfig:temperature,topP,topK,candidateCount,maxOutputTokens,stopSequences,responseMimeType,responseSchema
Impact
Users viewing traces in Braintrust can see generation parameters for Google GenAI calls but not for OpenAI or Anthropic calls. This makes it impossible to understand model configuration from the trace alone for the two most commonly used providers.
Braintrust docs status
- Braintrust tracing docs at https://www.braintrust.dev/docs/guides/tracing state that LLM spans show "the model, messages, parameters, token usage, and cost" — supported (parameters are documented as captured, but not implemented for OpenAI/Anthropic in this Java SDK)
- The Braintrust OpenAI docs mention temperature handling for GPT-5 models, implying it is a tracked parameter: unclear
Upstream sources
- OpenAI Chat Completions API: https://platform.openai.com/docs/api-reference/chat/create — documents all request parameters including
temperature,max_tokens,tools,response_format,reasoning_effort - OpenAI Responses API: https://platform.openai.com/docs/api-reference/responses/create — documents
instructions,tools,reasoning - Anthropic Messages API: https://docs.anthropic.com/en/api/messages — documents
max_tokens,temperature,tools,thinking,top_p,top_k,stop_sequences - Anthropic extended thinking: https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking — documents
thinkingparameter withtypeandbudget_tokens
Local files inspected
braintrust-sdk/src/main/java/dev/braintrust/instrumentation/InstrumentationSemConv.java— lines 78–108 (tagOpenAIRequest: onlymodelextracted), lines 163–205 (tagAnthropicRequest: onlymodelextracted)braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java— lines 64–95 (tagSpan: comprehensive parameter extraction into metadata)braintrust-sdk/instrumentation/openai_2_8_0/src/test/java/dev/braintrust/instrumentation/openai/v2_8_0/BraintrustOpenAITest.java— no test asserts generation parameters in metadatabraintrust-sdk/instrumentation/anthropic_2_2_0/src/test/java/dev/braintrust/instrumentation/anthropic/v2_2_0/BraintrustAnthropicTest.java— no test asserts generation parameters in metadata
- 主要言語
- Java
- スター
- 21
- フォーク
- 5
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 8
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
braintrustdata/braintrust-sdk-java のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
braintrustdata/braintrust-sdk-java の issue をすべて見る
似ている issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
inu-appcenter/memorIN-backend#288 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
frontend maui-pilot pilot-ask question
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
area/plugin
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kestra-io/plugin-kestra#190 ·