[Python] How to pass fps metadata to gemini_model.generate_content?

Discussão em 'Python' iniciado por Stack, Agosto 15, 2025.

  1. Stack

    Stack Membro Participativo

    I currently have code that uses the Google Gemini developer API to build a request and send that request to a gemini-2.5-flash model. The request includes a video with metadata specifying a Frames Per Second (fps) value for Gemini to analyze the video at. The documentation for this can be found here.

    contents = types.Content(parts=[
    types.Part(
    inline_data=types.Blob(
    data=video_bytes,
    mime_type=mime_type
    ),
    video_metadata=types.VideoMetadata(fps=8)
    ),
    types.Part(text=PROMPT)
    ])

    resp = client.models.generate_content(
    model="gemini-2.5-flash",
    contents=contents,
    config=types.GenerateContentConfig(
    temperature=0.2,
    max_output_tokens=60000
    )
    )



    I am now trying to switch from the developer API to Google VertexAI as this will allow me to upload videos to Google cloud and simply send Gemini a Google cloud uri.

    I have rebuilt a request similar to the one above that uses Google Developer API, but I cannot figure out how to pass Frames Per Second (fps) metadata with this new request using VertexAI.

    contents = [
    Part.from_uri(uri=gcs_uri, mime_type=mime_type),
    Part.from_text(prompt)
    ]
    resp = gemini_model.generate_content(contents)

    Continue reading...

Compartilhe esta Página