from vertexai.preview.generative_models import GenerativeModel
gemini_pro_model = GenerativeModel(“gemini-pro”)
print(gemini_pro_model.count_tokens(“why is sky blue?”))
I do miss having a local implementation that we could use like tiktoken, and it will be greater if it exists (I am not aware of it) —
I hope it helps.