Thanks to visit codestin.com
Credit goes to github.com

Skip to content

function_call not handled in BaseGenerateContentResponse.text  #620

Closed
@neilp9

Description

@neilp9

Description of the bug:

calling session.send_message returns a GenerateContentResponse object, and when this response includes a function call, response.text raises the following error:

File ".../.virtualenvs/cai/lib/python3.11/site-packages/google/generativeai/types/generation_types.py", line 538, in text
    part_type = protos.Part.pb(part).whichOneof("data")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: whichOneof

Actual vs expected behavior:

response.text should return the text part of the response rather than throwing error. Related but separate of an issue, there should ideally be a convenience accessor for response.function_call

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions