BaseChannel.send_response docstring promises async-generator streaming that four of the five channels raise TypeError on

オープン
#136 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
50/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
documentation

調査の方向性

The docstring to change is BaseChannel.send_response in src/tac/channels/base.py (lines 90-105), which says it supports async-generator streaming unconditionally. Compare it with the Raises: block in MessagingChannel.send_response in src/tac/channels/messaging.py (lines 208-220), and check voice/provider.py:95 for the per-provider behaviour. Done means the base docstring no longer promises generators on every channel. The issue says the exact wording is the maintainers' call, so confirm it with them before editing.

索引モデルが issue の本文から書いたものです。

説明

Summary

BaseChannel.send_response's docstring states that generator streaming is supported, with no qualification. Four of the five concrete channels raise TypeError when given one.

The docstring one file over — MessagingChannel.send_response — already states the restriction correctly, including a Raises: block. So this is an internal contradiction with the fix already drafted in your own source, rather than a request for new documentation.

All line references are at 2c24bd98, read 2026-10-09.

The abstract base asserts it unconditionally

src/tac/channels/base.py:90-105:

@abstractmethod
async def send_response(
    self,
    conversation_id: str,
    response: str | AsyncGenerator[str | dict[str, Any], None],
    role: str | None = None,
) -> None:
    """
    Send response back through the channel.

    Supports both simple string responses and streaming via async generators.
    ...

Four of five channels raise

src/tac/channels/messaging.py:218-220:

channel_name = self.get_channel_name()
if not isinstance(response, str):
    raise TypeError(f"{channel_name} channel only supports string responses")

SMSChannel, RCSChannel, WhatsAppChannel and ChatChannel all subclass MessagingChannel, and none of them overrides send_response — measured over every file under src/tac/channels/, which contains exactly two channel-level send_response definitions (the abstract one in base.py and the concrete one in messaging.py) plus voice/channel.py's delegation.

So the type and the base docstring both advertise a parameter shape that raises on four of the five channels a user can reach.

The correct wording already exists in this repo

src/tac/channels/messaging.py:208-215 — same method, overriding class:

response: Message content. Must be str — messaging channels send a single complete message via the Conversation Orchestrator Send API and do not support streaming (unlike the Voice channel).

Raises: TypeError: If response is not a string (e.g. an async generator is passed, since messaging channels don't support streaming)

That is accurate, and it is the text the base class is missing.

Suggested change

Qualify base.py:99 so the base does not promise what most implementations refuse — for example:

Supports simple string responses on every channel. Streaming via async generators is supported only where the channel's provider implements it; MessagingChannel and its subclasses raise TypeError for a generator, and voice support depends on the configured provider.

A narrower variant, if you would rather not describe subclass behaviour in the base: drop the "Supports both ..." sentence and point at the implementing class.

One related observation, offered rather than asserted as a defect

Voice support is also per-provider rather than per-channel, so "streaming is a voice capability" is not quite the invariant either. VoiceChannel.send_response (voice/channel.py:502) delegates to its provider; voice/provider.py:95 raises NotImplementedError by default, and media_streams/shared/openai_provider.py:223-233 raises for a string and a generator, with a clear reason in its docstring ("the model streams audio to Twilio directly, so there is no text response for this provider to send").

That design seems deliberate and reads well — mentioning it only because any rewording of the base docstring will want to account for it.

Why an issue and not a pull request

These are docstrings in hand-written source, so a PR would be mechanically simple. Filing as an issue because the right wording is a judgement about what the base class means to promise, which is yours rather than ours.

Context

We maintain a cross-provider specification of the TAC response-streaming contract and read connector source to verify each claim in it. This came out of promoting that document's unverified assertions to quoted-source ones, and the original claim — that a connector satisfies TAC by returning a string or an async generator — turned out to be the one that did not survive.

主要言語
Python
スター
17
フォーク
11
平均マージ
5日 19時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

twilio/twilio-agent-connect-python のほかの issue

twilio/twilio-agent-connect-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。