-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description of the bug:
I got extra_forbidden error when trying to set custom fps for video processing using client.models.generate_content. (code reference: https://ai.google.dev/gemini-api/docs/video-understanding). Please share if you have ran into the same issue and look forward to hearing how you solved it!
My code:
with open(video_local.name, 'rb') as f:
video_bytes = f.read()
# Create content using inline data
response = await self.gemini_client.aio.models.generate_content(
model=model,
contents=types.Content(
parts=[
types.Part(
inline_data=types.Blob(
data=video_bytes,
mime_type=mime_type,
video_metadata=types.VideoMetadata(fps=5)
)
),
types.Part(text=prompt)
]
)
)
Actual vs expected behavior:
Error Message:
Failed to process video [https://....mp4] for Gemini: 1 validation error for Blob
video_metadata
Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata]
For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden
ERROR:app.routes.ads:Failed to analyze xxxxx: 1 validation error for Blob
video_metadata
Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata]
For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden
Any other information you'd like to share?
No response