File tree Expand file tree Collapse file tree
generative-ai/snippets/count-tokens Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- // [START generativeaionvertexai_gemini_token_count]
1615const { GoogleGenAI} = require ( '@google/genai' ) ;
1716
1817/**
@@ -51,7 +50,6 @@ async function countTokens(
5150 const usageMetadata = result . usageMetadata ;
5251 console . log ( 'Response tokens count: ' , usageMetadata ) ;
5352}
54- // [END generativeaionvertexai_gemini_token_count]
5553
5654countTokens ( ...process . argv . slice ( 2 ) ) . catch ( err => {
5755 console . error ( err . message ) ;
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- // [START generativeaionvertexai_gemini_token_count_advanced]
1615const { GoogleGenAI} = require ( '@google/genai' ) ;
1716/**
1817 * TODO(developer): Update these variables before running the sample.
@@ -63,7 +62,6 @@ async function countTokens(
6362 console . log ( 'Candidates Token Count:' , usageMetadata . candidatesTokenCount ) ;
6463 console . log ( 'Total Token Count:' , usageMetadata . totalTokenCount ) ;
6564}
66- // [END generativeaionvertexai_gemini_token_count_advanced]
6765
6866countTokens ( ...process . argv . slice ( 2 ) ) . catch ( err => {
6967 console . error ( err . message ) ;
You can’t perform that action at this time.
0 commit comments