googleapis / googleapis/python-genai

Expose a transport-level `cancel`/`close` handle on async streaming responses (so they can be cancelled from another task)

オープン
#2,425 コメント 1 件 リアクション 0 件 担当者 1 名 @Venkaiahbabuneelam が担当を希望しています GitHub で見る
priority: p3 type: feature request
主要言語
Python
スター
4k
フォーク
1k
平均マージ
2日 11時間
マージ済み PR(30日)
40

説明

While working on https://github.com/pydantic/pydantic-ai/issues/1524 I hit: generate_content_stream only exposes the generator, so cancelling it from another task while we're iterating raises `RuntimeError`: `aclose(): asynchronous generator is already running`.

**Describe the solution you'd like**
A transport handler we could close with or cancel with would be great

**Describe alternatives you've considered**
There are some things we could do to maybe mimic this but given that most SDKs have this it would be nice if `genai` did too

**Additional context**
I have just added a small warning for now.
https://pydantic.dev/docs/ai/models/google/#streaming-cancellation

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

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

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