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

Skip to content

Calling .text on function call result in an exception #670

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

Closed
ex0ns opened this issue Feb 2, 2025 · 1 comment · Fixed by #684
Closed

Calling .text on function call result in an exception #670

ex0ns opened this issue Feb 2, 2025 · 1 comment · Fixed by #684
Assignees
Labels
component:python sdk Issue/PR related to Python SDK type:bug Something isn't working

Comments

@ex0ns
Copy link

ex0ns commented Feb 2, 2025

Description of the bug:

The function_call type is not handled at all in this function (and raises an exception, which might be expected but is a bit counter intuitive):
https://github.com/google-gemini/generative-ai-python/blob/v0.8.4/google/generativeai/types/generation_types.py#L512-L536

Further more this line (that deals with the missing case), has a type and should be WhichOneOf instead of whichOneOf.
https://github.com/google-gemini/generative-ai-python/blob/v0.8.4/google/generativeai/types/generation_types.py#L535-L536

Is there a reason for .text to raise an exception when the result only contains a function call

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

@Gunand3043 Gunand3043 added type:bug Something isn't working status:triaged Issue/PR triaged to the corresponding sub-team component:python sdk Issue/PR related to Python SDK labels Feb 3, 2025
@MarkDaoust MarkDaoust mentioned this issue Feb 18, 2025
@MarkDaoust
Copy link
Collaborator

Hi, I'm fixing the WhichOneOf error.

But .text was never meant to be a tool for all-encompassing display everything you might have.
It was only meant for easy access in simple cases. It's arguable that we shouldn't have even implemented code_execution in there.

It's hard to know what people will need, and we don't want to do too much guessing for them.

We don't have any plans to fix this.

  • Users always have the option to iterate over the parts and do whatever they want with each part type.
  • For Gemini-2 we are transitioning to a new SDK. We are not planning to continue development of new features here. You could raise an issue there to ask them to support this.

@github-actions github-actions bot removed the status:triaged Issue/PR triaged to the corresponding sub-team label Feb 18, 2025
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 type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants