@@ -69,7 +69,7 @@ def test_tokens_chat(self):
69
69
response = chat .send_message (
70
70
"In one sentence, explain how a computer works to a young child."
71
71
)
72
-
72
+
73
73
# On the response for `send_message`, use `usage_metadata`
74
74
# to get separate input and output token counts
75
75
# (`prompt_token_count` and `candidates_token_count`, respectively),
@@ -195,7 +195,7 @@ def test_tokens_cached_content(self):
195
195
# ( total_tokens: 9 )
196
196
197
197
response = model .generate_content (prompt )
198
-
198
+
199
199
# On the response for `generate_content`, use `usage_metadata`
200
200
# to get separate input and output token counts
201
201
# (`prompt_token_count` and `candidates_token_count`, respectively),
@@ -211,7 +211,7 @@ def test_tokens_system_instruction(self):
211
211
# [START tokens_system_instruction]
212
212
model = genai .GenerativeModel (model_name = "gemini-1.5-flash" )
213
213
214
- prompt = "The quick brown fox jumps over the lazy dog."
214
+ prompt = "The quick brown fox jumps over the lazy dog."
215
215
216
216
print (model .count_tokens (prompt ))
217
217
# total_tokens: 10
@@ -230,7 +230,7 @@ def test_tokens_tools(self):
230
230
# [START tokens_tools]
231
231
model = genai .GenerativeModel (model_name = "gemini-1.5-flash" )
232
232
233
- prompt = "I have 57 cats, each owns 44 mittens, how many mittens is that in total?"
233
+ prompt = "I have 57 cats, each owns 44 mittens, how many mittens is that in total?"
234
234
235
235
print (model .count_tokens (prompt ))
236
236
# ( total_tokens: 22 )
0 commit comments