Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

In text generation docs, example multimodle input, is not working with genai, #742

Description

@rahulprodev

Description of the bug:

it's not working with genai, it was fixed by generativeai module

https://ai.google.dev/gemini-api/docs/text-generation

`from PIL import Image
from google import genai

client = genai.Client(api_key =
│ "AIzaSyCcz313_srMUs3X_paBF0CBsHQ4_aDOx9c")

image = Image.open("shivsatri.jpg")
response = client.models.generate_content(
model="gemini-2.5-flash",
contents=[image, "Tell me about this instrument"]
)
print(response.text)`

it was fixed like this:
╭────────────────────────────────────────────────────
│ ✔ Edit imageai.py: from PIL import Image... => from PIL import Image...

│ 1 from PIL import Image
│ 2 - from google import genai
│ 2 + import google.generativeai as genai
│ 3
│ 4 + genai.configure(api_key =
│ "AIzaSyCcz313_srMUs3X_paBF0CBsHQ4_aDOx9c")
│ 5
│ 5 -
│ 6 - client = genai.Client(api_key =
│ "AIzaSyCcz313_srMUs3X_paBF0CBsHQ4_aDOx9c")
│ 7 -
│ 6 image = Image.open("shivsatri.jpg")
│ 7
│ 10 - response = client.models.generate_content(
│ 11 - model = "gemini-2.5-flash",
│ 12 - contents = [image, "Tell me about this instrument"]
│ 8 + model = genai.GenerativeModel('gemini-1.5-flash-latest')
│ 9 +
│ 10 + response = model.generate_content(
│ 11 + [image, "Tell me about this instrument"]
│ 12 )
│ 13
│ 14 print(response.text)
╰───────────────────────────────────────────────────────────────

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions