Skip to content

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

@allenporter

Description

@allenporter

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

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