Skip to content

Commit daac53e

Browse files
Annhiluccopybara-github
authored andcommitted
feat: Add support for continuation_token and requires_continuation status
PiperOrigin-RevId: 1008345991
1 parent 9e83f8f commit daac53e

7 files changed

Lines changed: 89 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
98+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
165+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
232+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
297+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
347+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
400+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1367+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1434+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1501+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1566+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1616+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
1669+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
115+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
172+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
85+
token 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+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
149+
token 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class UnknownInteractionAgentConfig(BaseModel):
149149
"incomplete",
150150
"budget_exceeded",
151151
"queued",
152+
"requires_continuation",
152153
],
153154
UnrecognizedStr,
154155
]
@@ -166,6 +167,11 @@ class InteractionTypedDict(TypedDict):
166167
r"""Configuration parameters for the agent interaction."""
167168
cached_content: NotRequired[str]
168169
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}"""
170+
continuation_token: NotRequired[str]
171+
r"""Opaque token to resume a long decode. Output: set when status is
172+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
173+
token back unchanged in CreateInteraction to continue decoding.
174+
"""
169175
created: NotRequired[str]
170176
r"""Required. Output only. The time at which the response was created in ISO 8601 format
171177
(YYYY-MM-DDThh:mm:ssZ).
@@ -257,6 +263,12 @@ class Interaction(BaseModel):
257263
] = None
258264
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}"""
259265

266+
continuation_token: Optional[str] = None
267+
r"""Opaque token to resume a long decode. Output: set when status is
268+
REQUIRES_CONTINUATION and decoding can be resumed. Input: pass the latest
269+
token back unchanged in CreateInteraction to continue decoding.
270+
"""
271+
260272
created: Optional[str] = None
261273
r"""Required. Output only. The time at which the response was created in ISO 8601 format
262274
(YYYY-MM-DDThh:mm:ssZ).
@@ -368,6 +380,7 @@ def _serialize_model(self, handler):
368380
"agent",
369381
"agent_config",
370382
"cached_content",
383+
"continuation_token",
371384
"created",
372385
"environment",
373386
"environment_id",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"incomplete",
3838
"budget_exceeded",
3939
"queued",
40+
"requires_continuation",
4041
],
4142
UnrecognizedStr,
4243
]

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"incomplete",
3939
"budget_exceeded",
4040
"queued",
41+
"requires_continuation",
4142
],
4243
UnrecognizedStr,
4344
]

0 commit comments

Comments
 (0)