[bot] OpenAI legacy text completions API (`client.completions`) not instrumented
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 65/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- ruby
調査の方向性
まず lib/braintrust/contrib/openai/patcher.rb にある既存の ModerationsPatcher とその instrumentation ファイルを確認し、次に対応する ruby_openai の patcher と instrumentation ディレクトリを比較してください。従来のエンドポイントの形式を確認するには、test/fixtures/vcr_cassettes/alexrudall_ruby_openai/completions.yml を使用してください。完了条件は、両方のクライアントの completion メソッドが、記載された input、metadata、output、usage metrics を使って instrumented されていることです。
索引モデルが issue の本文から書いたものです。
説明
Summary
The OpenAI legacy text completions API (/v1/completions) is available in both the official openai gem and the ruby-openai gem but is not instrumented. This is the original OpenAI generation API, still used today for fine-tuned instruct models (gpt-3.5-turbo-instruct, babbage-002, davinci-002) and other text completion workflows. It is distinct from the chat completions API (/v1/chat/completions), which is already instrumented.
What is missing
Official openai gem
OpenAI::Resources::Completions exposes two generative execution methods, neither of which is patched:
client.completions.create(model:, prompt:, max_tokens:, temperature:, top_p:, n:, stop:, ...)— Synchronous text completion; returns aCompletionobject withchoices[].text,usage,model, andid.client.completions.create_streaming(model:, prompt:, ...)— Streaming variant; yields raw SSE chunks aggregating into the same final structure.
ruby-openai gem
OpenAI::Client exposes the equivalent via:
client.completions(parameters: { model:, prompt:, max_tokens:, ... })— Calls/v1/completionsdirectly. Accepts the same parameters as the official SDK.
What a span should capture
- Input: the
prompt(text string or array of strings/tokens) - Metadata:
model,max_tokens,temperature,top_p,n,stop,frequency_penalty,presence_penalty,seed,logprobs, provider, endpoint (/v1/completions) - Output:
choices[].textandfinish_reasonfor each completion choice - Metrics:
prompt_tokens,completion_tokens,total_tokensfrom theusageobject;time_to_first_token
The pattern is identical to the existing ModerationsPatcher — a new CompletionsPatcher wrapping create() and create_streaming() on the respective resource class.
Braintrust docs status
not_found — The Braintrust OpenAI integration docs at https://www.braintrust.dev/docs/integrations/ai-providers/openai and the tracing guide at https://www.braintrust.dev/docs/guides/tracing focus exclusively on chat completions. The legacy /v1/completions endpoint is not mentioned.
Upstream sources
- Official OpenAI Ruby SDK: https://github.com/openai/openai-ruby —
OpenAI::Resources::Completionswithcreateandcreate_streamingmethods inlib/openai/resources/completions.rb - OpenAI Legacy Completions API docs: https://platform.openai.com/docs/api-reference/completions — documents the endpoint, all parameters, and usage fields
ruby-openaigem: https://github.com/alexrudall/ruby-openai —client.completions(parameters: {})documented in the README
Local repo files inspected
lib/braintrust/contrib/openai/patcher.rb— definesChatPatcher,ResponsesPatcher,ModerationsPatcher; noCompletionsPatcherforOpenAI::Resources::Completionslib/braintrust/contrib/openai/instrumentation/— containschat.rb,responses.rb,moderations.rb,common.rb; nocompletions.rblib/braintrust/contrib/ruby_openai/patcher.rb— definesChatPatcher,ResponsesPatcher,ModerationsPatcher; noCompletionsPatcherlib/braintrust/contrib/ruby_openai/instrumentation/— containschat.rb,responses.rb,moderations.rb,common.rb; nocompletions.rbtest/fixtures/vcr_cassettes/alexrudall_ruby_openai/completions.yml— recorded cassette showing aPOST https://api.openai.com/v1/completionscall withgpt-3.5-turbo-instruct, confirming the endpoint is accessible via theruby-openaigem- Grep for
Completions(outside ofChat::Completions),instruct,/v1/completionsacrosslib/braintrust/returns zero instrumentation matches
- 主要言語
- Ruby
- スター
- 9
- フォーク
- 11
- 平均マージ
- 3日 43分
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
Dialog: clicking the panel's inner padding closes it (backdropClick matches the <dialog> itself)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Homebrew/homebrew-cask#295450 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
TheOdinProject/curriculum#31479 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
taskcluster/taskcluster#9284 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信