Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[bot] OpenAI Batch API (`client.batches.create`) not instrumented (openai + ruby-openai gems)

未关闭
#196 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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), batch id, status on creation, any request-level metadata param
  • Metrics: request_counts once available (total/completed/failed), latency of the create call

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

Local repo files inspected

  • lib/braintrust/contrib/openai/patcher.rb — defines ChatPatcher, ResponsesPatcher, ModerationsPatcher; no BatchesPatcher
  • lib/braintrust/contrib/openai/instrumentation/ — contains chat.rb, responses.rb, moderations.rb, common.rb; no batches.rb
  • lib/braintrust/contrib/ruby_openai/patcher.rb — same three patchers registered; no batches equivalent
  • lib/braintrust/contrib/ruby_openai/instrumentation/ — same file set as official gem integration; no batches.rb
  • Grep for batch, Batch, Batches across lib/braintrust/contrib/openai/ and lib/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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

braintrustdata/braintrust-sdk-ruby 的其他 Issue

查看 braintrustdata/braintrust-sdk-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。