Skip to content

AttributeError: whichOneof vs WhichOneof casing issue in response.text #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgalore opened this issue Apr 11, 2025 · 3 comments
Closed
Labels
component:python sdk Issue/PR related to Python SDK p1 status:awaiting user response Awaiting a response from the author

Comments

@mgalore
Copy link

mgalore commented Apr 11, 2025

Description of the bug:

import google.generativeai as genai

Configure with your API key

genai.configure(api_key="YOUR_API_KEY")

Setup model with function calling

model = genai.GenerativeModel(
'gemini-1.5-flash-latest',
tools=[...] # your tool definition
)

Start chat

chat = model.start_chat()

Send a message that triggers function calling

response = chat.send_message("...")

This line causes the error:

print(response.text)

Error: AttributeError: whichOneof. Did you mean: 'WhichOneof'?

Actual vs expected behavior:

AttributeError: whichOneof. Did you mean: 'WhichOneof'?

Any other information you'd like to share?

google-generativeai version: [run pip show google-generativeai]
Python version: [run python --version]
OS: Windows [version]

@Gunand3043
Copy link

Hi @mgalore ,
We already have a similar issue #620 . @MarkDaoust response there might be helpful.

Thanks.

@Gunand3043 Gunand3043 added status:awaiting user response Awaiting a response from the author component:python sdk Issue/PR related to Python SDK labels Apr 14, 2025
@MarkDaoust
Copy link
Collaborator

Oh, it looks like this got fixed in main, but we haven't made a new release.

#684

We should release a 0.8.5

In the mean time, pip install -U git+https://github.com/google-gemini/deprecated-generative-ai-python will install the fixed version.

(Or upgrade to the new SDK over at https://github.com/googleapis/python-genai)

@MarkDaoust MarkDaoust added the p1 label Apr 14, 2025
@MarkDaoust
Copy link
Collaborator

0.8.5 was released last week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK p1 status:awaiting user response Awaiting a response from the author
Projects
None yet
Development

No branches or pull requests

3 participants