@azure/ai-language-text 1.1.0-alpha.20250402.1 → 1.1.0-alpha.20250404.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -92,9 +92,8 @@ az cognitiveservices account keys list --resource-group <your-resource-group-nam
92
92
 
93
93
  Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
94
94
 
95
- ```ts snippet:ReadmeSampleCreateClient_Node
96
- import { AzureKeyCredential } from "@azure/core-auth";
97
- import { TextAnalysisClient } from "@azure/ai-language-text";
95
+ ```ts snippet:ReadmeSampleCreateClient_Key
96
+ import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
98
97
 
99
98
  const endpoint = "https://<resource name>.cognitiveservices.azure.com";
100
99
  const credential = new AzureKeyCredential("<api key>");
@@ -14,9 +14,8 @@ import type { KeyCredential, TokenCredential } from "@azure/core-auth";
14
14
  *
15
15
  * #### API Key
16
16
  *
17
- * ```ts snippet:ReadmeSampleCreateClient_Node
18
- * import { AzureKeyCredential } from "@azure/core-auth";
19
- * import { TextAnalysisClient } from "@azure/ai-language-text";
17
+ * ```ts snippet:ReadmeSampleCreateClient_Key
18
+ * import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
20
19
  *
21
20
  * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
22
21
  * const credential = new AzureKeyCredential("<api key>");
@@ -52,9 +51,8 @@ export declare class TextAnalysisClient {
52
51
  *
53
52
  * ### Example
54
53
  *
55
- * ```ts snippet:ReadmeSampleCreateClient_Node
56
- * import { AzureKeyCredential } from "@azure/core-auth";
57
- * import { TextAnalysisClient } from "@azure/ai-language-text";
54
+ * ```ts snippet:ReadmeSampleCreateClient_Key
55
+ * import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
58
56
  *
59
57
  * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
60
58
  * const credential = new AzureKeyCredential("<api key>");
@@ -109,7 +107,7 @@ export declare class TextAnalysisClient {
109
107
  *
110
108
  * ```ts snippet:Sample_LanguageDetection
111
109
  * import { TextAnalysisClient } from "@azure/ai-language-text";
112
- * import { AzureKeyCredential } from "@azure/core-auth";
110
+ * import { DefaultAzureCredential } from "@azure/identity";
113
111
  *
114
112
  * const documents = [
115
113
  * "This document is written in English.",
@@ -119,7 +117,7 @@ export declare class TextAnalysisClient {
119
117
  * "Detta är ett dokument skrivet på engelska.",
120
118
  * ];
121
119
  *
122
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
120
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
123
121
  *
124
122
  * const result = await client.analyze("LanguageDetection", documents, "us", {
125
123
  * modelVersion: "2022-04-10-preview",
@@ -162,7 +160,7 @@ export declare class TextAnalysisClient {
162
160
  *
163
161
  * ```ts snippet:Sample_LanguageDetection
164
162
  * import { TextAnalysisClient } from "@azure/ai-language-text";
165
- * import { AzureKeyCredential } from "@azure/core-auth";
163
+ * import { DefaultAzureCredential } from "@azure/identity";
166
164
  *
167
165
  * const documents = [
168
166
  * "This document is written in English.",
@@ -172,7 +170,7 @@ export declare class TextAnalysisClient {
172
170
  * "Detta är ett dokument skrivet på engelska.",
173
171
  * ];
174
172
  *
175
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
173
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
176
174
  *
177
175
  * const result = await client.analyze("LanguageDetection", documents, "us", {
178
176
  * modelVersion: "2022-04-10-preview",
@@ -226,14 +224,14 @@ export declare class TextAnalysisClient {
226
224
  *
227
225
  * ```ts snippet:Sample_SentimentAnalysis
228
226
  * import { TextAnalysisClient } from "@azure/ai-language-text";
229
- * import { AzureKeyCredential } from "@azure/core-auth";
227
+ * import { DefaultAzureCredential } from "@azure/identity";
230
228
  *
231
229
  * const documents = [
232
230
  * "I had the best day of my life.",
233
231
  * "This was a waste of my time. The speaker put me to sleep.",
234
232
  * ];
235
233
  *
236
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
234
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
237
235
  *
238
236
  * const results = await client.analyze("SentimentAnalysis", documents);
239
237
  *
@@ -262,10 +260,14 @@ export declare class TextAnalysisClient {
262
260
  * #### Personally identifiable information
263
261
  *
264
262
  * ```ts snippet:Sample_PIIEntityRecognition
265
- * import { TextAnalysisClient } from "@azure/ai-language-text";
266
- * import { AzureKeyCredential } from "@azure/core-auth";
263
+ * import {
264
+ * TextAnalysisClient,
265
+ * KnownPiiEntityDomain,
266
+ * KnownPiiEntityCategory,
267
+ * } from "@azure/ai-language-text";
268
+ * import { DefaultAzureCredential } from "@azure/identity";
267
269
  *
268
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
270
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
269
271
  *
270
272
  * const documents = ["My phone number is 555-5555"];
271
273
  *
@@ -317,14 +319,14 @@ export declare class TextAnalysisClient {
317
319
  *
318
320
  * ```ts snippet:Sample_SentimentAnalysis
319
321
  * import { TextAnalysisClient } from "@azure/ai-language-text";
320
- * import { AzureKeyCredential } from "@azure/core-auth";
322
+ * import { DefaultAzureCredential } from "@azure/identity";
321
323
  *
322
324
  * const documents = [
323
325
  * "I had the best day of my life.",
324
326
  * "This was a waste of my time. The speaker put me to sleep.",
325
327
  * ];
326
328
  *
327
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
329
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
328
330
  *
329
331
  * const results = await client.analyze("SentimentAnalysis", documents);
330
332
  *
@@ -353,10 +355,14 @@ export declare class TextAnalysisClient {
353
355
  * #### Personally identifiable information
354
356
  *
355
357
  * ```ts snippet:Sample_PIIEntityRecognition
356
- * import { TextAnalysisClient } from "@azure/ai-language-text";
357
- * import { AzureKeyCredential } from "@azure/core-auth";
358
+ * import {
359
+ * TextAnalysisClient,
360
+ * KnownPiiEntityDomain,
361
+ * KnownPiiEntityCategory,
362
+ * } from "@azure/ai-language-text";
363
+ * import { DefaultAzureCredential } from "@azure/identity";
358
364
  *
359
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
365
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
360
366
  *
361
367
  * const documents = ["My phone number is 555-5555"];
362
368
  *
@@ -414,8 +420,8 @@ export declare class TextAnalysisClient {
414
420
  * #### Key phrase extraction and Pii entity recognition
415
421
  *
416
422
  * ```ts snippet:Sample_ActionBatching
417
- * import { TextAnalysisClient } from "@azure/ai-language-text";
418
- * import { AzureKeyCredential } from "@azure/core-auth";
423
+ * import { TextAnalysisClient, AnalyzeBatchAction } from "@azure/ai-language-text";
424
+ * import { DefaultAzureCredential } from "@azure/identity";
419
425
  *
420
426
  * const documents = [
421
427
  * "Microsoft was founded by Bill Gates and Paul Allen.",
@@ -425,7 +431,7 @@ export declare class TextAnalysisClient {
425
431
  * "We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!",
426
432
  * ];
427
433
  *
428
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
434
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
429
435
  *
430
436
  * const actions: AnalyzeBatchAction[] = [
431
437
  * {
@@ -543,8 +549,8 @@ export declare class TextAnalysisClient {
543
549
  * #### Keyphrase extraction and Pii entity recognition
544
550
  *
545
551
  * ```ts snippet:Sample_ActionBatching
546
- * import { TextAnalysisClient } from "@azure/ai-language-text";
547
- * import { AzureKeyCredential } from "@azure/core-auth";
552
+ * import { TextAnalysisClient, AnalyzeBatchAction } from "@azure/ai-language-text";
553
+ * import { DefaultAzureCredential } from "@azure/identity";
548
554
  *
549
555
  * const documents = [
550
556
  * "Microsoft was founded by Bill Gates and Paul Allen.",
@@ -554,7 +560,7 @@ export declare class TextAnalysisClient {
554
560
  * "We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!",
555
561
  * ];
556
562
  *
557
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
563
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
558
564
  *
559
565
  * const actions: AnalyzeBatchAction[] = [
560
566
  * {
@@ -1 +1 @@
1
- {"version":3,"file":"textAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/textAnalysisClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAGV,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAyBvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO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AS,EAAE,MAAM,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,kBAAkB,CAAC;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsHG;IACG,iBAAiB,CACrB,OAAO,EAAE,kBAAkB,EAAE,EAC7B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,kBAAkB,CAAC;IAuE9B;;;;;;;;;OASG;IACG,yBAAyB,CAC7B,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,gCAAgC,GACzC,OAAO,CAAC,kBAAkB,CAAC;CA0C/B"}
@@ -25,9 +25,8 @@ import { textAnalyticsAzureKeyCredentialPolicy } from "./azureKeyCredentialPolic
25
25
  *
26
26
  * #### API Key
27
27
  *
28
- * ```ts snippet:ReadmeSampleCreateClient_Node
29
- * import { AzureKeyCredential } from "@azure/core-auth";
30
- * import { TextAnalysisClient } from "@azure/ai-language-text";
28
+ * ```ts snippet:ReadmeSampleCreateClient_Key
29
+ * import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
31
30
  *
32
31
  * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
33
32
  * const credential = new AzureKeyCredential("<api key>");
@@ -1 +1 @@
1
- {"version":3,"file":"textAnalysisClient.js","sourceRoot":"","sources":["../../src/textAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,O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AAM,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC;QACzC,OAAO,4BAA4B,CAAC;YAClC,EAAE;YACF,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,OAAO;YACP,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AnalyzeActionName,\n AnalyzeActionParameters,\n AnalyzeBatchAction,\n AnalyzeBatchPoller,\n AnalyzeResult,\n BeginAnalyzeBatchOptions,\n RestoreAnalyzeBatchPollerOptions,\n TextAnalysisClientOptions,\n TextAnalysisOperationOptions,\n} from \"./models.js\";\nimport type {\n AnalyzeBatchActionUnion,\n GeneratedClientOptionalParams,\n LanguageDetectionInput,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport { DEFAULT_COGNITIVE_SCOPE, SDK_VERSION } from \"./constants.js\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport {\n convertToLanguageDetectionInput,\n convertToTextDocumentInput,\n getOperationOptions,\n isStringArray,\n} from \"./util.js\";\nimport {\n createAnalyzeBatchLro,\n createCreateAnalyzeBatchPollerLro,\n createPollerWithCancellation,\n createUpdateAnalyzeState,\n getDocIDsFromState,\n processAnalyzeResult,\n} from \"./lro.js\";\nimport { throwError, transformActionResult } from \"./transforms.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createHttpPoller } from \"@azure/core-lro\";\nimport { logger } from \"./logger.js\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the text analysis features in Azure Cognitive\n * Language Service.\n *\n * The client needs the endpoint of a Language resource and an authentication\n * method such as an API key or AAD. The API key and endpoint can be found in\n * the Language resource page in the Azure portal. They will be located in the\n * resource's Keys and Endpoint page, under Resource Management.\n *\n * ### Examples for authentication:\n *\n * #### API Key\n *\n * ```ts snippet:ReadmeSampleCreateClient_Node\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * #### Azure Active Directory\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity)\n * package for more information about authenticating with Azure Active Directory.\n *\n * ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n */\nexport class TextAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n private readonly defaultCountryHint: string;\n private readonly defaultLanguage: string;\n\n /**\n * Creates an instance of TextAnalysisClient with the endpoint of a Language\n * resource and an authentication method such as an API key or AAD.\n *\n * The API key and endpoint can be found in the Language resource page in the\n * Azure portal. They will be located in the resource's Keys and Endpoint page,\n * under Resource Management.\n *\n * ### Example\n *\n * ```ts snippet:ReadmeSampleCreateClient_Node\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * @param endpointUrl - The URL to the endpoint of a Cognitive Language Service resource\n * @param credential - Key credential to be used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(endpointUrl: string, credential: KeyCredential, options?: TextAnalysisClientOptions);\n /**\n * Creates an instance of TextAnalysisClient with the endpoint of a Language\n * resource and an authentication method such as an API key or AAD.\n *\n * The API key and endpoint can be found in the Language resource page in the\n * Azure portal. They will be located in the resource's Keys and Endpoint page,\n * under Resource Management.\n *\n * ### Example\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity)\n * package for more information about authenticating with Azure Active Directory.\n *\n * ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * @param endpointUrl - The URL to the endpoint of a Cognitive Language Service resource\n * @param credential - Token credential to be used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options?: TextAnalysisClientOptions,\n );\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalysisClientOptions = {},\n ) {\n const {\n defaultCountryHint = \"us\",\n defaultLanguage = \"en\",\n serviceVersion,\n ...pipelineOptions\n } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n apiVersion: serviceVersion,\n };\n\n this._client = new GeneratedClient(endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-text\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Language detection\n *\n * ```ts snippet:Sample_LanguageDetection\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"This document is written in English.\",\n * \"Este es un document escrito en Español.\",\n * \"这是一个用中文写的文件\",\n * \"Dies ist ein Dokument in deutsche Sprache.\",\n * \"Detta är ett dokument skrivet på engelska.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const result = await client.analyze(\"LanguageDetection\", documents, \"us\", {\n * modelVersion: \"2022-04-10-preview\",\n * });\n *\n * for (const doc of result) {\n * if (!doc.error) {\n * console.log(\n * `Primary language: ${doc.primaryLanguage.name} (iso6391 name: ${doc.primaryLanguage.iso6391Name})`,\n * );\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/language-detection/overview}\n * for more information on language detection.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results where each element contains the primary language\n * for the corresponding input document.\n */\n public async analyze<ActionName extends \"LanguageDetection\">(\n actionName: ActionName,\n documents: LanguageDetectionInput[],\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Language detection\n *\n * ```ts snippet:Sample_LanguageDetection\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"This document is written in English.\",\n * \"Este es un document escrito en Español.\",\n * \"这是一个用中文写的文件\",\n * \"Dies ist ein Dokument in deutsche Sprache.\",\n * \"Detta är ett dokument skrivet på engelska.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const result = await client.analyze(\"LanguageDetection\", documents, \"us\", {\n * modelVersion: \"2022-04-10-preview\",\n * });\n *\n * for (const doc of result) {\n * if (!doc.error) {\n * console.log(\n * `Primary language: ${doc.primaryLanguage.name} (iso6391 name: ${doc.primaryLanguage.iso6391Name})`,\n * );\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/language-detection/overview}\n * for more information on language detection.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the model in predicting the language they are\n * written in. If unspecified, this value will be set to the default\n * country hint in `TextAnalysisClientOptions`. If set to an empty string,\n * or the string \"none\", the service will apply a model where the country is\n * explicitly unset. The same country hint is applied to all strings in the\n * input collection.\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results where each element contains the primary language\n * for the corresponding input document.\n */\n public async analyze<ActionName extends \"LanguageDetection\">(\n actionName: ActionName,\n documents: string[],\n countryHint?: string,\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n /**\n * Runs a predictive model to perform the action of choice on the input\n * documents. See ${@link AnalyzeActionName} for a list of supported\n * actions.\n *\n * The layout of each item in the results array depends on the action chosen.\n * For example, each PIIEntityRecognition document result consists of both\n * `entities` and `redactedText` where the former is a list of all Pii entities\n * in the text and the latter is the original text after all such Pii entities\n * have been redacted from it.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Opinion mining\n *\n * ```ts snippet:Sample_SentimentAnalysis\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"I had the best day of my life.\",\n * \"This was a waste of my time. The speaker put me to sleep.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const results = await client.analyze(\"SentimentAnalysis\", documents);\n *\n * for (let i = 0; i < results.length; i++) {\n * const result = results[i];\n * console.log(`- Document ${result.id}`);\n * if (!result.error) {\n * console.log(`\\tDocument text: ${documents[i]}`);\n * console.log(`\\tOverall Sentiment: ${result.sentiment}`);\n * console.log(\"\\tSentiment confidence scores: \", result.confidenceScores);\n * console.log(\"\\tSentences\");\n * for (const { sentiment, confidenceScores, text } of result.sentences) {\n * console.log(`\\t- Sentence text: ${text}`);\n * console.log(`\\t Sentence sentiment: ${sentiment}`);\n * console.log(\"\\t Confidence scores:\", confidenceScores);\n * }\n * } else {\n * console.error(` Error: ${result.error}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/sentiment-opinion-mining/overview}\n * for more information on opinion mining.\n *\n * #### Personally identifiable information\n *\n * ```ts snippet:Sample_PIIEntityRecognition\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const documents = [\"My phone number is 555-5555\"];\n *\n * const [result] = await client.analyze(\"PiiEntityRecognition\", documents, \"en\", {\n * domainFilter: KnownPiiEntityDomain.Phi,\n * categoriesFilter: [\n * KnownPiiEntityCategory.PhoneNumber,\n * KnownPiiEntityCategory.USSocialSecurityNumber,\n * ],\n * });\n *\n * if (!result.error) {\n * console.log(`Redacted text: \"${result.redactedText}\"`);\n * console.log(\"Pii Entities: \");\n * for (const entity of result.entities) {\n * console.log(`\\t- \"${entity.text}\" of type ${entity.category}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/personally-identifiable-information/overview}\n * for more information on personally identifiable information.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results corresponding to the input documents\n */\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: TextDocumentInput[],\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n\n /**\n * Runs a predictive model to perform the action of choice on the input\n * strings. See ${@link AnalyzeActionName} for a list of supported\n * actions.\n *\n * The layout of each item in the results array depends on the action chosen.\n * For example, each PIIEntityRecognition document result consists of both\n * `entities` and `redactedText` where the former is a list of all Pii entities\n * in the text and the latter is the original text after all such Pii entities\n * have been redacted from it.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Opinion mining\n *\n * ```ts snippet:Sample_SentimentAnalysis\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"I had the best day of my life.\",\n * \"This was a waste of my time. The speaker put me to sleep.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const results = await client.analyze(\"SentimentAnalysis\", documents);\n *\n * for (let i = 0; i < results.length; i++) {\n * const result = results[i];\n * console.log(`- Document ${result.id}`);\n * if (!result.error) {\n * console.log(`\\tDocument text: ${documents[i]}`);\n * console.log(`\\tOverall Sentiment: ${result.sentiment}`);\n * console.log(\"\\tSentiment confidence scores: \", result.confidenceScores);\n * console.log(\"\\tSentences\");\n * for (const { sentiment, confidenceScores, text } of result.sentences) {\n * console.log(`\\t- Sentence text: ${text}`);\n * console.log(`\\t Sentence sentiment: ${sentiment}`);\n * console.log(\"\\t Confidence scores:\", confidenceScores);\n * }\n * } else {\n * console.error(` Error: ${result.error}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/sentiment-opinion-mining/overview}\n * for more information on opinion mining.\n *\n * #### Personally identifiable information\n *\n * ```ts snippet:Sample_PIIEntityRecognition\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const documents = [\"My phone number is 555-5555\"];\n *\n * const [result] = await client.analyze(\"PiiEntityRecognition\", documents, \"en\", {\n * domainFilter: KnownPiiEntityDomain.Phi,\n * categoriesFilter: [\n * KnownPiiEntityCategory.PhoneNumber,\n * KnownPiiEntityCategory.USSocialSecurityNumber,\n * ],\n * });\n *\n * if (!result.error) {\n * console.log(`Redacted text: \"${result.redactedText}\"`);\n * console.log(\"Pii Entities: \");\n * for (const entity of result.entities) {\n * console.log(`\\t- \"${entity.text}\" of type ${entity.category}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/personally-identifiable-information/overview}\n * for more information on personally identifiable information.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param languageCode - the code of the language that all the input strings are\n * written in. If unspecified, this value will be set to the default\n * language in `TextAnalysisClientOptions`. If set to an empty string,\n * the service will apply a model where the language is explicitly set to\n * \"None\". Language support varies per action, for example, more information\n * about the languages supported for Entity Recognition actions can be\n * found in {@link https://learn.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.\n * If set to \"auto\", the service will automatically infer the language from\n * the input text.\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results corresponding to the input documents\n */\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: string[],\n languageCode?: string,\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n // implementation\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: string[] | LanguageDetectionInput[] | TextDocumentInput[],\n languageOrCountryHintOrOptions?:\n | string\n | (AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions),\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>> {\n let realOptions: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions;\n\n if (documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n let realInputs: LanguageDetectionInput[] | TextDocumentInput[];\n if (isStringArray(documents)) {\n if (actionName === \"LanguageDetection\") {\n realInputs = convertToLanguageDetectionInput(\n documents,\n typeof languageOrCountryHintOrOptions === \"string\"\n ? languageOrCountryHintOrOptions\n : this.defaultCountryHint,\n );\n } else {\n realInputs = convertToTextDocumentInput(\n documents,\n typeof languageOrCountryHintOrOptions === \"string\"\n ? languageOrCountryHintOrOptions\n : this.defaultLanguage,\n );\n }\n realOptions = options || ({} as any);\n } else {\n realInputs = documents;\n realOptions =\n (languageOrCountryHintOrOptions as AnalyzeActionParameters<ActionName> &\n TextAnalysisOperationOptions) || {};\n }\n const { options: operationOptions, rest: action } = getOperationOptions(realOptions);\n return this._tracing.withSpan(\n \"TextAnalysisClient.analyze\",\n operationOptions,\n async (updatedOptions: TextAnalysisOperationOptions) =>\n throwError(\n this._client\n .analyze(\n {\n kind: actionName,\n analysisInput: {\n documents: realInputs,\n },\n parameters: action,\n } as any,\n updatedOptions,\n )\n .then(\n (result) =>\n transformActionResult(\n actionName,\n realInputs.map(({ id }) => id),\n result,\n ) as AnalyzeResult<ActionName>,\n ),\n ),\n );\n }\n\n /**\n * Performs an array (batch) of actions on the input documents. Each action has\n * a `kind` field that specifies the nature of the action. See ${@link AnalyzeBatchActionNames}\n * for a list of supported actions. In addition to `kind`, actions could also\n * have other parameters such as `disableServiceLogs` and `modelVersion`.\n *\n * The results array contains the results for those input actions where each\n * item also has a `kind` field that specifies the type of the results.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Key phrase extraction and Pii entity recognition\n *\n * ```ts snippet:Sample_ActionBatching\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"Microsoft was founded by Bill Gates and Paul Allen.\",\n * \"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.\",\n * \"I need to take my cat to the veterinarian.\",\n * \"The employee's SSN is 555-55-5555.\",\n * \"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const actions: AnalyzeBatchAction[] = [\n * {\n * kind: \"EntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"PiiEntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"KeyPhraseExtraction\",\n * modelVersion: \"latest\",\n * },\n * ];\n * const poller = await client.beginAnalyzeBatch(actions, documents, \"en\");\n *\n * poller.onProgress(() => {\n * console.log(\n * `Number of actions still in progress: ${poller.getOperationState().actionInProgressCount}`,\n * );\n * });\n *\n * console.log(`The operation was created on ${poller.getOperationState().createdOn}`);\n *\n * console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);\n *\n * const actionResults = await poller.pollUntilDone();\n *\n * for await (const actionResult of actionResults) {\n * if (actionResult.error) {\n * const { code, message } = actionResult.error;\n * throw new Error(`Unexpected error (${code}): ${message}`);\n * }\n * switch (actionResult.kind) {\n * case \"KeyPhraseExtraction\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tKey phrases:\");\n * for (const phrase of doc.keyPhrases) {\n * console.log(`\\t- ${phrase}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"EntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tEntities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"PiiEntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tPii Entities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * default: {\n * throw new Error(`Unexpected action results: ${actionResult.kind}`);\n * }\n * }\n * }\n * ```\n *\n * @param actions - an array of actions that will be run on the input documents\n * @param documents - the input documents to be analyzed\n * @param languageCode - the code of the language that all the input strings are\n * written in. If unspecified, this value will be set to the default\n * language in `TextAnalysisClientOptions`. If set to an empty string,\n * the service will apply a model where the language is explicitly set to\n * \"None\". Language support varies per action, for example, more information\n * about the languages supported for Entity Recognition actions can be\n * found in {@link https://learn.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.\n * If set to \"auto\", the service will automatically infer the language from\n * the input text.\n * @param options - optional settings for the operation\n *\n * @returns an array of results corresponding to the input actions\n */\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: string[],\n languageCode?: string,\n options?: BeginAnalyzeBatchOptions,\n ): Promise<AnalyzeBatchPoller>;\n /**\n * Performs an array (batch) of actions on the input documents. Each action has\n * a `kind` field that specifies the nature of the action. See ${@link AnalyzeBatchActionNames}\n * for a list of supported actions. In addition to `kind`, actions could also\n * have other parameters such as `disableServiceLogs` and `modelVersion`.\n *\n * The results array contains the results for those input actions where each\n * item also has a `kind` field that specifies the type of the results.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Keyphrase extraction and Pii entity recognition\n *\n * ```ts snippet:Sample_ActionBatching\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n *\n * const documents = [\n * \"Microsoft was founded by Bill Gates and Paul Allen.\",\n * \"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.\",\n * \"I need to take my cat to the veterinarian.\",\n * \"The employee's SSN is 555-55-5555.\",\n * \"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n *\n * const actions: AnalyzeBatchAction[] = [\n * {\n * kind: \"EntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"PiiEntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"KeyPhraseExtraction\",\n * modelVersion: \"latest\",\n * },\n * ];\n * const poller = await client.beginAnalyzeBatch(actions, documents, \"en\");\n *\n * poller.onProgress(() => {\n * console.log(\n * `Number of actions still in progress: ${poller.getOperationState().actionInProgressCount}`,\n * );\n * });\n *\n * console.log(`The operation was created on ${poller.getOperationState().createdOn}`);\n *\n * console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);\n *\n * const actionResults = await poller.pollUntilDone();\n *\n * for await (const actionResult of actionResults) {\n * if (actionResult.error) {\n * const { code, message } = actionResult.error;\n * throw new Error(`Unexpected error (${code}): ${message}`);\n * }\n * switch (actionResult.kind) {\n * case \"KeyPhraseExtraction\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tKey phrases:\");\n * for (const phrase of doc.keyPhrases) {\n * console.log(`\\t- ${phrase}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"EntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tEntities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"PiiEntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tPii Entities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * default: {\n * throw new Error(`Unexpected action results: ${actionResult.kind}`);\n * }\n * }\n * }\n * ```\n *\n * @param actions - an array of actions that will be run on the input documents\n * @param documents - the input documents to be analyzed\n * @param options - optional settings for the operation\n *\n * @returns an array of results corresponding to the input actions\n */\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: TextDocumentInput[],\n options?: BeginAnalyzeBatchOptions,\n ): Promise<AnalyzeBatchPoller>;\n // implementation\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: TextDocumentInput[] | string[],\n languageOrOptions?: BeginAnalyzeBatchOptions | string,\n options: BeginAnalyzeBatchOptions = {},\n ): Promise<AnalyzeBatchPoller> {\n let realOptions: BeginAnalyzeBatchOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const languageCode = (languageOrOptions as string) ?? this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, languageCode);\n realOptions = options;\n } else {\n realInputs = documents;\n realOptions = languageOrOptions as BeginAnalyzeBatchOptions;\n }\n const realActions = actions.map(\n ({ kind, actionName, ...rest }): AnalyzeBatchActionUnion & { parameters: unknown } => ({\n kind,\n actionName,\n parameters: rest,\n }),\n );\n const { includeStatistics, updateIntervalInMs, displayName, ...rest } = realOptions;\n const lro = createAnalyzeBatchLro({\n client: this._client,\n commonOptions: rest,\n documents: realInputs,\n initialRequestOptions: { displayName },\n pollRequestOptions: { includeStatistics },\n tasks: realActions,\n tracing: this._tracing,\n });\n\n const docIds = realInputs.map(({ id }) => id);\n\n const state = { continuationToken: \"\" };\n\n const poller = await createHttpPoller(lro, {\n intervalInMs: updateIntervalInMs,\n processResult: processAnalyzeResult({\n client: this._client,\n tracing: this._tracing,\n docIds,\n opOptions: { ...rest, includeStatistics },\n state,\n }),\n updateState: createUpdateAnalyzeState(docIds),\n withOperationLocation(operationLocation: string) {\n state.continuationToken = operationLocation;\n },\n });\n\n await poller.poll();\n const id = poller.getOperationState().id;\n return createPollerWithCancellation({\n id,\n client: this._client,\n options,\n poller,\n tracing: this._tracing,\n });\n }\n\n /**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n *\n * @param serializedState - the serialized state of another poller. It is the\n * result of `poller.toString()`\n * @param options - optional settings for the operation\n *\n */\n async restoreAnalyzeBatchPoller(\n serializedState: string,\n options?: RestoreAnalyzeBatchPollerOptions,\n ): Promise<AnalyzeBatchPoller>;\n // implementation\n async restoreAnalyzeBatchPoller(\n serializedState: string,\n options: RestoreAnalyzeBatchPollerOptions = {},\n ): Promise<AnalyzeBatchPoller> {\n const { includeStatistics, updateIntervalInMs, ...rest } = options;\n const docIds = getDocIDsFromState(serializedState);\n const lro = createCreateAnalyzeBatchPollerLro({\n client: this._client,\n options: { ...rest, includeStatistics },\n tracing: this._tracing,\n });\n\n const state = { continuationToken: \"\" };\n\n const poller = await createHttpPoller(lro, {\n intervalInMs: updateIntervalInMs,\n restoreFrom: serializedState,\n processResult: processAnalyzeResult({\n client: this._client,\n tracing: this._tracing,\n docIds,\n opOptions: { ...rest, includeStatistics },\n state,\n }),\n updateState: createUpdateAnalyzeState(),\n withOperationLocation(operationLocation: string) {\n state.continuationToken = operationLocation;\n },\n });\n\n await poller.poll();\n const id = poller.getOperationState().id;\n return createPollerWithCancellation({\n id,\n client: this._client,\n options,\n poller,\n tracing: this._tracing,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"textAnalysisClient.js","sourceRoot":"","sources":["../../src/textAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,E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,CAAC;QACzC,OAAO,4BAA4B,CAAC;YAClC,EAAE;YACF,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,OAAO;YACP,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AnalyzeActionName,\n AnalyzeActionParameters,\n AnalyzeBatchAction,\n AnalyzeBatchPoller,\n AnalyzeResult,\n BeginAnalyzeBatchOptions,\n RestoreAnalyzeBatchPollerOptions,\n TextAnalysisClientOptions,\n TextAnalysisOperationOptions,\n} from \"./models.js\";\nimport type {\n AnalyzeBatchActionUnion,\n GeneratedClientOptionalParams,\n LanguageDetectionInput,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport { DEFAULT_COGNITIVE_SCOPE, SDK_VERSION } from \"./constants.js\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport {\n convertToLanguageDetectionInput,\n convertToTextDocumentInput,\n getOperationOptions,\n isStringArray,\n} from \"./util.js\";\nimport {\n createAnalyzeBatchLro,\n createCreateAnalyzeBatchPollerLro,\n createPollerWithCancellation,\n createUpdateAnalyzeState,\n getDocIDsFromState,\n processAnalyzeResult,\n} from \"./lro.js\";\nimport { throwError, transformActionResult } from \"./transforms.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createHttpPoller } from \"@azure/core-lro\";\nimport { logger } from \"./logger.js\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the text analysis features in Azure Cognitive\n * Language Service.\n *\n * The client needs the endpoint of a Language resource and an authentication\n * method such as an API key or AAD. The API key and endpoint can be found in\n * the Language resource page in the Azure portal. They will be located in the\n * resource's Keys and Endpoint page, under Resource Management.\n *\n * ### Examples for authentication:\n *\n * #### API Key\n *\n * ```ts snippet:ReadmeSampleCreateClient_Key\n * import { AzureKeyCredential, TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * #### Azure Active Directory\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity)\n * package for more information about authenticating with Azure Active Directory.\n *\n * ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n */\nexport class TextAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n private readonly defaultCountryHint: string;\n private readonly defaultLanguage: string;\n\n /**\n * Creates an instance of TextAnalysisClient with the endpoint of a Language\n * resource and an authentication method such as an API key or AAD.\n *\n * The API key and endpoint can be found in the Language resource page in the\n * Azure portal. They will be located in the resource's Keys and Endpoint page,\n * under Resource Management.\n *\n * ### Example\n *\n * ```ts snippet:ReadmeSampleCreateClient_Key\n * import { AzureKeyCredential, TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * @param endpointUrl - The URL to the endpoint of a Cognitive Language Service resource\n * @param credential - Key credential to be used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(endpointUrl: string, credential: KeyCredential, options?: TextAnalysisClientOptions);\n /**\n * Creates an instance of TextAnalysisClient with the endpoint of a Language\n * resource and an authentication method such as an API key or AAD.\n *\n * The API key and endpoint can be found in the Language resource page in the\n * Azure portal. They will be located in the resource's Keys and Endpoint page,\n * under Resource Management.\n *\n * ### Example\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity)\n * package for more information about authenticating with Azure Active Directory.\n *\n * ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new TextAnalysisClient(endpoint, credential);\n * ```\n *\n * @param endpointUrl - The URL to the endpoint of a Cognitive Language Service resource\n * @param credential - Token credential to be used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential,\n options?: TextAnalysisClientOptions,\n );\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalysisClientOptions = {},\n ) {\n const {\n defaultCountryHint = \"us\",\n defaultLanguage = \"en\",\n serviceVersion,\n ...pipelineOptions\n } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n apiVersion: serviceVersion,\n };\n\n this._client = new GeneratedClient(endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-text\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Language detection\n *\n * ```ts snippet:Sample_LanguageDetection\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"This document is written in English.\",\n * \"Este es un document escrito en Español.\",\n * \"这是一个用中文写的文件\",\n * \"Dies ist ein Dokument in deutsche Sprache.\",\n * \"Detta är ett dokument skrivet på engelska.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const result = await client.analyze(\"LanguageDetection\", documents, \"us\", {\n * modelVersion: \"2022-04-10-preview\",\n * });\n *\n * for (const doc of result) {\n * if (!doc.error) {\n * console.log(\n * `Primary language: ${doc.primaryLanguage.name} (iso6391 name: ${doc.primaryLanguage.iso6391Name})`,\n * );\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/language-detection/overview}\n * for more information on language detection.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results where each element contains the primary language\n * for the corresponding input document.\n */\n public async analyze<ActionName extends \"LanguageDetection\">(\n actionName: ActionName,\n documents: LanguageDetectionInput[],\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Language detection\n *\n * ```ts snippet:Sample_LanguageDetection\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"This document is written in English.\",\n * \"Este es un document escrito en Español.\",\n * \"这是一个用中文写的文件\",\n * \"Dies ist ein Dokument in deutsche Sprache.\",\n * \"Detta är ett dokument skrivet på engelska.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const result = await client.analyze(\"LanguageDetection\", documents, \"us\", {\n * modelVersion: \"2022-04-10-preview\",\n * });\n *\n * for (const doc of result) {\n * if (!doc.error) {\n * console.log(\n * `Primary language: ${doc.primaryLanguage.name} (iso6391 name: ${doc.primaryLanguage.iso6391Name})`,\n * );\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/language-detection/overview}\n * for more information on language detection.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the model in predicting the language they are\n * written in. If unspecified, this value will be set to the default\n * country hint in `TextAnalysisClientOptions`. If set to an empty string,\n * or the string \"none\", the service will apply a model where the country is\n * explicitly unset. The same country hint is applied to all strings in the\n * input collection.\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results where each element contains the primary language\n * for the corresponding input document.\n */\n public async analyze<ActionName extends \"LanguageDetection\">(\n actionName: ActionName,\n documents: string[],\n countryHint?: string,\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n /**\n * Runs a predictive model to perform the action of choice on the input\n * documents. See ${@link AnalyzeActionName} for a list of supported\n * actions.\n *\n * The layout of each item in the results array depends on the action chosen.\n * For example, each PIIEntityRecognition document result consists of both\n * `entities` and `redactedText` where the former is a list of all Pii entities\n * in the text and the latter is the original text after all such Pii entities\n * have been redacted from it.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Opinion mining\n *\n * ```ts snippet:Sample_SentimentAnalysis\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"I had the best day of my life.\",\n * \"This was a waste of my time. The speaker put me to sleep.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const results = await client.analyze(\"SentimentAnalysis\", documents);\n *\n * for (let i = 0; i < results.length; i++) {\n * const result = results[i];\n * console.log(`- Document ${result.id}`);\n * if (!result.error) {\n * console.log(`\\tDocument text: ${documents[i]}`);\n * console.log(`\\tOverall Sentiment: ${result.sentiment}`);\n * console.log(\"\\tSentiment confidence scores: \", result.confidenceScores);\n * console.log(\"\\tSentences\");\n * for (const { sentiment, confidenceScores, text } of result.sentences) {\n * console.log(`\\t- Sentence text: ${text}`);\n * console.log(`\\t Sentence sentiment: ${sentiment}`);\n * console.log(\"\\t Confidence scores:\", confidenceScores);\n * }\n * } else {\n * console.error(` Error: ${result.error}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/sentiment-opinion-mining/overview}\n * for more information on opinion mining.\n *\n * #### Personally identifiable information\n *\n * ```ts snippet:Sample_PIIEntityRecognition\n * import {\n * TextAnalysisClient,\n * KnownPiiEntityDomain,\n * KnownPiiEntityCategory,\n * } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const documents = [\"My phone number is 555-5555\"];\n *\n * const [result] = await client.analyze(\"PiiEntityRecognition\", documents, \"en\", {\n * domainFilter: KnownPiiEntityDomain.Phi,\n * categoriesFilter: [\n * KnownPiiEntityCategory.PhoneNumber,\n * KnownPiiEntityCategory.USSocialSecurityNumber,\n * ],\n * });\n *\n * if (!result.error) {\n * console.log(`Redacted text: \"${result.redactedText}\"`);\n * console.log(\"Pii Entities: \");\n * for (const entity of result.entities) {\n * console.log(`\\t- \"${entity.text}\" of type ${entity.category}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/personally-identifiable-information/overview}\n * for more information on personally identifiable information.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results corresponding to the input documents\n */\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: TextDocumentInput[],\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n\n /**\n * Runs a predictive model to perform the action of choice on the input\n * strings. See ${@link AnalyzeActionName} for a list of supported\n * actions.\n *\n * The layout of each item in the results array depends on the action chosen.\n * For example, each PIIEntityRecognition document result consists of both\n * `entities` and `redactedText` where the former is a list of all Pii entities\n * in the text and the latter is the original text after all such Pii entities\n * have been redacted from it.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Opinion mining\n *\n * ```ts snippet:Sample_SentimentAnalysis\n * import { TextAnalysisClient } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"I had the best day of my life.\",\n * \"This was a waste of my time. The speaker put me to sleep.\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const results = await client.analyze(\"SentimentAnalysis\", documents);\n *\n * for (let i = 0; i < results.length; i++) {\n * const result = results[i];\n * console.log(`- Document ${result.id}`);\n * if (!result.error) {\n * console.log(`\\tDocument text: ${documents[i]}`);\n * console.log(`\\tOverall Sentiment: ${result.sentiment}`);\n * console.log(\"\\tSentiment confidence scores: \", result.confidenceScores);\n * console.log(\"\\tSentences\");\n * for (const { sentiment, confidenceScores, text } of result.sentences) {\n * console.log(`\\t- Sentence text: ${text}`);\n * console.log(`\\t Sentence sentiment: ${sentiment}`);\n * console.log(\"\\t Confidence scores:\", confidenceScores);\n * }\n * } else {\n * console.error(` Error: ${result.error}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/sentiment-opinion-mining/overview}\n * for more information on opinion mining.\n *\n * #### Personally identifiable information\n *\n * ```ts snippet:Sample_PIIEntityRecognition\n * import {\n * TextAnalysisClient,\n * KnownPiiEntityDomain,\n * KnownPiiEntityCategory,\n * } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const documents = [\"My phone number is 555-5555\"];\n *\n * const [result] = await client.analyze(\"PiiEntityRecognition\", documents, \"en\", {\n * domainFilter: KnownPiiEntityDomain.Phi,\n * categoriesFilter: [\n * KnownPiiEntityCategory.PhoneNumber,\n * KnownPiiEntityCategory.USSocialSecurityNumber,\n * ],\n * });\n *\n * if (!result.error) {\n * console.log(`Redacted text: \"${result.redactedText}\"`);\n * console.log(\"Pii Entities: \");\n * for (const entity of result.entities) {\n * console.log(`\\t- \"${entity.text}\" of type ${entity.category}`);\n * }\n * }\n * ```\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/personally-identifiable-information/overview}\n * for more information on personally identifiable information.\n *\n * @param actionName - the name of the action to be performed on the input\n * documents, see ${@link AnalyzeActionName}\n * @param documents - the input documents to be analyzed\n * @param languageCode - the code of the language that all the input strings are\n * written in. If unspecified, this value will be set to the default\n * language in `TextAnalysisClientOptions`. If set to an empty string,\n * the service will apply a model where the language is explicitly set to\n * \"None\". Language support varies per action, for example, more information\n * about the languages supported for Entity Recognition actions can be\n * found in {@link https://learn.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.\n * If set to \"auto\", the service will automatically infer the language from\n * the input text.\n * @param options - optional action parameters and settings for the operation\n *\n * @returns an array of results corresponding to the input documents\n */\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: string[],\n languageCode?: string,\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>>;\n // implementation\n public async analyze<ActionName extends AnalyzeActionName = AnalyzeActionName>(\n actionName: ActionName,\n documents: string[] | LanguageDetectionInput[] | TextDocumentInput[],\n languageOrCountryHintOrOptions?:\n | string\n | (AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions),\n options?: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions,\n ): Promise<AnalyzeResult<ActionName>> {\n let realOptions: AnalyzeActionParameters<ActionName> & TextAnalysisOperationOptions;\n\n if (documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n let realInputs: LanguageDetectionInput[] | TextDocumentInput[];\n if (isStringArray(documents)) {\n if (actionName === \"LanguageDetection\") {\n realInputs = convertToLanguageDetectionInput(\n documents,\n typeof languageOrCountryHintOrOptions === \"string\"\n ? languageOrCountryHintOrOptions\n : this.defaultCountryHint,\n );\n } else {\n realInputs = convertToTextDocumentInput(\n documents,\n typeof languageOrCountryHintOrOptions === \"string\"\n ? languageOrCountryHintOrOptions\n : this.defaultLanguage,\n );\n }\n realOptions = options || ({} as any);\n } else {\n realInputs = documents;\n realOptions =\n (languageOrCountryHintOrOptions as AnalyzeActionParameters<ActionName> &\n TextAnalysisOperationOptions) || {};\n }\n const { options: operationOptions, rest: action } = getOperationOptions(realOptions);\n return this._tracing.withSpan(\n \"TextAnalysisClient.analyze\",\n operationOptions,\n async (updatedOptions: TextAnalysisOperationOptions) =>\n throwError(\n this._client\n .analyze(\n {\n kind: actionName,\n analysisInput: {\n documents: realInputs,\n },\n parameters: action,\n } as any,\n updatedOptions,\n )\n .then(\n (result) =>\n transformActionResult(\n actionName,\n realInputs.map(({ id }) => id),\n result,\n ) as AnalyzeResult<ActionName>,\n ),\n ),\n );\n }\n\n /**\n * Performs an array (batch) of actions on the input documents. Each action has\n * a `kind` field that specifies the nature of the action. See ${@link AnalyzeBatchActionNames}\n * for a list of supported actions. In addition to `kind`, actions could also\n * have other parameters such as `disableServiceLogs` and `modelVersion`.\n *\n * The results array contains the results for those input actions where each\n * item also has a `kind` field that specifies the type of the results.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Key phrase extraction and Pii entity recognition\n *\n * ```ts snippet:Sample_ActionBatching\n * import { TextAnalysisClient, AnalyzeBatchAction } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"Microsoft was founded by Bill Gates and Paul Allen.\",\n * \"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.\",\n * \"I need to take my cat to the veterinarian.\",\n * \"The employee's SSN is 555-55-5555.\",\n * \"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const actions: AnalyzeBatchAction[] = [\n * {\n * kind: \"EntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"PiiEntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"KeyPhraseExtraction\",\n * modelVersion: \"latest\",\n * },\n * ];\n * const poller = await client.beginAnalyzeBatch(actions, documents, \"en\");\n *\n * poller.onProgress(() => {\n * console.log(\n * `Number of actions still in progress: ${poller.getOperationState().actionInProgressCount}`,\n * );\n * });\n *\n * console.log(`The operation was created on ${poller.getOperationState().createdOn}`);\n *\n * console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);\n *\n * const actionResults = await poller.pollUntilDone();\n *\n * for await (const actionResult of actionResults) {\n * if (actionResult.error) {\n * const { code, message } = actionResult.error;\n * throw new Error(`Unexpected error (${code}): ${message}`);\n * }\n * switch (actionResult.kind) {\n * case \"KeyPhraseExtraction\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tKey phrases:\");\n * for (const phrase of doc.keyPhrases) {\n * console.log(`\\t- ${phrase}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"EntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tEntities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"PiiEntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tPii Entities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * default: {\n * throw new Error(`Unexpected action results: ${actionResult.kind}`);\n * }\n * }\n * }\n * ```\n *\n * @param actions - an array of actions that will be run on the input documents\n * @param documents - the input documents to be analyzed\n * @param languageCode - the code of the language that all the input strings are\n * written in. If unspecified, this value will be set to the default\n * language in `TextAnalysisClientOptions`. If set to an empty string,\n * the service will apply a model where the language is explicitly set to\n * \"None\". Language support varies per action, for example, more information\n * about the languages supported for Entity Recognition actions can be\n * found in {@link https://learn.microsoft.com//azure/cognitive-services/language-service/named-entity-recognition/language-support}.\n * If set to \"auto\", the service will automatically infer the language from\n * the input text.\n * @param options - optional settings for the operation\n *\n * @returns an array of results corresponding to the input actions\n */\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: string[],\n languageCode?: string,\n options?: BeginAnalyzeBatchOptions,\n ): Promise<AnalyzeBatchPoller>;\n /**\n * Performs an array (batch) of actions on the input documents. Each action has\n * a `kind` field that specifies the nature of the action. See ${@link AnalyzeBatchActionNames}\n * for a list of supported actions. In addition to `kind`, actions could also\n * have other parameters such as `disableServiceLogs` and `modelVersion`.\n *\n * The results array contains the results for those input actions where each\n * item also has a `kind` field that specifies the type of the results.\n *\n * See {@link https://learn.microsoft.com//azure/cognitive-services/language-service/concepts/data-limits}\n * for data limits.\n *\n * ### Examples\n *\n * #### Keyphrase extraction and Pii entity recognition\n *\n * ```ts snippet:Sample_ActionBatching\n * import { TextAnalysisClient, AnalyzeBatchAction } from \"@azure/ai-language-text\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const documents = [\n * \"Microsoft was founded by Bill Gates and Paul Allen.\",\n * \"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.\",\n * \"I need to take my cat to the veterinarian.\",\n * \"The employee's SSN is 555-55-5555.\",\n * \"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!\",\n * ];\n *\n * const client = new TextAnalysisClient(\"<endpoint>\", new DefaultAzureCredential());\n *\n * const actions: AnalyzeBatchAction[] = [\n * {\n * kind: \"EntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"PiiEntityRecognition\",\n * modelVersion: \"latest\",\n * },\n * {\n * kind: \"KeyPhraseExtraction\",\n * modelVersion: \"latest\",\n * },\n * ];\n * const poller = await client.beginAnalyzeBatch(actions, documents, \"en\");\n *\n * poller.onProgress(() => {\n * console.log(\n * `Number of actions still in progress: ${poller.getOperationState().actionInProgressCount}`,\n * );\n * });\n *\n * console.log(`The operation was created on ${poller.getOperationState().createdOn}`);\n *\n * console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);\n *\n * const actionResults = await poller.pollUntilDone();\n *\n * for await (const actionResult of actionResults) {\n * if (actionResult.error) {\n * const { code, message } = actionResult.error;\n * throw new Error(`Unexpected error (${code}): ${message}`);\n * }\n * switch (actionResult.kind) {\n * case \"KeyPhraseExtraction\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tKey phrases:\");\n * for (const phrase of doc.keyPhrases) {\n * console.log(`\\t- ${phrase}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"EntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tEntities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * case \"PiiEntityRecognition\": {\n * for (const doc of actionResult.results) {\n * console.log(`- Document ${doc.id}`);\n * if (!doc.error) {\n * console.log(\"\\tPii Entities:\");\n * for (const entity of doc.entities) {\n * console.log(`\\t- Entity ${entity.text} of type ${entity.category}`);\n * }\n * } else {\n * console.error(\"\\tError:\", doc.error);\n * }\n * }\n * break;\n * }\n * default: {\n * throw new Error(`Unexpected action results: ${actionResult.kind}`);\n * }\n * }\n * }\n * ```\n *\n * @param actions - an array of actions that will be run on the input documents\n * @param documents - the input documents to be analyzed\n * @param options - optional settings for the operation\n *\n * @returns an array of results corresponding to the input actions\n */\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: TextDocumentInput[],\n options?: BeginAnalyzeBatchOptions,\n ): Promise<AnalyzeBatchPoller>;\n // implementation\n async beginAnalyzeBatch(\n actions: AnalyzeBatchAction[],\n documents: TextDocumentInput[] | string[],\n languageOrOptions?: BeginAnalyzeBatchOptions | string,\n options: BeginAnalyzeBatchOptions = {},\n ): Promise<AnalyzeBatchPoller> {\n let realOptions: BeginAnalyzeBatchOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const languageCode = (languageOrOptions as string) ?? this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, languageCode);\n realOptions = options;\n } else {\n realInputs = documents;\n realOptions = languageOrOptions as BeginAnalyzeBatchOptions;\n }\n const realActions = actions.map(\n ({ kind, actionName, ...rest }): AnalyzeBatchActionUnion & { parameters: unknown } => ({\n kind,\n actionName,\n parameters: rest,\n }),\n );\n const { includeStatistics, updateIntervalInMs, displayName, ...rest } = realOptions;\n const lro = createAnalyzeBatchLro({\n client: this._client,\n commonOptions: rest,\n documents: realInputs,\n initialRequestOptions: { displayName },\n pollRequestOptions: { includeStatistics },\n tasks: realActions,\n tracing: this._tracing,\n });\n\n const docIds = realInputs.map(({ id }) => id);\n\n const state = { continuationToken: \"\" };\n\n const poller = await createHttpPoller(lro, {\n intervalInMs: updateIntervalInMs,\n processResult: processAnalyzeResult({\n client: this._client,\n tracing: this._tracing,\n docIds,\n opOptions: { ...rest, includeStatistics },\n state,\n }),\n updateState: createUpdateAnalyzeState(docIds),\n withOperationLocation(operationLocation: string) {\n state.continuationToken = operationLocation;\n },\n });\n\n await poller.poll();\n const id = poller.getOperationState().id;\n return createPollerWithCancellation({\n id,\n client: this._client,\n options,\n poller,\n tracing: this._tracing,\n });\n }\n\n /**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n *\n * @param serializedState - the serialized state of another poller. It is the\n * result of `poller.toString()`\n * @param options - optional settings for the operation\n *\n */\n async restoreAnalyzeBatchPoller(\n serializedState: string,\n options?: RestoreAnalyzeBatchPollerOptions,\n ): Promise<AnalyzeBatchPoller>;\n // implementation\n async restoreAnalyzeBatchPoller(\n serializedState: string,\n options: RestoreAnalyzeBatchPollerOptions = {},\n ): Promise<AnalyzeBatchPoller> {\n const { includeStatistics, updateIntervalInMs, ...rest } = options;\n const docIds = getDocIDsFromState(serializedState);\n const lro = createCreateAnalyzeBatchPollerLro({\n client: this._client,\n options: { ...rest, includeStatistics },\n tracing: this._tracing,\n });\n\n const state = { continuationToken: \"\" };\n\n const poller = await createHttpPoller(lro, {\n intervalInMs: updateIntervalInMs,\n restoreFrom: serializedState,\n processResult: processAnalyzeResult({\n client: this._client,\n tracing: this._tracing,\n docIds,\n opOptions: { ...rest, includeStatistics },\n state,\n }),\n updateState: createUpdateAnalyzeState(),\n withOperationLocation(operationLocation: string) {\n state.continuationToken = operationLocation;\n },\n });\n\n await poller.poll();\n const id = poller.getOperationState().id;\n return createPollerWithCancellation({\n id,\n client: this._client,\n options,\n poller,\n tracing: this._tracing,\n });\n }\n}\n"]}
@@ -14,9 +14,8 @@ import type { KeyCredential, TokenCredential } from "@azure/core-auth";
14
14
  *
15
15
  * #### API Key
16
16
  *
17
- * ```ts snippet:ReadmeSampleCreateClient_Node
18
- * import { AzureKeyCredential } from "@azure/core-auth";
19
- * import { TextAnalysisClient } from "@azure/ai-language-text";
17
+ * ```ts snippet:ReadmeSampleCreateClient_Key
18
+ * import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
20
19
  *
21
20
  * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
22
21
  * const credential = new AzureKeyCredential("<api key>");
@@ -52,9 +51,8 @@ export declare class TextAnalysisClient {
52
51
  *
53
52
  * ### Example
54
53
  *
55
- * ```ts snippet:ReadmeSampleCreateClient_Node
56
- * import { AzureKeyCredential } from "@azure/core-auth";
57
- * import { TextAnalysisClient } from "@azure/ai-language-text";
54
+ * ```ts snippet:ReadmeSampleCreateClient_Key
55
+ * import { AzureKeyCredential, TextAnalysisClient } from "@azure/ai-language-text";
58
56
  *
59
57
  * const endpoint = "https://<resource name>.cognitiveservices.azure.com";
60
58
  * const credential = new AzureKeyCredential("<api key>");
@@ -109,7 +107,7 @@ export declare class TextAnalysisClient {
109
107
  *
110
108
  * ```ts snippet:Sample_LanguageDetection
111
109
  * import { TextAnalysisClient } from "@azure/ai-language-text";
112
- * import { AzureKeyCredential } from "@azure/core-auth";
110
+ * import { DefaultAzureCredential } from "@azure/identity";
113
111
  *
114
112
  * const documents = [
115
113
  * "This document is written in English.",
@@ -119,7 +117,7 @@ export declare class TextAnalysisClient {
119
117
  * "Detta är ett dokument skrivet på engelska.",
120
118
  * ];
121
119
  *
122
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
120
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
123
121
  *
124
122
  * const result = await client.analyze("LanguageDetection", documents, "us", {
125
123
  * modelVersion: "2022-04-10-preview",
@@ -162,7 +160,7 @@ export declare class TextAnalysisClient {
162
160
  *
163
161
  * ```ts snippet:Sample_LanguageDetection
164
162
  * import { TextAnalysisClient } from "@azure/ai-language-text";
165
- * import { AzureKeyCredential } from "@azure/core-auth";
163
+ * import { DefaultAzureCredential } from "@azure/identity";
166
164
  *
167
165
  * const documents = [
168
166
  * "This document is written in English.",
@@ -172,7 +170,7 @@ export declare class TextAnalysisClient {
172
170
  * "Detta är ett dokument skrivet på engelska.",
173
171
  * ];
174
172
  *
175
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
173
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
176
174
  *
177
175
  * const result = await client.analyze("LanguageDetection", documents, "us", {
178
176
  * modelVersion: "2022-04-10-preview",
@@ -226,14 +224,14 @@ export declare class TextAnalysisClient {
226
224
  *
227
225
  * ```ts snippet:Sample_SentimentAnalysis
228
226
  * import { TextAnalysisClient } from "@azure/ai-language-text";
229
- * import { AzureKeyCredential } from "@azure/core-auth";
227
+ * import { DefaultAzureCredential } from "@azure/identity";
230
228
  *
231
229
  * const documents = [
232
230
  * "I had the best day of my life.",
233
231
  * "This was a waste of my time. The speaker put me to sleep.",
234
232
  * ];
235
233
  *
236
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
234
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
237
235
  *
238
236
  * const results = await client.analyze("SentimentAnalysis", documents);
239
237
  *
@@ -262,10 +260,14 @@ export declare class TextAnalysisClient {
262
260
  * #### Personally identifiable information
263
261
  *
264
262
  * ```ts snippet:Sample_PIIEntityRecognition
265
- * import { TextAnalysisClient } from "@azure/ai-language-text";
266
- * import { AzureKeyCredential } from "@azure/core-auth";
263
+ * import {
264
+ * TextAnalysisClient,
265
+ * KnownPiiEntityDomain,
266
+ * KnownPiiEntityCategory,
267
+ * } from "@azure/ai-language-text";
268
+ * import { DefaultAzureCredential } from "@azure/identity";
267
269
  *
268
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
270
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
269
271
  *
270
272
  * const documents = ["My phone number is 555-5555"];
271
273
  *
@@ -317,14 +319,14 @@ export declare class TextAnalysisClient {
317
319
  *
318
320
  * ```ts snippet:Sample_SentimentAnalysis
319
321
  * import { TextAnalysisClient } from "@azure/ai-language-text";
320
- * import { AzureKeyCredential } from "@azure/core-auth";
322
+ * import { DefaultAzureCredential } from "@azure/identity";
321
323
  *
322
324
  * const documents = [
323
325
  * "I had the best day of my life.",
324
326
  * "This was a waste of my time. The speaker put me to sleep.",
325
327
  * ];
326
328
  *
327
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
329
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
328
330
  *
329
331
  * const results = await client.analyze("SentimentAnalysis", documents);
330
332
  *
@@ -353,10 +355,14 @@ export declare class TextAnalysisClient {
353
355
  * #### Personally identifiable information
354
356
  *
355
357
  * ```ts snippet:Sample_PIIEntityRecognition
356
- * import { TextAnalysisClient } from "@azure/ai-language-text";
357
- * import { AzureKeyCredential } from "@azure/core-auth";
358
+ * import {
359
+ * TextAnalysisClient,
360
+ * KnownPiiEntityDomain,
361
+ * KnownPiiEntityCategory,
362
+ * } from "@azure/ai-language-text";
363
+ * import { DefaultAzureCredential } from "@azure/identity";
358
364
  *
359
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
365
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
360
366
  *
361
367
  * const documents = ["My phone number is 555-5555"];
362
368
  *
@@ -414,8 +420,8 @@ export declare class TextAnalysisClient {
414
420
  * #### Key phrase extraction and Pii entity recognition
415
421
  *
416
422
  * ```ts snippet:Sample_ActionBatching
417
- * import { TextAnalysisClient } from "@azure/ai-language-text";
418
- * import { AzureKeyCredential } from "@azure/core-auth";
423
+ * import { TextAnalysisClient, AnalyzeBatchAction } from "@azure/ai-language-text";
424
+ * import { DefaultAzureCredential } from "@azure/identity";
419
425
  *
420
426
  * const documents = [
421
427
  * "Microsoft was founded by Bill Gates and Paul Allen.",
@@ -425,7 +431,7 @@ export declare class TextAnalysisClient {
425
431
  * "We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!",
426
432
  * ];
427
433
  *
428
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
434
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
429
435
  *
430
436
  * const actions: AnalyzeBatchAction[] = [
431
437
  * {
@@ -543,8 +549,8 @@ export declare class TextAnalysisClient {
543
549
  * #### Keyphrase extraction and Pii entity recognition
544
550
  *
545
551
  * ```ts snippet:Sample_ActionBatching
546
- * import { TextAnalysisClient } from "@azure/ai-language-text";
547
- * import { AzureKeyCredential } from "@azure/core-auth";
552
+ * import { TextAnalysisClient, AnalyzeBatchAction } from "@azure/ai-language-text";
553
+ * import { DefaultAzureCredential } from "@azure/identity";
548
554
  *
549
555
  * const documents = [
550
556
  * "Microsoft was founded by Bill Gates and Paul Allen.",
@@ -554,7 +560,7 @@ export declare class TextAnalysisClient {
554
560
  * "We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint I have is the food didn't come fast enough. Overall I highly recommend it!",
555
561
  * ];
556
562
  *
557
- * const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
563
+ * const client = new TextAnalysisClient("<endpoint>", new DefaultAzureCredential());
558
564
  *
559
565
  * const actions: AnalyzeBatchAction[] = [
560
566
  * {
@@ -1 +1 @@
1
- {"version":3,"file":"textAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/textAnalysisClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,gCAAgC,EAChC,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