From 18456b49364aeebaf386598d19fa7194b2602c0e Mon Sep 17 00:00:00 2001 From: wizeng23 Date: Mon, 26 Sep 2022 13:44:16 -0700 Subject: [PATCH] docs: update classification sample to use v2 model (#700) Fixes #699 --- cloud-language/snippets/analyze.v1.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cloud-language/snippets/analyze.v1.js b/cloud-language/snippets/analyze.v1.js index 162f190880..8c734e53d1 100644 --- a/cloud-language/snippets/analyze.v1.js +++ b/cloud-language/snippets/analyze.v1.js @@ -314,8 +314,17 @@ async function classifyTextOfText(text) { type: 'PLAIN_TEXT', }; + const classificationModelOptions = { + v2Model: { + contentCategoriesVersion: 'V2', + }, + }; + // Classifies text in the document - const [classification] = await client.classifyText({document}); + const [classification] = await client.classifyText({ + document, + classificationModelOptions, + }); console.log('Categories:'); classification.categories.forEach(category => { console.log(`Name: ${category.name}, Confidence: ${category.confidence}`);