Skip to content

Commit 3e8eef8

Browse files
Annhiluccopybara-github
authored andcommitted
chore: Make discriminator properties required in Interactions
PiperOrigin-RevId: 872001330
1 parent 2ab5ea7 commit 3e8eef8

11 files changed

Lines changed: 23 additions & 23 deletions

google/genai/_interactions/types/content_delta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,13 @@ class DeltaFileSearchResultDelta(BaseModel):
338338

339339

340340
class ContentDelta(BaseModel):
341+
event_type: Literal["content.delta"]
342+
341343
delta: Optional[Delta] = None
342344

343345
event_id: Optional[str] = None
344346
"""
345347
The event_id token to be used to resume the interaction stream, from this event.
346348
"""
347349

348-
event_type: Optional[Literal["content.delta"]] = None
349-
350350
index: Optional[int] = None

google/genai/_interactions/types/content_start.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626

2727
class ContentStart(BaseModel):
28+
event_type: Literal["content.start"]
29+
2830
content: Optional[Content] = None
2931
"""The content of the response."""
3032

@@ -33,6 +35,4 @@ class ContentStart(BaseModel):
3335
The event_id token to be used to resume the interaction stream, from this event.
3436
"""
3537

36-
event_type: Optional[Literal["content.start"]] = None
37-
3838
index: Optional[int] = None

google/genai/_interactions/types/content_stop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525

2626
class ContentStop(BaseModel):
27+
event_type: Literal["content.stop"]
28+
2729
event_id: Optional[str] = None
2830
"""
2931
The event_id token to be used to resume the interaction stream, from this event.
3032
"""
3133

32-
event_type: Optional[Literal["content.stop"]] = None
33-
3434
index: Optional[int] = None

google/genai/_interactions/types/deep_research_agent_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class DeepResearchAgentConfig(BaseModel):
2727
"""Configuration for the Deep Research agent."""
2828

29+
type: Literal["deep-research"]
30+
2931
thinking_summaries: Optional[Literal["auto", "none"]] = None
3032
"""Whether to include thought summaries in the response."""
31-
32-
type: Optional[Literal["deep-research"]] = None

google/genai/_interactions/types/deep_research_agent_config_param.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, TypedDict
20+
from typing_extensions import Literal, Required, TypedDict
2121

2222
__all__ = ["DeepResearchAgentConfigParam"]
2323

2424

2525
class DeepResearchAgentConfigParam(TypedDict, total=False):
2626
"""Configuration for the Deep Research agent."""
2727

28+
type: Required[Literal["deep-research"]]
29+
2830
thinking_summaries: Literal["auto", "none"]
2931
"""Whether to include thought summaries in the response."""
30-
31-
type: Literal["deep-research"]

google/genai/_interactions/types/dynamic_agent_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18-
from typing import TYPE_CHECKING, Dict, Optional
18+
from typing import TYPE_CHECKING, Dict
1919
from typing_extensions import Literal
2020

2121
from pydantic import Field as FieldInfo
@@ -28,7 +28,7 @@
2828
class DynamicAgentConfig(BaseModel):
2929
"""Configuration for dynamic agents."""
3030

31-
type: Optional[Literal["dynamic"]] = None
31+
type: Literal["dynamic"]
3232

3333
if TYPE_CHECKING:
3434
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a

google/genai/_interactions/types/dynamic_agent_config_param.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
from __future__ import annotations
1919

2020
from typing import Dict, Union
21-
from typing_extensions import Literal, TypeAlias, TypedDict
21+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
2222

2323
__all__ = ["DynamicAgentConfigParam"]
2424

2525

2626
class DynamicAgentConfigParamTyped(TypedDict, total=False):
2727
"""Configuration for dynamic agents."""
2828

29-
type: Literal["dynamic"]
29+
type: Required[Literal["dynamic"]]
3030

3131

3232
DynamicAgentConfigParam: TypeAlias = Union[DynamicAgentConfigParamTyped, Dict[str, object]]

google/genai/_interactions/types/error_event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class Error(BaseModel):
3434

3535

3636
class ErrorEvent(BaseModel):
37+
event_type: Literal["error"]
38+
3739
error: Optional[Error] = None
3840
"""Error message from an interaction."""
3941

4042
event_id: Optional[str] = None
4143
"""
4244
The event_id token to be used to resume the interaction stream, from this event.
4345
"""
44-
45-
event_type: Optional[Literal["error"]] = None

google/genai/_interactions/types/interaction_complete_event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626

2727
class InteractionCompleteEvent(BaseModel):
28+
event_type: Literal["interaction.complete"]
29+
2830
event_id: Optional[str] = None
2931
"""
3032
The event_id token to be used to resume the interaction stream, from this event.
3133
"""
3234

33-
event_type: Optional[Literal["interaction.complete"]] = None
34-
3535
interaction: Optional[Interaction] = None
3636
"""The Interaction resource."""

google/genai/_interactions/types/interaction_start_event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626

2727
class InteractionStartEvent(BaseModel):
28+
event_type: Literal["interaction.start"]
29+
2830
event_id: Optional[str] = None
2931
"""
3032
The event_id token to be used to resume the interaction stream, from this event.
3133
"""
3234

33-
event_type: Optional[Literal["interaction.start"]] = None
34-
3535
interaction: Optional[Interaction] = None
3636
"""The Interaction resource."""

0 commit comments

Comments
 (0)