[bot] OpenAI Batch API (`client.batches.create`) not instrumented (openai + ruby-openai gems)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- ruby
- Domain
- api, observability
Research direction
Start with lib/braintrust/contrib/openai/patcher.rb and its instrumentation directory, then compare the corresponding files under lib/braintrust/contrib/ruby_openai/. Add coverage for the batches.create call in both integrations, capturing the listed inputs and metadata while leaving asynchronous retrieval out of scope; done means both gems expose batch submission instrumentation consistent with the existing patchers.
Written by the indexing model from the issue text.
Description
Summary
Both the official openai gem and the community ruby-openai gem expose OpenAI's Batch API (client.batches.create), which submits up to 50,000 queued generation requests (chat completions, responses, embeddings, moderations, images, or videos) for asynchronous processing at reduced cost. This is the OpenAI-gem counterpart to two gaps already tracked in this repo for other providers/gems — Anthropic's Message Batches API (#169) and RubyLLM's RubyLLM.batch (#193) — but the equivalent surface for the openai/ruby-openai gems themselves has no instrumentation at all.
What is missing
OpenAI::Resources::Batches#create(completion_window:, endpoint:, input_file_id:, ...) (official gem) and the equivalent client.batches.create(...) on ruby-openai submit a batch job referencing an uploaded JSONL file of requests targeting one of /v1/responses, /v1/chat/completions, /v1/embeddings, /v1/completions, /v1/moderations, /v1/images/generations, /v1/images/edits, or /v1/videos. This is the generative-execution-initiating call for the batch — no Patcher in this repo wraps it.
batch = client.batches.create(
completion_window: :"24h",
endpoint: :"/v1/chat/completions",
input_file_id: "input_file_id"
)
What a span should capture
- Input:
input_file_id,endpoint(which underlying generative API the batch targets),completion_window - Metadata: provider (
openai), batchid,statuson creation, any request-levelmetadataparam - Metrics:
request_countsonce available (total/completed/failed), latency of thecreatecall
Because results are retrieved asynchronously via file download (a CRUD/retrieval operation, out of scope per this audit), the actionable instrumentation point is the create call itself — matching the pattern already proposed for the Anthropic Messages Batches and RubyLLM.batch gaps in this repo.
Braintrust docs status
not_found — https://www.braintrust.dev/docs/integrations/ai-providers/openai documents chat completions, streaming, structured outputs, tool calling, audio transcription, and multimodal content, but does not mention the Batch API in any language.
Upstream sources
- Official OpenAI Ruby SDK
Batchesresource: https://developers.openai.com/api/reference/ruby/resources/batches/methods/create - OpenAI Batch API guide: https://developers.openai.com/api/docs/guides/batch
ruby-openaigem (alexrudall), which documents batches support: https://github.com/alexrudall/ruby-openai
Local repo files inspected
lib/braintrust/contrib/openai/patcher.rb— definesChatPatcher,ResponsesPatcher,ModerationsPatcher; noBatchesPatcherlib/braintrust/contrib/openai/instrumentation/— containschat.rb,responses.rb,moderations.rb,common.rb; nobatches.rblib/braintrust/contrib/ruby_openai/patcher.rb— same three patchers registered; no batches equivalentlib/braintrust/contrib/ruby_openai/instrumentation/— same file set as official gem integration; nobatches.rb- Grep for
batch,Batch,Batchesacrosslib/braintrust/contrib/openai/andlib/braintrust/contrib/ruby_openai/returns zero matches - Issue #169 (Anthropic Messages Batch API) and #193 (RubyLLM.batch) establish the precedent that batch-submission APIs are in-scope generative execution surfaces for this SDK
- 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
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 78/100
AllYourBot/hostedgpt#818 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
slovensko-digital/autogram-portal#392 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
voxpupuli/puppet-quadlets#122 · 5 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
TheOdinProject/curriculum#31452 ·
Maintainers usually reply within 1 day