[BOT ISSUE] OpenAI Images API 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
- Clearly specified
- Activity status
- Quiet
- Tech stack
- ruby
- Domain
- observability
Research direction
Start with the existing patchers in lib/braintrust/contrib/openai/patcher.rb and lib/braintrust/contrib/ruby_openai/patcher.rb, then compare their instrumentation files for the ModerationsPatcher pattern. The missing work is scoped to adding image instrumentation for the listed generate, edit, and variation methods in both gems. Done means spans capture the requested prompt, metadata, image URL or metadata output, and revised_prompt without recording binary image data.
Written by the indexing model from the issue text.
Description
Summary
The OpenAI Images API (client.images.generate) is available in both the official openai gem and the ruby-openai gem, but is not instrumented by this SDK. Image generation (DALL-E, gpt-image-1) is a stable generative AI API that creates images from text prompts. This is the same class of gap as the already-filed audio API issue (#146), and is distinct from the RubyLLM paint() gap (#136) which covers a different library.
What is missing
Official openai gem
Three resource methods under OpenAI::Resources::Images:
client.images.generate(...)— Text-to-image generation using DALL-E 3 or gpt-image-1. Accepts prompt, model, size, quality, style, n, response_format, background, output_format, output_compression, and more. Returns typedOpenAI::Models::ImagesResponse.client.images.edit(...)— Image editing with text prompts. Accepts image file + prompt + mask.client.images.create_variation(...)— Image variations from an existing image.
The official SDK also has streaming variants (generate_stream_raw, edit_stream_raw).
ruby-openai gem
Equivalent methods with hash-based parameters:
client.images.generate(parameters: { prompt:, model:, size:, quality:, ... })client.images.edit(parameters: { ... })client.images.variations(parameters: { ... })
Documented in the README with DALL-E 2 and DALL-E 3 examples.
Expected instrumentation
A new ImagesPatcher (following the existing ModerationsPatcher pattern) for each gem:
Image generation spans should capture:
- Input: the text prompt
- Metadata: model (e.g.,
dall-e-3,gpt-image-1), size, quality, style, n, response_format, provider, endpoint - Output: image URL(s) or metadata (not the binary/base64 image data itself)
- Metrics: revised_prompt (when the model modifies the original prompt)
Braintrust docs status
not_found — Braintrust docs at https://www.braintrust.dev/docs/guides/tracing and the integrations pages do not mention image generation instrumentation. All examples focus on chat completions, embeddings, and audio.
Upstream sources
- Official OpenAI Ruby SDK: https://github.com/openai/openai-ruby —
OpenAI::Resources::Imagesclass withgenerate,edit,create_variationmethods - OpenAI Images API docs: https://platform.openai.com/docs/api-reference/images
- ruby-openai gem: https://github.com/alexrudall/ruby-openai —
client.images.generate(parameters: {})documented in README
Local repo files inspected
lib/braintrust/contrib/openai/patcher.rb— definesChatPatcher,ResponsesPatcher,ModerationsPatcherbut noImagesPatcherlib/braintrust/contrib/openai/instrumentation/— containschat.rb,responses.rb,moderations.rbbut noimages.rblib/braintrust/contrib/ruby_openai/patcher.rb— definesChatPatcher,ResponsesPatcher,ModerationsPatcherbut noImagesPatcherlib/braintrust/contrib/ruby_openai/instrumentation/— containschat.rb,responses.rb,moderations.rbbut noimages.rb- Grep for
images,dall,ImagesPatcheracrosslib/braintrust/returns zero relevant matches
- 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 ·