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

[bot] OpenAI: Realtime API (`client.realtime.connect()`) has zero instrumentation

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

The missing instrumentation is for the OpenAI Python SDK's Realtime API (client.realtime.connect()). Start by examining the existing patchers in py/src/braintrust/integrations/openai/patchers.py and the integration setup in integration.py. Review the upstream OpenAI SDK's realtime module to understand the connection manager and event flow. The goal is to add a new patcher for the realtime resource, creating spans for the WebSocket session and individual events, similar to the existing Responses API instrumentation. Testing will involve verifying the new spans appear when using the realtime API.

由索引模型根据 Issue 内容生成。

描述

Summary

The OpenAI Python SDK's top-level Realtime/AsyncRealtime resource (client.realtime.connect() / client.realtime.client_secrets / client.realtime.calls) — the GA WebSocket API for real-time audio/text/tool-use sessions — has no instrumentation anywhere in this repo. This is a distinct, self-contained SDK surface from client.responses.connect() (already tracked in #188): it lives in its own module with its own connection manager and does not share implementation with the Responses API's websocket transport.

What is missing

py/src/braintrust/integrations/openai/integration.py registers exactly these patchers:

patchers = (
    AgentsSessionsPatcher,
    ChatCompletionsPatcher,
    EmbeddingsPatcher,
    ModerationsPatcher,
    AudioSpeechPatcher,
    AudioTranscriptionsPatcher,
    AudioTranslationsPatcher,
    ImagesPatcher,
    ResponsesPatcher,
)

py/src/braintrust/integrations/openai/patchers.py's _WRAP_TARGETS registry (the authoritative list of every OpenAI SDK method this repo patches) contains no realtime entry:

_WRAP_TARGETS: tuple[tuple[str, type[CompositeFunctionWrapperPatcher]], ...] = (
    ("beta.agents.sessions", _WrapAgentsSessions),
    ("chat.completions", _WrapChatCompletions),
    ("embeddings", _WrapEmbeddings),
    ("moderations", _WrapModerations),
    ("audio.speech", _WrapAudioSpeech),
    ("audio.transcriptions", _WrapAudioTranscriptions),
    ("audio.translations", _WrapAudioTranslations),
    ("images", _WrapImages),
    ("responses", _WrapResponses),
    ("responses.with_raw_response", _WrapResponsesRaw),
    ("beta.chat.completions", _WrapChatCompletions),
)

A case-insensitive search for "realtime" across the entire py/src/braintrust tree returns zero hits related to OpenAI's Realtime API (the only matches are unrelated "real-time" prose in other integrations/docs). At minimum, instrumentation should provide a session-level span for connect() (model config, duration, aggregate usage) and turn/tool-call spans for events sent/received over the WebSocket connection, mirroring the pattern already used for streaming responses.

Braintrust docs status: not_found

The OpenAI integration page documents Chat Completions, Responses, Embeddings, Moderation, Batch, and the Agents API as traced. It does not describe any tracing support for the Realtime API or client.realtime/connect() — the only "realtime" mention on the page is a cookbook link title ("Evaluating audio with the OpenAI Realtime API"), with no SDK-level tracing detail.

Upstream sources

Local repo files inspected

  • py/src/braintrust/integrations/openai/integration.py (full file)
  • py/src/braintrust/integrations/openai/patchers.py (_WRAP_TARGETS registry)
  • Repo-wide case-insensitive grep for realtime across py/src/braintrust
主要语言
Python
星标
19
派生
17
平均合并
1 天 5 小时
30 天内合并 PR
61

贡献指南

打开贡献指南

从这里开始

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

braintrustdata/braintrust-sdk-python 的其他 Issue

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

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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