Skip to content

Commit 8a3afd6

Browse files
Annhiluccopybara-github
authored andcommitted
chore: Update Interactions client
PiperOrigin-RevId: 874147228
1 parent fe86870 commit 8a3afd6

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

google/genai/_interactions/_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
167167
),
168168
response=self.http_response,
169169
client=cast(Any, self._client),
170+
options=self._options,
170171
),
171172
)
172173

@@ -177,6 +178,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
177178
cast_to=extract_stream_chunk_type(self._stream_cls),
178179
response=self.http_response,
179180
client=cast(Any, self._client),
181+
options=self._options,
180182
),
181183
)
182184

@@ -190,6 +192,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
190192
cast_to=cast_to,
191193
response=self.http_response,
192194
client=cast(Any, self._client),
195+
options=self._options,
193196
),
194197
)
195198

google/genai/_interactions/_streaming.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020
import inspect
2121
from 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
2323
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable
2424

2525
import httpx
@@ -28,6 +28,7 @@
2828

2929
if 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

Comments
 (0)