Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions google/genai/_live_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,11 @@ def _Part_to_mldev(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down Expand Up @@ -1762,6 +1767,11 @@ def _Part_to_vertex(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
5 changes: 5 additions & 0 deletions google/genai/_tokens_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,11 @@ def _Part_to_mldev(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
5 changes: 5 additions & 0 deletions google/genai/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,11 @@ def _Part_to_mldev(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
10 changes: 10 additions & 0 deletions google/genai/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,11 @@ def _Part_to_mldev(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down Expand Up @@ -890,6 +895,11 @@ def _Part_to_vertex(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
10 changes: 10 additions & 0 deletions google/genai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3708,6 +3708,11 @@ def _Part_to_mldev(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down Expand Up @@ -3797,6 +3802,11 @@ def _Part_to_vertex(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
5 changes: 5 additions & 0 deletions google/genai/tunings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,11 @@ def _Part_to_vertex(
getv(from_object, ['audio_transcription']),
)

if getv(from_object, ['media_processing']) is not None:
setv(
to_object, ['mediaProcessing'], getv(from_object, ['media_processing'])
)

return to_object


Expand Down
18 changes: 18 additions & 0 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,17 @@ class ComputationBasedMetricType(_common.CaseInSensitiveEnum):
"""ROUGE metric."""


class MediaProcessing(_common.CaseInSensitiveEnum):
"""How the model processes input media for understanding."""

MEDIA_PROCESSING_UNSPECIFIED = 'MEDIA_PROCESSING_UNSPECIFIED'
"""Default. Uses model-specific processing (3.5 Pro+ -> `AGENTIC`, older models -> `STATIC`)."""
STATIC = 'STATIC'
"""Fixed-rate frame extraction. All frames placed in context."""
AGENTIC = 'AGENTIC'
"""Model-driven dynamic navigation. Recommended for most use cases."""


class PartMediaResolutionLevel(_common.CaseInSensitiveEnum):
"""The tokenization quality used for given media."""

Expand Down Expand Up @@ -2291,6 +2302,10 @@ class Part(_common.BaseModel):
default=None,
description="""Output only. The transcription of the audio part.""",
)
media_processing: Optional[MediaProcessing] = Field(
default=None,
description="""How the model processes this part's media for understanding.""",
)

def __init__(
self,
Expand Down Expand Up @@ -2525,6 +2540,9 @@ class PartDict(TypedDict, total=False):
audio_transcription: Optional[TranscriptionDict]
"""Output only. The transcription of the audio part."""

media_processing: Optional[MediaProcessing]
"""How the model processes this part's media for understanding."""


PartOrDict = Union[Part, PartDict]

Expand Down
Loading