OpenAI Responses API: publish the output message phase at response.output_item.added
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- ai, backend-api-design
調査の方向性
livekit/agents/llm/_responses_engine.pyから始め、イベントの解析とフェーズの出力を行う箇所として issue が示している _parse_ws_event と _handle_output_items_done を読みます。フェーズが null でないメッセージ項目について response.output_item.added を処理し、両方の Responses LLM 統合が共有エンジンを使用しているか確認します。フェーズチャンクがテキストデルタより前に利用可能になれば完了です。イベントの順序とフェーズ処理に焦点を当てたテストを追加または更新します。
索引モデルが issue の本文から書いたものです。
説明
Feature Type
Would make my life easier
Feature Description
Problem
The OpenAI Responses API marks each output message with a phase (commentary or final_answer), and the phase is already set when the item starts (response.output_item.added). ResponsesLLMStream ignores that event. It sends the phase only from response.output_item.done, after all of that item's text deltas:
- _parse_ws_event (https://github.com/livekit/agents/blob/055744e1505b1489976d06ca029b3001bc91ea55/livekit-agents/livekit/agents/llm/_responses_engine.py#L408-L430) returns None for response.output_item.added.
- _handle_output_items_done (https://github.com/livekit/agents/blob/055744e1505b1489976d06ca029b3001bc91ea55/livekit-agents/livekit/agents/llm/_responses_engine.py#L567-L577) is where the phase chunk is sent.
So an agent that wants to speak only the final_answer (for example, by filtering in llm_node) can't tell an item's phase while its text streams. It has to buffer each item until the item ends before sending the text to TTS. In our traffic this adds about 0.3 s on average to each response of two or more sentences.
Proposal
Handle response.output_item.added. When the item is a ResponseOutputMessage with a non-null phase, send the existing phase chunk (ChoiceDelta(extra={"openai": {"phase": ...}})) right away. Optionally keep sending it at done as well, for backward compatibility.
The stream is ordered (added, then deltas, then done), so each text delta belongs to the most recent phase. The filter then becomes simple:
async def llm_node(self, chat_ctx, tools, model_settings):
phase = None
async for chunk in Agent.default.llm_node(self, chat_ctx, tools, model_settings):
if isinstance(chunk, llm.ChatChunk) and chunk.delta:
phase = (chunk.delta.extra or {}).get("openai", {}).get("phase") or phase
if chunk.delta.content and phase == "commentary":
continue
yield chunk
The change affects both openai.responses.LLM and inference.responses.LLM, since they share _responses_engine.py.
Workarounds / Alternatives
No response
Additional Context
No response
- 主要言語
- Python
- スター
- 14.6k
- フォーク
- 3.9k
- 平均マージ
- 3日
- マージ済み PR(30日)
- 262
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
livekit/agents のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
livekit/agents#8366 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
livekit/agents#8284 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ci: unit tests pin Python 3.12 while the package advertises 3.14 support再び着手できるかも @huong8373tt-beep が 8 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
livekit/agents#8231 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Assistant markup is stripped from chat history when expressive mode is off対応中かも @ShivamSharma43 が 30 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
livekit/agents#7647 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
docs: openai.LLM vs openai.responses.LLM for HTTP OpenAI-compat hosts再び着手できるかも @AbarnaaSree が 69 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
livekit/agents#7022 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
[BUG]: Compliance rules never see Unity Catalog views as views対応中かも @wagnercsantos が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
databrickslabs/ontos#1348 ·
メンテナーはふだん 3 日以内に返信
-
`forum_pr_poster` action will always return `none` when checking for pre-existing feedback threads, even if a feedback thread already exists.対応中かも @pgmzeta が今日担当しました。 オープンE-Verified P-Major
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
goonstation/goonstation#28259 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
woonstadrotterdam/monumenten#70 ·
メンテナーはふだん 15 日以内に返信
-
binding:python bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
The Browser tab fails with a Wayland error when Open Terminal runs from a Wayland desktop sessionオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-webui/open-terminal#210 ·