[BOT ISSUE] OpenAI Responses API instrumentation uses wrong token-limit parameter name and is missing several metadata fields
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- ruby
- Domain
- observability
Research direction
Start with METADATA_FIELDS in lib/braintrust/contrib/openai/instrumentation/responses.rb and lib/braintrust/contrib/ruby_openai/instrumentation/responses.rb, then compare them with lib/braintrust/contrib/openai/instrumentation/chat.rb and the upstream ResponseCreateParams definition. Confirm that the Responses instrumentation metadata matches the documented parameter names and includes all fields listed in the issue.
Written by the indexing model from the issue text.
Description
Summary
The Responses API instrumentation in both the openai and ruby-openai integrations has an incorrect parameter name (max_tokens instead of max_output_tokens) and is missing several parameters that are part of the stable upstream API. Users who set max_output_tokens, service_tier, include, text, or background on their Responses API calls get no visibility into these values in their Braintrust span metadata.
What is missing
The METADATA_FIELDS constant in both Responses API instrumentations currently includes:
METADATA_FIELDS = %i[
model instructions modalities tools parallel_tool_calls
tool_choice temperature max_tokens top_p frequency_penalty
presence_penalty seed user metadata store response_format
reasoning previous_response_id truncation
].freeze
Wrong parameter name
| Current field | Correct field | Why it matters |
|---|---|---|
max_tokens |
max_output_tokens |
The Responses API uses max_output_tokens, not max_tokens. The SDK captures a field that doesn't exist in the Responses API, and misses the one users actually pass. |
Missing parameters
| Parameter | Why it matters |
|---|---|
service_tier |
Controls processing priority (auto, default, flex, priority). Already captured in the Chat Completions instrumentation — this is an inconsistency within the SDK. |
include |
Array controlling what additional data is returned (e.g., web_search_call.action.sources, code_interpreter_call.outputs). Important for understanding what data the user requested. |
text |
Text response format configuration for structured outputs. The newer alternative to response_format for the Responses API. |
background |
Boolean for async/background response execution. Changes how the response is processed — users need to see this in traces to understand response behavior. |
Braintrust docs status
not_found — The Braintrust docs at https://www.braintrust.dev/docs/instrument/wrap-providers do not mention max_output_tokens, service_tier, include, text, or background for the Responses API.
Upstream sources
- Official OpenAI Ruby SDK: https://github.com/openai/openai-ruby —
OpenAI::Models::Responses::ResponseCreateParamsdefinesmax_output_tokens(notmax_tokens),service_tier,include,text,background, and other parameters inlib/openai/models/responses/response_create_params.rb - OpenAI Responses API docs: https://platform.openai.com/docs/api-reference/responses/create — documents all parameters
Local repo files inspected
lib/braintrust/contrib/openai/instrumentation/responses.rb(lines 26–31) —METADATA_FIELDSusesmax_tokens(wrong) and is missingmax_output_tokens,service_tier,include,text,backgroundlib/braintrust/contrib/ruby_openai/instrumentation/responses.rb(lines 32–37) — identicalMETADATA_FIELDS, same issueslib/braintrust/contrib/openai/instrumentation/chat.rb(lines 27–32) — Chat Completions already capturesservice_tier, showing this is an oversight in the Responses instrumentation
- Dominant language
- Ruby
- Stars
- 9
- Forks
- 10
- Avg merge
- 22h 10m
- Merged PRs (30d)
- 6
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from braintrustdata/braintrust-sdk-ruby
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
ruby
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
ruby
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in braintrustdata/braintrust-sdk-ruby
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eurosky-social/eu-haul#32 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/add-to-org#17 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/change_agent#11 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
benbalter/count-org-loc#20 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
benbalter/sitemap-parser#33 ·