googleapis / googleapis/python-genai

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

Đang mở
#2,425 1 bình luận 0 reaction 1 người được giao Được @Venkaiahbabuneelam nhận Xem trên GitHub
priority: p3 type: feature request
Ngôn ngữ chính
Python
Star
4k
Fork
1k
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
40

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.