cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Update package to google-genai in `examples/Classify_text_with_embeddings.ipynb`

Open Jenniebn opened this issue 8 months ago • 3 comments

Update package to google-genai in examples/Classify_text_with_embeddings.ipynb

  • Updated google-generativeai to use google-genai package instead.
  • Updated outputs and tested locally.
  • Refactored imports
  • Process 100 rows in 1 batch request for getting embeddings. (100 is the max limit BatchEmbedContentsRequest.requests: at most 100 requests can be in one batch) .The original issue didn't require this optimization, but it was needed since free gemini API credits are insufficient for 600 requests. Now, it can be done in 6 requests.
  • Replaced Sigmoid with Softmax for multi-class classification and set from_logits=False
  • Formatted with nbfmt and nblint tool

Jenniebn avatar Mar 31 '25 19:03 Jenniebn

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Thanks for the submission @Jenniebn! The code is good and well formatted.

I just added a few comments so that we improve the explanations while we're at it.

Giom-V avatar Apr 01 '25 10:04 Giom-V

Thanks for the submission @Jenniebn! The code is good and well formatted.

I just added a few comments so that we improve the explanations while we're at it.

Thank you for your review. I just implemented everything you commented! Feel free to let me know if there is anything else that needs to be updated!

Jenniebn avatar Apr 01 '25 21:04 Jenniebn

Thanks for the submission @Jenniebn. It's approved and merged!

Giom-V avatar Apr 02 '25 14:04 Giom-V