googleapis / googleapis/python-genai

Unrelated error shown when trying to use a reversed content list

Open
#1,272 10 comments 0 reactions 1 assignee Claimed by @Venkaiahbabuneelam View on GitHub
priority: p3 type: bug
Dominant language
Python
Stars
4k
Forks
1k
Avg merge
2d 11h
Merged PRs (30d)
40

Description

#### Environment details

- Programming language: Python
- OS: Linux
- Language runtime version: 3.12.3
- Package version: google-genai[aiohttp] 1.30.0

#### Steps to reproduce

1. Create a list of `Content`.
2. Reverse the list with `contents = reversed(contents)`.
3. Pass the reversed contents to `models.generate_content(...)`.

I've gotten the errors `ValueError: file uri and mime_type are required.` and `ValueError: contents are required.` when doing this, when the actual error is that `models.generate_content(...)` apparently doesn't support a `list_reverseiterator` object. Using `contents = list(reversed(contents))` fixed the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.