1919import json
2020import inspect
2121from types import TracebackType
22- from typing import TYPE_CHECKING , Any , Generic , TypeVar , Iterator , AsyncIterator , cast
22+ from typing import TYPE_CHECKING , Any , Generic , TypeVar , Iterator , Optional , AsyncIterator , cast
2323from typing_extensions import Self , Protocol , TypeGuard , override , get_origin , runtime_checkable
2424
2525import httpx
2828
2929if TYPE_CHECKING :
3030 from ._client import GeminiNextGenAPIClient , AsyncGeminiNextGenAPIClient
31+ from ._models import FinalRequestOptions
3132
3233
3334_T = TypeVar ("_T" )
@@ -37,7 +38,7 @@ class Stream(Generic[_T]):
3738 """Provides the core interface to iterate over a synchronous stream response."""
3839
3940 response : httpx .Response
40-
41+ _options : Optional [ FinalRequestOptions ] = None
4142 _decoder : SSEBytesDecoder
4243
4344 def __init__ (
@@ -46,10 +47,12 @@ def __init__(
4647 cast_to : type [_T ],
4748 response : httpx .Response ,
4849 client : GeminiNextGenAPIClient ,
50+ options : Optional [FinalRequestOptions ] = None ,
4951 ) -> None :
5052 self .response = response
5153 self ._cast_to = cast_to
5254 self ._client = client
55+ self ._options = options
5356 self ._decoder = client ._make_sse_decoder ()
5457 self ._iterator = self .__stream__ ()
5558
@@ -103,7 +106,7 @@ class AsyncStream(Generic[_T]):
103106 """Provides the core interface to iterate over an asynchronous stream response."""
104107
105108 response : httpx .Response
106-
109+ _options : Optional [ FinalRequestOptions ] = None
107110 _decoder : SSEDecoder | SSEBytesDecoder
108111
109112 def __init__ (
@@ -112,10 +115,12 @@ def __init__(
112115 cast_to : type [_T ],
113116 response : httpx .Response ,
114117 client : AsyncGeminiNextGenAPIClient ,
118+ options : Optional [FinalRequestOptions ] = None ,
115119 ) -> None :
116120 self .response = response
117121 self ._cast_to = cast_to
118122 self ._client = client
123+ self ._options = options
119124 self ._decoder = client ._make_sse_decoder ()
120125 self ._iterator = self .__stream__ ()
121126
0 commit comments