Skip to content
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

AttributeError: Unknown field for Candidate: finish_message. Did you mean: 'finish_reason'? #598

Closed
allenporter opened this issue Oct 14, 2024 · 2 comments

Comments

@allenporter
Copy link

Description of the bug:

When calling .text on the response it may fail with an AttributeError:

yaml_content = _parse_model_response(response.text)
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/generativeai/types/generation_types.py", line 476, in text
if candidate.finish_message:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/proto/message.py", line 906, in __getattr__
raise AttributeError(
AttributeError: Unknown field for Candidate: finish_message. Did you mean: 'finish_reason'?

Actual vs expected behavior:

No response

Any other information you'd like to share?

This appears to be lines recently changed in #527

@Hamza-nabil
Copy link
Contributor

Upgrading may resolve the problem:

pip install -U google-generativeai

This issue(see #559)) is fixed in v0.8.3.

@allenporter
Copy link
Author

Thanks, I thought I was on latest but must have been mistaken, and didn't see that in an issue search, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants