-
Notifications
You must be signed in to change notification settings - Fork 446
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
Improve key naming clarity and consistency across REST requests #683
Comments
@Giom-V - you were looking at rest samples, maybe look into enforcing this at the same time? |
I think it would also be useful to add a script example for generating content with pdfs as inline data (not file data). I have included an example below:
|
Hey, I would love to work on this issue. |
@demoncoder-crypto Feel free to send a PR, I'll review it. |
… Standardize on camelCase for REST API parameter names - Update README.md to document parameter naming conventions - Create new inline_pdf_example.sh with consistent naming - Fix inconsistent naming in several example files - Fixes google-gemini#683
To resolve this issue, I recommend 1)- Updating all shell scripts in the samples/rest directory to use consistent naming |
@demoncoder-crypto I've left comments on the pull request regarding some changes that you missed. |
Description of the feature request:
It is not immediately obvious that both camel casing and underscore pythonic style casing are interchangeable for the input data keys to Gemini. It would be helpful to note this somewhere as there are several examples where both styles are used in a confusing fashion often time in the same input json:
When specifying the system instructions to the model in the /cachedContents endpoint it uses camel case: 'systemInstruction':
https://github.com/google-gemini/generative-ai-python/blob/8849d4f46010ce4ae68243c4f8a44a138b56598f/samples/rest/count_tokens.sh#L196
However, in the same example, it uses 'system_instructions' as input json to the /generateContent endpoint:
https://github.com/google-gemini/generative-ai-python/blob/8849d4f46010ce4ae68243c4f8a44a138b56598f/samples/rest/count_tokens.sh#L218
While it does seem like both can be used
The 'generationConfig' dictionary, in the input json to the /generateContent endpoint, contains several keys in the camel case notation and several in the underscore pythonic notation which is confusing and messy:
An example:
...
...
References:
https://github.com/google-gemini/generative-ai-python/blob/8849d4f46010ce4ae68243c4f8a44a138b56598f/samples/rest/configure_model_parameters.sh#L20
https://github.com/google-gemini/generative-ai-python/blob/8849d4f46010ce4ae68243c4f8a44a138b56598f/samples/rest/controlled_generation.sh#L13
It also doesn't help that the general version of the API reference denotes everything in camel case so if a developer is only referring to that it would create a confusing situation:
https://ai.google.dev/api/generate-content#generationconfig
What problem are you trying to solve with this feature?
Improved clarity and consistency in Gemini API documentation, reduces potential for errors imo.
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: