Skip to content

Commit 543137b

Browse files
google-genai-botcopybara-github
authored andcommitted
feat(interaction-api): Allow "text/csv" as a supported document mime type for Interaction API.
PiperOrigin-RevId: 921822941
1 parent 5dc17e5 commit 543137b

9 files changed

Lines changed: 87 additions & 9 deletions

google/genai/_interactions/types/document_content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DocumentContent(BaseModel):
3131
data: Optional[str] = None
3232
"""The document content."""
3333

34-
mime_type: Optional[Literal["application/pdf"]] = None
34+
mime_type: Optional[Literal["application/pdf", "text/csv"]] = None
3535
"""The mime type of the document."""
3636

3737
uri: Optional[str] = None

google/genai/_interactions/types/document_content_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DocumentContentParam(TypedDict, total=False):
3535
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
3636
"""The document content."""
3737

38-
mime_type: Literal["application/pdf"]
38+
mime_type: Literal["application/pdf", "text/csv"]
3939
"""The mime type of the document."""
4040

4141
uri: str

google/genai/_interactions/types/error_event.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21+
from .usage import Usage
2122
from .._models import BaseModel
2223

23-
__all__ = ["ErrorEvent", "Error"]
24+
__all__ = ["ErrorEvent", "Error", "Metadata"]
2425

2526

2627
class Error(BaseModel):
@@ -33,6 +34,13 @@ class Error(BaseModel):
3334
"""A human-readable error message."""
3435

3536

37+
class Metadata(BaseModel):
38+
"""Optional metadata accompanying ANY streamed event."""
39+
40+
usage: Optional[Usage] = None
41+
"""Statistics on the interaction request's token usage."""
42+
43+
3644
class ErrorEvent(BaseModel):
3745
event_type: Literal["error"]
3846

@@ -43,3 +51,6 @@ class ErrorEvent(BaseModel):
4351
"""
4452
The event_id token to be used to resume the interaction stream, from this event.
4553
"""
54+
55+
metadata: Optional[Metadata] = None
56+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/interaction_completed_event.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21+
from .usage import Usage
2122
from .._models import BaseModel
2223
from .interaction import Interaction
2324

24-
__all__ = ["InteractionCompletedEvent"]
25+
__all__ = ["InteractionCompletedEvent", "Metadata"]
26+
27+
28+
class Metadata(BaseModel):
29+
"""Optional metadata accompanying ANY streamed event."""
30+
31+
usage: Optional[Usage] = None
32+
"""Statistics on the interaction request's token usage."""
2533

2634

2735
class InteractionCompletedEvent(BaseModel):
@@ -38,3 +46,6 @@ class InteractionCompletedEvent(BaseModel):
3846
"""
3947
The event_id token to be used to resume the interaction stream, from this event.
4048
"""
49+
50+
metadata: Optional[Metadata] = None
51+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/interaction_created_event.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21+
from .usage import Usage
2122
from .._models import BaseModel
2223
from .interaction import Interaction
2324

24-
__all__ = ["InteractionCreatedEvent"]
25+
__all__ = ["InteractionCreatedEvent", "Metadata"]
26+
27+
28+
class Metadata(BaseModel):
29+
"""Optional metadata accompanying ANY streamed event."""
30+
31+
usage: Optional[Usage] = None
32+
"""Statistics on the interaction request's token usage."""
2533

2634

2735
class InteractionCreatedEvent(BaseModel):
@@ -34,3 +42,6 @@ class InteractionCreatedEvent(BaseModel):
3442
"""
3543
The event_id token to be used to resume the interaction stream, from this event.
3644
"""
45+
46+
metadata: Optional[Metadata] = None
47+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/interaction_status_update.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21+
from .usage import Usage
2122
from .._models import BaseModel
2223

23-
__all__ = ["InteractionStatusUpdate"]
24+
__all__ = ["InteractionStatusUpdate", "Metadata"]
25+
26+
27+
class Metadata(BaseModel):
28+
"""Optional metadata accompanying ANY streamed event."""
29+
30+
usage: Optional[Usage] = None
31+
"""Statistics on the interaction request's token usage."""
2432

2533

2634
class InteractionStatusUpdate(BaseModel):
@@ -36,3 +44,6 @@ class InteractionStatusUpdate(BaseModel):
3644
"""
3745
The event_id token to be used to resume the interaction stream, from this event.
3846
"""
47+
48+
metadata: Optional[Metadata] = None
49+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/step_delta.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from typing import Dict, List, Union, Optional
1919
from typing_extensions import Literal, Annotated, TypeAlias
2020

21+
from .usage import Usage
2122
from .._utils import PropertyInfo
2223
from .._models import BaseModel
2324
from .annotation import Annotation
@@ -59,6 +60,7 @@
5960
"DeltaGoogleMapsResult",
6061
"DeltaFunctionResult",
6162
"DeltaFunctionResultResultFunctionResultSubcontentList",
63+
"Metadata",
6264
]
6365

6466

@@ -124,7 +126,7 @@ class DeltaDocument(BaseModel):
124126

125127
data: Optional[str] = None
126128

127-
mime_type: Optional[Literal["application/pdf"]] = None
129+
mime_type: Optional[Literal["application/pdf", "text/csv"]] = None
128130

129131
uri: Optional[str] = None
130132

@@ -361,6 +363,13 @@ class DeltaFunctionResult(BaseModel):
361363
]
362364

363365

366+
class Metadata(BaseModel):
367+
"""Optional metadata accompanying ANY streamed event."""
368+
369+
usage: Optional[Usage] = None
370+
"""Statistics on the interaction request's token usage."""
371+
372+
364373
class StepDelta(BaseModel):
365374
delta: Delta
366375

@@ -372,3 +381,6 @@ class StepDelta(BaseModel):
372381
"""
373382
The event_id token to be used to resume the interaction stream, from this event.
374383
"""
384+
385+
metadata: Optional[Metadata] = None
386+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/step_start.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@
1919
from typing_extensions import Literal
2020

2121
from .step import Step
22+
from .usage import Usage
2223
from .._models import BaseModel
2324

24-
__all__ = ["StepStart"]
25+
__all__ = ["StepStart", "Metadata"]
26+
27+
28+
class Metadata(BaseModel):
29+
"""Optional metadata accompanying ANY streamed event."""
30+
31+
usage: Optional[Usage] = None
32+
"""Statistics on the interaction request's token usage."""
2533

2634

2735
class StepStart(BaseModel):
@@ -36,3 +44,6 @@ class StepStart(BaseModel):
3644
"""
3745
The event_id token to be used to resume the interaction stream, from this event.
3846
"""
47+
48+
metadata: Optional[Metadata] = None
49+
"""Optional metadata accompanying ANY streamed event."""

google/genai/_interactions/types/step_stop.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21+
from .usage import Usage
2122
from .._models import BaseModel
2223

23-
__all__ = ["StepStop"]
24+
__all__ = ["StepStop", "Metadata"]
25+
26+
27+
class Metadata(BaseModel):
28+
"""Optional metadata accompanying ANY streamed event."""
29+
30+
usage: Optional[Usage] = None
31+
"""Statistics on the interaction request's token usage."""
2432

2533

2634
class StepStop(BaseModel):
@@ -32,3 +40,6 @@ class StepStop(BaseModel):
3240
"""
3341
The event_id token to be used to resume the interaction stream, from this event.
3442
"""
43+
44+
metadata: Optional[Metadata] = None
45+
"""Optional metadata accompanying ANY streamed event."""

0 commit comments

Comments
 (0)