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

function_call not handled in BaseGenerateContentResponse.text #620

Open
neilp9 opened this issue Nov 8, 2024 · 0 comments · May be fixed by #629
Open

function_call not handled in BaseGenerateContentResponse.text #620

neilp9 opened this issue Nov 8, 2024 · 0 comments · May be fixed by #629
Labels
component:python sdk Issue/PR related to Python SDK status:triaged Issue/PR triaged to the corresponding sub-team

Comments

@neilp9
Copy link

neilp9 commented Nov 8, 2024

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

@Gunand3043 Gunand3043 added status:triaged Issue/PR triaged to the corresponding sub-team component:python sdk Issue/PR related to Python SDK labels Nov 11, 2024
@MarkDaoust MarkDaoust linked a pull request Nov 12, 2024 that will close this issue
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 status:triaged Issue/PR triaged to the corresponding sub-team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants