Skip to content
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

Migrating the count token guide to the unified SDK #467

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

Giom-V
Copy link
Collaborator

@Giom-V Giom-V commented Feb 19, 2025

No description provided.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:quickstarts Issues/PR referencing quickstarts folder labels Feb 19, 2025
Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:19Z
----------------------------------------------------------------

If we don't want to pin versions when installing packages, it might be helpful to at least print the package version that got installed. Just as a way to help users track version skew without adding maintenance burden.


Giom-V commented on 2025-02-21T08:34:57Z
----------------------------------------------------------------

Is that ok with you if I just set >=1.0.0 instead of pinning a specific version?

Giom-V commented on 2025-02-21T08:41:22Z
----------------------------------------------------------------

I've added >1.0.0.Is that ok with you?

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:20Z
----------------------------------------------------------------

These links are for the old SDK.


Giom-V commented on 2025-02-21T08:41:33Z
----------------------------------------------------------------

Good catch, it should be fixed now.

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:21Z
----------------------------------------------------------------

currently 258 tokens

"currently" indicates that we might change it, which I don't think we want to say.

My preference for these cases is "show, don't tell" - i.e. don't write down the token count in the text, but demonstrate it using code. This way if it ever changes, the text is still correct.


Giom-V commented on 2025-02-21T09:02:54Z
----------------------------------------------------------------

I have mixed feeling about that as it a question I got multiple times from devs, but I still updated the text to point to the documentation.

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:22Z
----------------------------------------------------------------

Line #3.        contents=["Tell me about this instrument",organ]

organ is never defined (looks like you deleted the PIL.Image.open line)


Giom-V commented on 2025-02-21T08:42:59Z
----------------------------------------------------------------

Fixed. Thanks!

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:23Z
----------------------------------------------------------------

As you can see

The number output above doesn't match the number here. There is some skew that the reader has to figure out for themselves. If you want to show the fixed size of an image, call count_tokens with just the image. (but my preference here is not to repeat magic numbers that can get out of sync)


Giom-V commented on 2025-02-21T09:03:09Z
----------------------------------------------------------------

Updated the example.

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:24Z
----------------------------------------------------------------

I realise it wasn't here before, so optional, but it'd be nice to show how long the MP3 file is so the user can easily do the tok/sec calculation.

eg

!ffprobe -v error -show_entries format=duration sample.mp3

Giom-V commented on 2025-02-21T09:09:13Z
----------------------------------------------------------------

Good idea. I've added it.

Copy link

review-notebook-app bot commented Feb 20, 2025

View / edit / reply to this conversation on ReviewNB

markmcd commented on 2025-02-20T09:47:24Z
----------------------------------------------------------------

Did you mean to delete the system instruction & tools section? It is useful to understand how they contribute to the overall context.


Giom-V commented on 2025-02-21T08:39:26Z
----------------------------------------------------------------

I agree but they don't work at the moment. I've reported the issue to the SDK team and create fast-follow tasks to add back that content when it will be supported.

I'll add a line about it in the commit and the PR description.

Giom-V commented on 2025-02-21T09:09:12Z
----------------------------------------------------------------

I also added a note in the notebook itself.

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

Is that ok with you if I just set >=1.0.0 instead of pinning a specific version?


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

I agree but they don't work at the moment. I've reported the issue to the SDK team and create fast-follow tasks to add back that content when it will be supported.

I'll add a line about it in the commit and the PR description.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

I've added >1.0.0.Is that ok with you?


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

Good catch, it should be fixed now.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

Fixed. Thanks!


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

I have mixed feeling about that as it a question I got multiple times from devs, but I still updated the text to point to the documentation.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

Updated the example.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

I also added a note in the notebook itself.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Giom-V commented Feb 21, 2025

Good idea. I've added it.


View entire conversation on ReviewNB

@Giom-V Giom-V merged commit bc16ed1 into google-gemini:main Feb 21, 2025
5 checks passed
@Giom-V Giom-V deleted the count-token-usdk branch February 21, 2025 09:49
Yousif-GO pushed a commit to Yousif-GO/cookbook that referenced this pull request Feb 23, 2025
* Migrating the count token guide to the unified SDK
* Chat, tools and caching are not supported at the moment, the examples have been removed and will be added back when they will be supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:quickstarts Issues/PR referencing quickstarts folder status:awaiting review PR awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants