Skip to content

Commit 4e08932

Browse files
Annhiluccopybara-github
authored andcommitted
chore: Change MIME type fields from string to enums
PiperOrigin-RevId: 853416159
1 parent 132d104 commit 4e08932

File tree

10 files changed

+62
-62
lines changed

10 files changed

+62
-62
lines changed

google/genai/_interactions/_exceptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class APIError(GeminiNextGenAPIClientError):
4444
body: object | None
4545
"""The API response body.
4646
47-
If the API responded with a valid JSON structure then this property will be the decoded result.
47+
If the API responded with a valid JSON structure then this property will be the
48+
decoded result.
4849
4950
If it isn't a valid JSON structure then this will be the raw response.
5051

google/genai/_interactions/resources/interactions.py

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def create(
102102
103103
previous_interaction_id: The ID of the previous interaction, if any.
104104
105-
response_format: Enforces that the generated response is a JSON object that complies with
106-
the JSON schema specified in this field.
105+
response_format: Enforces that the generated response is a JSON object that complies with the
106+
JSON schema specified in this field.
107107
108108
response_mime_type: The mime type of the response. This is required if response_format is set.
109109
@@ -167,8 +167,8 @@ def create(
167167
168168
previous_interaction_id: The ID of the previous interaction, if any.
169169
170-
response_format: Enforces that the generated response is a JSON object that complies with
171-
the JSON schema specified in this field.
170+
response_format: Enforces that the generated response is a JSON object that complies with the
171+
JSON schema specified in this field.
172172
173173
response_mime_type: The mime type of the response. This is required if response_format is set.
174174
@@ -228,8 +228,8 @@ def create(
228228
229229
previous_interaction_id: The ID of the previous interaction, if any.
230230
231-
response_format: Enforces that the generated response is a JSON object that complies with
232-
the JSON schema specified in this field.
231+
response_format: Enforces that the generated response is a JSON object that complies with the
232+
JSON schema specified in this field.
233233
234234
response_mime_type: The mime type of the response. This is required if response_format is set.
235235
@@ -293,8 +293,8 @@ def create(
293293
294294
previous_interaction_id: The ID of the previous interaction, if any.
295295
296-
response_format: Enforces that the generated response is a JSON object that complies with
297-
the JSON schema specified in this field.
296+
response_format: Enforces that the generated response is a JSON object that complies with the
297+
JSON schema specified in this field.
298298
299299
response_mime_type: The mime type of the response. This is required if response_format is set.
300300
@@ -356,8 +356,8 @@ def create(
356356
357357
previous_interaction_id: The ID of the previous interaction, if any.
358358
359-
response_format: Enforces that the generated response is a JSON object that complies with
360-
the JSON schema specified in this field.
359+
response_format: Enforces that the generated response is a JSON object that complies with the
360+
JSON schema specified in this field.
361361
362362
response_mime_type: The mime type of the response. This is required if response_format is set.
363363
@@ -496,7 +496,8 @@ def cancel(
496496
) -> Interaction:
497497
"""Cancels an interaction by id.
498498
499-
This only applies to background interactions that are still running.
499+
This only applies to background interactions that
500+
are still running.
500501
501502
Args:
502503
extra_headers: Send extra headers
@@ -537,10 +538,12 @@ def get(
537538
timeout: float | httpx.Timeout | None | NotGiven = not_given,
538539
) -> Interaction:
539540
"""
540-
Retrieves the full details of a single interaction based on its `Interaction.id`.
541+
Retrieves the full details of a single interaction based on its
542+
`Interaction.id`.
541543
542544
Args:
543-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
545+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
546+
event marked by the event id. Can only be used if `stream` is true.
544547
545548
stream: If set to true, the generated content will be streamed incrementally.
546549
@@ -570,12 +573,14 @@ def get(
570573
timeout: float | httpx.Timeout | None | NotGiven = not_given,
571574
) -> Stream[InteractionSSEEvent]:
572575
"""
573-
Retrieves the full details of a single interaction based on its `Interaction.id`.
576+
Retrieves the full details of a single interaction based on its
577+
`Interaction.id`.
574578
575579
Args:
576580
stream: If set to true, the generated content will be streamed incrementally.
577581
578-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
582+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
583+
event marked by the event id. Can only be used if `stream` is true.
579584
580585
extra_headers: Send extra headers
581586
@@ -603,12 +608,14 @@ def get(
603608
timeout: float | httpx.Timeout | None | NotGiven = not_given,
604609
) -> Interaction | Stream[InteractionSSEEvent]:
605610
"""
606-
Retrieves the full details of a single interaction based on its `Interaction.id`.
611+
Retrieves the full details of a single interaction based on its
612+
`Interaction.id`.
607613
608614
Args:
609615
stream: If set to true, the generated content will be streamed incrementally.
610616
611-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
617+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
618+
event marked by the event id. Can only be used if `stream` is true.
612619
613620
extra_headers: Send extra headers
614621
@@ -719,8 +726,8 @@ async def create(
719726
720727
previous_interaction_id: The ID of the previous interaction, if any.
721728
722-
response_format: Enforces that the generated response is a JSON object that complies with
723-
the JSON schema specified in this field.
729+
response_format: Enforces that the generated response is a JSON object that complies with the
730+
JSON schema specified in this field.
724731
725732
response_mime_type: The mime type of the response. This is required if response_format is set.
726733
@@ -784,8 +791,8 @@ async def create(
784791
785792
previous_interaction_id: The ID of the previous interaction, if any.
786793
787-
response_format: Enforces that the generated response is a JSON object that complies with
788-
the JSON schema specified in this field.
794+
response_format: Enforces that the generated response is a JSON object that complies with the
795+
JSON schema specified in this field.
789796
790797
response_mime_type: The mime type of the response. This is required if response_format is set.
791798
@@ -845,8 +852,8 @@ async def create(
845852
846853
previous_interaction_id: The ID of the previous interaction, if any.
847854
848-
response_format: Enforces that the generated response is a JSON object that complies with
849-
the JSON schema specified in this field.
855+
response_format: Enforces that the generated response is a JSON object that complies with the
856+
JSON schema specified in this field.
850857
851858
response_mime_type: The mime type of the response. This is required if response_format is set.
852859
@@ -910,8 +917,8 @@ async def create(
910917
911918
previous_interaction_id: The ID of the previous interaction, if any.
912919
913-
response_format: Enforces that the generated response is a JSON object that complies with
914-
the JSON schema specified in this field.
920+
response_format: Enforces that the generated response is a JSON object that complies with the
921+
JSON schema specified in this field.
915922
916923
response_mime_type: The mime type of the response. This is required if response_format is set.
917924
@@ -973,8 +980,8 @@ async def create(
973980
974981
previous_interaction_id: The ID of the previous interaction, if any.
975982
976-
response_format: Enforces that the generated response is a JSON object that complies with
977-
the JSON schema specified in this field.
983+
response_format: Enforces that the generated response is a JSON object that complies with the
984+
JSON schema specified in this field.
978985
979986
response_mime_type: The mime type of the response. This is required if response_format is set.
980987
@@ -1113,7 +1120,8 @@ async def cancel(
11131120
) -> Interaction:
11141121
"""Cancels an interaction by id.
11151122
1116-
This only applies to background interactions that are still running.
1123+
This only applies to background interactions that
1124+
are still running.
11171125
11181126
Args:
11191127
extra_headers: Send extra headers
@@ -1154,10 +1162,12 @@ async def get(
11541162
timeout: float | httpx.Timeout | None | NotGiven = not_given,
11551163
) -> Interaction:
11561164
"""
1157-
Retrieves the full details of a single interaction based on its `Interaction.id`.
1165+
Retrieves the full details of a single interaction based on its
1166+
`Interaction.id`.
11581167
11591168
Args:
1160-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1169+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
1170+
event marked by the event id. Can only be used if `stream` is true.
11611171
11621172
stream: If set to true, the generated content will be streamed incrementally.
11631173
@@ -1187,12 +1197,14 @@ async def get(
11871197
timeout: float | httpx.Timeout | None | NotGiven = not_given,
11881198
) -> AsyncStream[InteractionSSEEvent]:
11891199
"""
1190-
Retrieves the full details of a single interaction based on its `Interaction.id`.
1200+
Retrieves the full details of a single interaction based on its
1201+
`Interaction.id`.
11911202
11921203
Args:
11931204
stream: If set to true, the generated content will be streamed incrementally.
11941205
1195-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1206+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
1207+
event marked by the event id. Can only be used if `stream` is true.
11961208
11971209
extra_headers: Send extra headers
11981210
@@ -1220,12 +1232,14 @@ async def get(
12201232
timeout: float | httpx.Timeout | None | NotGiven = not_given,
12211233
) -> Interaction | AsyncStream[InteractionSSEEvent]:
12221234
"""
1223-
Retrieves the full details of a single interaction based on its `Interaction.id`.
1235+
Retrieves the full details of a single interaction based on its
1236+
`Interaction.id`.
12241237
12251238
Args:
12261239
stream: If set to true, the generated content will be streamed incrementally.
12271240
1228-
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
1241+
last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the
1242+
event marked by the event id. Can only be used if `stream` is true.
12291243
12301244
extra_headers: Send extra headers
12311245

google/genai/_interactions/types/annotation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class Annotation(BaseModel):
3131
source: Optional[str] = None
3232
"""Source attributed for a portion of the text.
3333
34-
Could be a URL, title, or
35-
other identifier.
34+
Could be a URL, title, or other identifier.
3635
"""
3736

3837
start_index: Optional[int] = None

google/genai/_interactions/types/annotation_param.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class AnnotationParam(TypedDict, total=False):
3131
source: str
3232
"""Source attributed for a portion of the text.
3333
34-
Could be a URL, title, or
35-
other identifier.
34+
Could be a URL, title, or other identifier.
3635
"""
3736

3837
start_index: int

google/genai/_interactions/types/interaction_create_params.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class BaseCreateModelInteractionParams(TypedDict, total=False):
7777

7878
response_format: object
7979
"""
80-
Enforces that the generated response is a JSON object that complies with
81-
the JSON schema specified in this field.
80+
Enforces that the generated response is a JSON object that complies with the
81+
JSON schema specified in this field.
8282
"""
8383

8484
response_mime_type: str
@@ -141,8 +141,8 @@ class BaseCreateAgentInteractionParams(TypedDict, total=False):
141141

142142
response_format: object
143143
"""
144-
Enforces that the generated response is a JSON object that complies with
145-
the JSON schema specified in this field.
144+
Enforces that the generated response is a JSON object that complies with the
145+
JSON schema specified in this field.
146146
"""
147147

148148
response_mime_type: str

google/genai/_interactions/types/interaction_get_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class InteractionGetParamsBase(TypedDict, total=False):
2929
last_event_id: str
3030
"""Optional.
3131
32-
If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.
32+
If set, resumes the interaction stream from the next chunk after the event
33+
marked by the event id. Can only be used if `stream` is true.
3334
"""
3435

3536

google/genai/_interactions/types/tool.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ class MCPServer(BaseModel):
7373
"""The name of the MCPServer."""
7474

7575
url: Optional[str] = None
76-
"""
77-
The full URL for the MCPServer endpoint.
78-
Example: "https://api.example.com/mcp"
79-
"""
76+
"""The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """
8077

8178

8279
class FileSearch(BaseModel):

google/genai/_interactions/types/tool_param.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ class MCPServer(TypedDict, total=False):
7373
"""The name of the MCPServer."""
7474

7575
url: str
76-
"""
77-
The full URL for the MCPServer endpoint.
78-
Example: "https://api.example.com/mcp"
79-
"""
76+
"""The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """
8077

8178

8279
class FileSearch(TypedDict, total=False):

google/genai/_interactions/types/turn.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ class Turn(BaseModel):
2828
"""The content of the turn."""
2929

3030
role: Optional[str] = None
31-
"""The originator of this turn.
32-
33-
Must be user for input or model for
34-
model output.
35-
"""
31+
"""The originator of this turn. Must be user for input or model for model output."""

google/genai/_interactions/types/turn_param.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,4 @@ class TurnParam(TypedDict, total=False):
3030
"""The content of the turn."""
3131

3232
role: str
33-
"""The originator of this turn.
34-
35-
Must be user for input or model for
36-
model output.
37-
"""
33+
"""The originator of this turn. Must be user for input or model for model output."""

0 commit comments

Comments
 (0)