Skip to content

Commit 4ee32e5

Browse files
authored
Add explanatory comment to countTokens samples (google-gemini#219)
1 parent 71905ad commit 4ee32e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

samples/count_tokens.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ async function tokensSystemInstruction() {
343343
const resultWithInstructions =
344344
await modelWithInstructions.countTokens(prompt);
345345

346+
// The total token count includes everything sent to the
347+
// generateContent() request. When you use system instructions, the
348+
// total token count increases.
346349
console.log(resultWithInstructions);
347350
// { totalTokens: 23 }
348351
// [END tokens_system_instruction]
@@ -379,6 +382,9 @@ async function tokensTools() {
379382

380383
const resultWithTools = await modelWithTools.countTokens(prompt);
381384

385+
// The total token count includes everything sent to the
386+
// generateContent() request. When you use tools (like function calling),
387+
// the total token count increases.
382388
console.log(resultWithTools);
383389
// { totalTokens: 99 }
384390
// [END tokens_tools]

0 commit comments

Comments
 (0)