In this video it shows the steps to access the Gemini Fine Tuned models through Rest API calls in postman.
In this video it refers the below pages:
Fine Tune Model Creation Steps:
https://programmerworld.co/ai-gen-ai-generative-artificial-intelligence/understand-fine-tuning-with-a-simple-example-googles-gemini-ai-model-tuning/
Google (GCP) OAuth steps:
https://programmerworld.co/ai-gen-ai-generative-artificial-intelligence/how-to-setup-oauth2-0-authentication-for-googlegcp-account-obtain-access-token-for-gemini-apis
Gemini Fine Tune API doc:
https://ai.google.dev/gemini-api/docs/model-tuning/tutorial?lang=rest
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Screenshots:
Step 1: Get Access token.
PS C:\Work> gcloud auth application-default print-access-token
ya29.a0AcM612w9ARnZoY7Ahbj-dVOvYllkgqy0xQLDPWSqbXNbed_IRlOKHTL0zZ3bE7eNHu2e9L7MBJehdvBeIvG0QlvsyuGlMB2_Nu_oDOwzGOQTRZuxoUK6gsPQYdKWvJW7ANN2m-_Y46UDHPicX_wbdf9PToQkShsR1QZNaCgYKAYYSARMSFQHGX2MiD7V52TPjvZvLylxNfpaG0A0171
PS C:\Work>
Step 2: Create a fine-tuned model in Google AI studio:
Ex. https://aistudio.google.com/app/tunedModels/additiontuned-model-bajvffy0qe5e
Sample prompts for this Fine Tuned Models:
Step 3: Get the curl command (API) from the below Gemini API Fine Tune documentation page:
https://ai.google.dev/gemini-api/docs/model-tuning/tutorial?lang=rest#run_inference
Sample curl command – working copy:
curl -X POST https://generativelanguage.googleapis.com/v1beta/tunedModels/additiontuned-model-bajvffy0qe5e:generateContent \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ya29.a0AcM612xpvL_MNqz_z7MOE-DL-U7iWCUOZB3XKIO8eM1uASsSLYHY_K5BKf72v7tPZYEQDOgBKkLgv9x7bgGXST1Skruu-tS6Rf6UexsEkimv_XSTiIsN6L3GNIRBSEd0cjqpLLx5f3S2Lioj_ihDlkcZgdkYLFimotsaCgYKAUgSARMSFQHGX2Miy8hXAAcPyakRXwWGioxKAQ0171" \
-H "x-goog-user-project: demoproject-414905" \
-d '{
"contents": [{
"parts": [{
"text": "5+1"
}]
}]
}'
Execution of the command in Postman tool: