google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.18k stars 223 forks source link

Fix operator conversion. #419

Closed MarkDaoust closed 2 days ago

MarkDaoust commented 4 days ago

Fixes: https://github.com/google-gemini/generative-ai-python/issues/411

PandasPirate commented 3 days ago

this can break someone's code if they are using 5 for NOT_EQUAL and 6 for EXCLUDES as per the last code. I may be wrong.

MarkDaoust commented 3 days ago

Normally yes, you wouldn't change enum values. But this PR fixes it so the integer values match how the API interprets them. It's possible this breaks someone, but this code has low usage (We've never provided an example of how to use this yet). I don't want to keep it out of sync with the API just for consistency with an old version. Right now if you serialize an proto that includes one of these enum values, then convert the json back to a proto the result will be different.