You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
The WhichOneOf error is being fixed. But .text isn't meant to handle everything. For anything remotely complicated, users should iterate over the parts and decide what to do with each one.
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: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
The text was updated successfully, but these errors were encountered: