Skip to content

Commit d40ca70

Browse files
MarkDaoustcopybara-github
authored andcommitted
feat: support continuation_token in Interactions
PiperOrigin-RevId: 992400851
1 parent 1e8c0cc commit d40ca70

5 files changed

Lines changed: 86 additions & 0 deletions

File tree

‎google/genai/_gaos/interactions.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def create(
6666
api_version: Optional[str] = None,
6767
background: bool = ...,
6868
cached_content: str = ...,
69+
continuation_token: str = ...,
6970
environment: interactions.CreateModelInteractionEnvironmentParam = ...,
7071
generation_config: interactions.GenerationConfigParam = ...,
7172
input: interactions.InteractionsInputParam = ...,
@@ -92,6 +93,9 @@ def create(
9293
:param api_version: API version for request routing.
9394
:param background: Input only. Whether to run the model interaction in the background.
9495
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
96+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
97+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
98+
back unchanged in CreateInteraction to continue decoding.
9599
:param environment: The environment configuration for the interaction. Can be an object
96100
specifying remote environment sources or a string referencing an existing
97101
environment ID.
@@ -129,6 +133,7 @@ def create(
129133
api_version: Optional[str] = None,
130134
background: bool = ...,
131135
cached_content: str = ...,
136+
continuation_token: str = ...,
132137
environment: interactions.CreateModelInteractionEnvironmentParam = ...,
133138
generation_config: interactions.GenerationConfigParam = ...,
134139
input: interactions.InteractionsInputParam = ...,
@@ -155,6 +160,9 @@ def create(
155160
:param api_version: API version for request routing.
156161
:param background: Input only. Whether to run the model interaction in the background.
157162
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
163+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
164+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
165+
back unchanged in CreateInteraction to continue decoding.
158166
:param environment: The environment configuration for the interaction. Can be an object
159167
specifying remote environment sources or a string referencing an existing
160168
environment ID.
@@ -193,6 +201,7 @@ def create(
193201
agent: interactions.AgentOption,
194202
agent_config: interactions.CreateAgentInteractionAgentConfigParam = ...,
195203
background: bool = ...,
204+
continuation_token: str = ...,
196205
environment: interactions.CreateAgentInteractionEnvironmentParam = ...,
197206
input: interactions.InteractionsInputParam = ...,
198207
labels: Dict[str, str] = ...,
@@ -218,6 +227,9 @@ def create(
218227
:param agent: The agent to interact with.
219228
:param agent_config: Configuration parameters for the agent interaction.
220229
:param background: Input only. Whether to run the model interaction in the background.
230+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
231+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
232+
back unchanged in CreateInteraction to continue decoding.
221233
:param environment: The environment configuration for the interaction. Can be an object
222234
specifying remote environment sources or a string referencing an existing
223235
environment ID.
@@ -254,6 +266,7 @@ def create(
254266
agent: interactions.AgentOption,
255267
agent_config: interactions.CreateAgentInteractionAgentConfigParam = ...,
256268
background: bool = ...,
269+
continuation_token: str = ...,
257270
environment: interactions.CreateAgentInteractionEnvironmentParam = ...,
258271
input: interactions.InteractionsInputParam = ...,
259272
labels: Dict[str, str] = ...,
@@ -279,6 +292,9 @@ def create(
279292
:param agent: The agent to interact with.
280293
:param agent_config: Configuration parameters for the agent interaction.
281294
:param background: Input only. Whether to run the model interaction in the background.
295+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
296+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
297+
back unchanged in CreateInteraction to continue decoding.
282298
:param environment: The environment configuration for the interaction. Can be an object
283299
specifying remote environment sources or a string referencing an existing
284300
environment ID.
@@ -326,6 +342,9 @@ def create(
326342
:param api_version: API version for request routing.
327343
:param background: Input only. Whether to run the model interaction in the background.
328344
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
345+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
346+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
347+
back unchanged in CreateInteraction to continue decoding.
329348
:param environment: The environment configuration for the interaction. Can be an object
330349
specifying remote environment sources or a string referencing an existing
331350
environment ID.
@@ -376,6 +395,9 @@ def create(
376395
:param api_version: API version for request routing.
377396
:param background: Input only. Whether to run the model interaction in the background.
378397
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
398+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
399+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
400+
back unchanged in CreateInteraction to continue decoding.
379401
:param environment: The environment configuration for the interaction. Can be an object
380402
specifying remote environment sources or a string referencing an existing
381403
environment ID.
@@ -1313,6 +1335,7 @@ async def create(
13131335
api_version: Optional[str] = None,
13141336
background: bool = ...,
13151337
cached_content: str = ...,
1338+
continuation_token: str = ...,
13161339
environment: interactions.CreateModelInteractionEnvironmentParam = ...,
13171340
generation_config: interactions.GenerationConfigParam = ...,
13181341
input: interactions.InteractionsInputParam = ...,
@@ -1339,6 +1362,9 @@ async def create(
13391362
:param api_version: API version for request routing.
13401363
:param background: Input only. Whether to run the model interaction in the background.
13411364
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
1365+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1366+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1367+
back unchanged in CreateInteraction to continue decoding.
13421368
:param environment: The environment configuration for the interaction. Can be an object
13431369
specifying remote environment sources or a string referencing an existing
13441370
environment ID.
@@ -1376,6 +1402,7 @@ async def create(
13761402
api_version: Optional[str] = None,
13771403
background: bool = ...,
13781404
cached_content: str = ...,
1405+
continuation_token: str = ...,
13791406
environment: interactions.CreateModelInteractionEnvironmentParam = ...,
13801407
generation_config: interactions.GenerationConfigParam = ...,
13811408
input: interactions.InteractionsInputParam = ...,
@@ -1402,6 +1429,9 @@ async def create(
14021429
:param api_version: API version for request routing.
14031430
:param background: Input only. Whether to run the model interaction in the background.
14041431
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
1432+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1433+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1434+
back unchanged in CreateInteraction to continue decoding.
14051435
:param environment: The environment configuration for the interaction. Can be an object
14061436
specifying remote environment sources or a string referencing an existing
14071437
environment ID.
@@ -1440,6 +1470,7 @@ async def create(
14401470
agent: interactions.AgentOption,
14411471
agent_config: interactions.CreateAgentInteractionAgentConfigParam = ...,
14421472
background: bool = ...,
1473+
continuation_token: str = ...,
14431474
environment: interactions.CreateAgentInteractionEnvironmentParam = ...,
14441475
input: interactions.InteractionsInputParam = ...,
14451476
labels: Dict[str, str] = ...,
@@ -1465,6 +1496,9 @@ async def create(
14651496
:param agent: The agent to interact with.
14661497
:param agent_config: Configuration parameters for the agent interaction.
14671498
:param background: Input only. Whether to run the model interaction in the background.
1499+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1500+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1501+
back unchanged in CreateInteraction to continue decoding.
14681502
:param environment: The environment configuration for the interaction. Can be an object
14691503
specifying remote environment sources or a string referencing an existing
14701504
environment ID.
@@ -1501,6 +1535,7 @@ async def create(
15011535
agent: interactions.AgentOption,
15021536
agent_config: interactions.CreateAgentInteractionAgentConfigParam = ...,
15031537
background: bool = ...,
1538+
continuation_token: str = ...,
15041539
environment: interactions.CreateAgentInteractionEnvironmentParam = ...,
15051540
input: interactions.InteractionsInputParam = ...,
15061541
labels: Dict[str, str] = ...,
@@ -1526,6 +1561,9 @@ async def create(
15261561
:param agent: The agent to interact with.
15271562
:param agent_config: Configuration parameters for the agent interaction.
15281563
:param background: Input only. Whether to run the model interaction in the background.
1564+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1565+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1566+
back unchanged in CreateInteraction to continue decoding.
15291567
:param environment: The environment configuration for the interaction. Can be an object
15301568
specifying remote environment sources or a string referencing an existing
15311569
environment ID.
@@ -1573,6 +1611,9 @@ async def create(
15731611
:param api_version: API version for request routing.
15741612
:param background: Input only. Whether to run the model interaction in the background.
15751613
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
1614+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1615+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1616+
back unchanged in CreateInteraction to continue decoding.
15761617
:param environment: The environment configuration for the interaction. Can be an object
15771618
specifying remote environment sources or a string referencing an existing
15781619
environment ID.
@@ -1623,6 +1664,9 @@ async def create(
16231664
:param api_version: API version for request routing.
16241665
:param background: Input only. Whether to run the model interaction in the background.
16251666
:param cached_content: The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}
1667+
:param continuation_token: Opaque token to resume a long decode. Output: set when status is
1668+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
1669+
back unchanged in CreateInteraction to continue decoding.
16261670
:param environment: The environment configuration for the interaction. Can be an object
16271671
specifying remote environment sources or a string referencing an existing
16281672
environment ID.

‎google/genai/_gaos/types/interactions/createagentinteraction.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ class CreateAgentInteractionParam(TypedDict):
109109
r"""Configuration parameters for the agent interaction."""
110110
background: NotRequired[bool]
111111
r"""Input only. Whether to run the model interaction in the background."""
112+
continuation_token: NotRequired[str]
113+
r"""Opaque token to resume a long decode. Output: set when status is
114+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
115+
back unchanged in CreateInteraction to continue decoding.
116+
"""
112117
environment: NotRequired[CreateAgentInteractionEnvironmentParam]
113118
r"""The environment configuration for the interaction. Can be an object
114119
specifying remote environment sources or a string referencing an existing
@@ -161,6 +166,12 @@ class CreateAgentInteraction(BaseModel):
161166
background: Optional[bool] = None
162167
r"""Input only. Whether to run the model interaction in the background."""
163168

169+
continuation_token: Optional[str] = None
170+
r"""Opaque token to resume a long decode. Output: set when status is
171+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
172+
back unchanged in CreateInteraction to continue decoding.
173+
"""
174+
164175
environment: Optional[CreateAgentInteractionEnvironment] = None
165176
r"""The environment configuration for the interaction. Can be an object
166177
specifying remote environment sources or a string referencing an existing
@@ -229,6 +240,7 @@ def serialize_model(self, handler):
229240
[
230241
"agent_config",
231242
"background",
243+
"continuation_token",
232244
"environment",
233245
"input",
234246
"labels",

‎google/genai/_gaos/types/interactions/createmodelinteraction.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class CreateModelInteractionParam(TypedDict):
7979
r"""Input only. Whether to run the model interaction in the background."""
8080
cached_content: NotRequired[str]
8181
r"""The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}"""
82+
continuation_token: NotRequired[str]
83+
r"""Opaque token to resume a long decode. Output: set when status is
84+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
85+
back unchanged in CreateInteraction to continue decoding.
86+
"""
8287
environment: NotRequired[CreateModelInteractionEnvironmentParam]
8388
r"""The environment configuration for the interaction. Can be an object
8489
specifying remote environment sources or a string referencing an existing
@@ -138,6 +143,12 @@ class CreateModelInteraction(BaseModel):
138143
] = None
139144
r"""The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}"""
140145

146+
continuation_token: Optional[str] = None
147+
r"""Opaque token to resume a long decode. Output: set when status is
148+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
149+
back unchanged in CreateInteraction to continue decoding.
150+
"""
151+
141152
environment: Optional[CreateModelInteractionEnvironment] = None
142153
r"""The environment configuration for the interaction. Can be an object
143154
specifying remote environment sources or a string referencing an existing
@@ -209,6 +220,7 @@ def _serialize_model(self, handler):
209220
[
210221
"background",
211222
"cached_content",
223+
"continuation_token",
212224
"environment",
213225
"generation_config",
214226
"input",

‎google/genai/_gaos/types/interactions/interaction.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ class InteractionTypedDict(TypedDict):
166166
r"""Configuration parameters for the agent interaction."""
167167
cached_content: NotRequired[str]
168168
r"""The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}"""
169+
continuation_token: NotRequired[str]
170+
r"""Opaque token to resume a long decode. Output: set when status is
171+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
172+
back unchanged in CreateInteraction to continue decoding.
173+
"""
169174
created: NotRequired[str]
170175
r"""Required. Output only. The time at which the response was created in ISO 8601 format
171176
(YYYY-MM-DDThh:mm:ssZ).
@@ -257,6 +262,12 @@ class Interaction(BaseModel):
257262
] = None
258263
r"""The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: cachedContents/{cachedContent}"""
259264

265+
continuation_token: Optional[str] = None
266+
r"""Opaque token to resume a long decode. Output: set when status is
267+
INCOMPLETE and decoding can be resumed. Input: pass the latest token
268+
back unchanged in CreateInteraction to continue decoding.
269+
"""
270+
260271
created: Optional[str] = None
261272
r"""Required. Output only. The time at which the response was created in ISO 8601 format
262273
(YYYY-MM-DDThh:mm:ssZ).
@@ -368,6 +379,7 @@ def _serialize_model(self, handler):
368379
"agent",
369380
"agent_config",
370381
"cached_content",
382+
"continuation_token",
371383
"created",
372384
"environment",
373385
"environment_id",

0 commit comments

Comments
 (0)