AttributeError: Unknown field for Candidate: finish_message

I am working on my college project, where I am using API key. But, at some point I start getting this issue. I tried to solve it, but nothing work for me. Can someone help me to understand this issue and how to solve it? Please

Hi @anubhav_yadav

In order to expedite the trouble-shooting process, please provide a code snippet to reproduce the issue reported here. Thanks!

This was fixed in Remove finish_message by MarkDaoust · Pull Request #571 · google-gemini/generative-ai-python (github.com) but not yet released as of this writing.
You can pull the latest like so:

pip uninstall -y google-generativeai
pip install git+https://github.com/google-gemini/generative-ai-python.git@main

However, this will emphasize the true issue, that is, the API, with 1.5-flash at least, responds more than often with finishReason (finish_reason in py) OTHER.
Retries sometimes help but not always.