Skip to content

refactor: deduplicate Gemini media part building across Google clients #247

Description

@Kamilbenkirane

Multiple Google clients independently implement the same inline_data/file_data part-building logic for media artifacts (images, videos, audio):

  • modalities/text/providers/google/client.py — 3 identical _build_image/video/audio_part methods
  • modalities/images/providers/google/gemini.py — standalone _build_image_part
  • modalities/embeddings/providers/google/client.py_build_media_part
  • providers/google/generate_content/parameters.pyMediaContentMapper._build_image_part

Extract a single shared build_media_part utility in providers/google/utils.py that accepts any Artifact and returns the Gemini part dict.

Note: providers/google/interactions/parameters.py uses a different API format ({"type": "image", ...}) and cannot be unified.

Will be fixed in #246.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions