[bot] OpenAI Batch API (`client.batches.create`) not instrumented (openai + ruby-openai gems)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- ruby
- 领域
- api, observability
调研方向
先从 lib/braintrust/contrib/openai/patcher.rb 及其 instrumentation 目录开始,然后比较 lib/braintrust/contrib/ruby_openai/ 下的对应文件。为两个集成中的 batches.create 调用添加覆盖,捕获列出的输入和元数据,同时将异步检索排除在范围之外;完成的标准是两个 gem 都提供与现有 patcher 一致的批次提交 instrumentation。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Ruby
- 星标
- 9
- 派生
- 11
- 平均合并
- 3 天 43 分钟
- 30 天内合并 PR
- 9
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
braintrustdata/braintrust-sdk-ruby 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
braintrustdata/braintrust-sdk-ruby#155 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
braintrustdata/braintrust-sdk-ruby#143 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
braintrustdata/braintrust-sdk-ruby#137 ·
维护者通常 1 天内回复
-
ruby
难度 3/5 半天 新手友好度 62/100
braintrustdata/braintrust-sdk-ruby#229 ·
维护者通常 1 天内回复
-
ruby
难度 3/5 1-2 天 新手友好度 45/100
braintrustdata/braintrust-sdk-ruby#228 ·
维护者通常 1 天内回复
查看 braintrustdata/braintrust-sdk-ruby 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
glossarist/glossarist-ruby#247 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
voxpupuli/puppet-corosync#589 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
theforeman/puppet-foreman_scap_client#93 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
simp/pupmod-simp-simp#406 ·