@azure/ai-language-conversations 1.0.0-alpha.20250113.2 → 1.0.0-alpha.20250115.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 +9 -6
- package/dist/browser/conversationAnalysisClient.d.ts +3 -5
- package/dist/browser/conversationAnalysisClient.d.ts.map +1 -1
- package/dist/browser/conversationAnalysisClient.js +3 -5
- package/dist/browser/conversationAnalysisClient.js.map +1 -1
- package/dist/commonjs/conversationAnalysisClient.d.ts +3 -5
- package/dist/commonjs/conversationAnalysisClient.d.ts.map +1 -1
- package/dist/commonjs/conversationAnalysisClient.js +3 -5
- package/dist/commonjs/conversationAnalysisClient.js.map +1 -1
- package/dist/esm/conversationAnalysisClient.d.ts +3 -5
- package/dist/esm/conversationAnalysisClient.d.ts.map +1 -1
- package/dist/esm/conversationAnalysisClient.js +3 -5
- package/dist/esm/conversationAnalysisClient.js.map +1 -1
- package/dist/react-native/conversationAnalysisClient.d.ts +3 -5
- package/dist/react-native/conversationAnalysisClient.d.ts.map +1 -1
- package/dist/react-native/conversationAnalysisClient.js +3 -5
- package/dist/react-native/conversationAnalysisClient.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -64,11 +64,13 @@ az cognitiveservices account keys list --resource-group <your-resource-group-nam
|
|
|
64
64
|
|
|
65
65
|
Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
|
|
66
66
|
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
```ts snippet:ReadmeSampleCreateClient_Node
|
|
68
|
+
import { AzureKeyCredential } from "@azure/core-auth";
|
|
69
|
+
import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
70
70
|
|
|
71
|
-
const
|
|
71
|
+
const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
72
|
+
const credential = new AzureKeyCredential("<api key>");
|
|
73
|
+
const client = new ConversationAnalysisClient(endpoint, credential);
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
### JavaScript Bundle
|
|
@@ -87,8 +89,9 @@ To use this client library in the browser, first you need to use a bundler. For
|
|
|
87
89
|
|
|
88
90
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
89
91
|
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
+
```ts snippet:SetLogLevel
|
|
93
|
+
import { setLogLevel } from "@azure/logger";
|
|
94
|
+
|
|
92
95
|
setLogLevel("info");
|
|
93
96
|
```
|
|
94
97
|
|
|
@@ -14,13 +14,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
14
14
|
*
|
|
15
15
|
* #### API Key
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
18
18
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
19
19
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
20
20
|
*
|
|
21
21
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
22
22
|
* const credential = new AzureKeyCredential("<api key>");
|
|
23
|
-
*
|
|
24
23
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
@@ -29,13 +28,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
29
28
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
30
29
|
* package for more information about authenticating with Azure Active Directory.
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
33
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
31
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
34
32
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
33
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
35
34
|
*
|
|
36
35
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
37
36
|
* const credential = new DefaultAzureCredential();
|
|
38
|
-
*
|
|
39
37
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
40
38
|
* ```
|
|
41
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC;;;;;OAKG;gBAED,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,GAAG,aAAa,EAC3C,OAAO,GAAE,wCAA6C;IAiBxD;;;;OAIG;IACH,mBAAmB,CACjB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,iCAAiC,GAC1C,OAAO,CAAC,2BAA2B,CAAC;IAYvC;;;;OAIG;IACG,yBAAyB,CAC7B,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,kCAAkC,GAC3C,OAAO,CACR,UAAU,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,CAAC,CAC3F;CAUF"}
|
|
@@ -19,13 +19,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
19
19
|
*
|
|
20
20
|
* #### API Key
|
|
21
21
|
*
|
|
22
|
-
* ```
|
|
22
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
23
23
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
24
24
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
25
25
|
*
|
|
26
26
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
27
27
|
* const credential = new AzureKeyCredential("<api key>");
|
|
28
|
-
*
|
|
29
28
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
30
29
|
* ```
|
|
31
30
|
*
|
|
@@ -34,13 +33,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
34
33
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
35
34
|
* package for more information about authenticating with Azure Active Directory.
|
|
36
35
|
*
|
|
37
|
-
* ```
|
|
38
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
36
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
39
37
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
38
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
40
39
|
*
|
|
41
40
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
42
41
|
* const credential = new DefaultAzureCredential();
|
|
43
|
-
*
|
|
44
42
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
45
43
|
* ```
|
|
46
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,0BAA0B;IAIrC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,+BAA+B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,4CAA4C,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n */\n\nimport type {\n AnalyzeConversationJobsInput,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationTaskUnion,\n ConversationAnalysisClientOptionalParams,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse,\n} from \"./models.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 { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { ConversationAnalysisClient as GeneratedClient } from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { conversationAnalysisAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the conversational language understanding\n * features in Azure Cognitive 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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new ConversationAnalysisClient(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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n */\nexport class ConversationAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint - Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options - The parameter options\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options: ConversationAnalysisClientOptionalParams = {},\n ) {\n this._client = new GeneratedClient(endpoint, options);\n\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-conversations\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : conversationAnalysisAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task - A single conversational task to execute.\n * @param options - The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams,\n ): Promise<AnalyzeConversationResponse> {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.analyzeConversation\",\n options || {},\n (updatedOptions) =>\n this._client.analyzeConversation(\n task,\n updatedOptions,\n ) as Promise<AnalyzeConversationResponse>,\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task - The collection of conversations to analyze and one or more tasks to execute.\n * @param options - The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams,\n ): Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n > {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.beginConversationAnalysis\",\n options || {},\n (updatedOptions) =>\n this._client.beginConversationAnalysis(task, updatedOptions) as Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n >,\n );\n }\n}\n"]}
|
|
@@ -14,13 +14,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
14
14
|
*
|
|
15
15
|
* #### API Key
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
18
18
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
19
19
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
20
20
|
*
|
|
21
21
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
22
22
|
* const credential = new AzureKeyCredential("<api key>");
|
|
23
|
-
*
|
|
24
23
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
@@ -29,13 +28,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
29
28
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
30
29
|
* package for more information about authenticating with Azure Active Directory.
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
33
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
31
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
34
32
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
33
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
35
34
|
*
|
|
36
35
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
37
36
|
* const credential = new DefaultAzureCredential();
|
|
38
|
-
*
|
|
39
37
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
40
38
|
* ```
|
|
41
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC;;;;;OAKG;gBAED,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,GAAG,aAAa,EAC3C,OAAO,GAAE,wCAA6C;IAiBxD;;;;OAIG;IACH,mBAAmB,CACjB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,iCAAiC,GAC1C,OAAO,CAAC,2BAA2B,CAAC;IAYvC;;;;OAIG;IACG,yBAAyB,CAC7B,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,kCAAkC,GAC3C,OAAO,CACR,UAAU,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,CAAC,CAC3F;CAUF"}
|
|
@@ -22,13 +22,12 @@ const azureKeyCredentialPolicy_js_1 = require("./azureKeyCredentialPolicy.js");
|
|
|
22
22
|
*
|
|
23
23
|
* #### API Key
|
|
24
24
|
*
|
|
25
|
-
* ```
|
|
25
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
26
26
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
27
27
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
28
28
|
*
|
|
29
29
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
30
30
|
* const credential = new AzureKeyCredential("<api key>");
|
|
31
|
-
*
|
|
32
31
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
33
32
|
* ```
|
|
34
33
|
*
|
|
@@ -37,13 +36,12 @@ const azureKeyCredentialPolicy_js_1 = require("./azureKeyCredentialPolicy.js");
|
|
|
37
36
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
38
37
|
* package for more information about authenticating with Azure Active Directory.
|
|
39
38
|
*
|
|
40
|
-
* ```
|
|
41
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
39
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
42
40
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
41
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
43
42
|
*
|
|
44
43
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
45
44
|
* const credential = new DefaultAzureCredential();
|
|
46
|
-
*
|
|
47
45
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
48
46
|
* ```
|
|
49
47
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgBlC,iDAAsE;AAEtE,gDAAqD;AAGrD,sDAA0D;AAC1D,mDAAqF;AACrF,kEAA4E;AAC5E,+EAA6F;AAE7F
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgBlC,iDAAsE;AAEtE,gDAAqD;AAGrD,sDAA0D;AAC1D,mDAAqF;AACrF,kEAA4E;AAC5E,+EAA6F;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAa,0BAA0B;IAIrC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,IAAA,kCAAmB,EAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,0BAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,IAAA,6BAAiB,EAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,IAAA,oDAA+B,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,sCAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,IAAA,0EAA4C,EAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF;AAtED,gEAsEC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n */\n\nimport type {\n AnalyzeConversationJobsInput,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationTaskUnion,\n ConversationAnalysisClientOptionalParams,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse,\n} from \"./models.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 { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { ConversationAnalysisClient as GeneratedClient } from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { conversationAnalysisAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the conversational language understanding\n * features in Azure Cognitive 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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new ConversationAnalysisClient(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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n */\nexport class ConversationAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint - Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options - The parameter options\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options: ConversationAnalysisClientOptionalParams = {},\n ) {\n this._client = new GeneratedClient(endpoint, options);\n\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-conversations\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : conversationAnalysisAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task - A single conversational task to execute.\n * @param options - The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams,\n ): Promise<AnalyzeConversationResponse> {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.analyzeConversation\",\n options || {},\n (updatedOptions) =>\n this._client.analyzeConversation(\n task,\n updatedOptions,\n ) as Promise<AnalyzeConversationResponse>,\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task - The collection of conversations to analyze and one or more tasks to execute.\n * @param options - The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams,\n ): Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n > {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.beginConversationAnalysis\",\n options || {},\n (updatedOptions) =>\n this._client.beginConversationAnalysis(task, updatedOptions) as Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n >,\n );\n }\n}\n"]}
|
|
@@ -14,13 +14,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
14
14
|
*
|
|
15
15
|
* #### API Key
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
18
18
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
19
19
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
20
20
|
*
|
|
21
21
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
22
22
|
* const credential = new AzureKeyCredential("<api key>");
|
|
23
|
-
*
|
|
24
23
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
@@ -29,13 +28,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
29
28
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
30
29
|
* package for more information about authenticating with Azure Active Directory.
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
33
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
31
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
34
32
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
33
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
35
34
|
*
|
|
36
35
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
37
36
|
* const credential = new DefaultAzureCredential();
|
|
38
|
-
*
|
|
39
37
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
40
38
|
* ```
|
|
41
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC;;;;;OAKG;gBAED,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,GAAG,aAAa,EAC3C,OAAO,GAAE,wCAA6C;IAiBxD;;;;OAIG;IACH,mBAAmB,CACjB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,iCAAiC,GAC1C,OAAO,CAAC,2BAA2B,CAAC;IAYvC;;;;OAIG;IACG,yBAAyB,CAC7B,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,kCAAkC,GAC3C,OAAO,CACR,UAAU,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,CAAC,CAC3F;CAUF"}
|
|
@@ -19,13 +19,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
19
19
|
*
|
|
20
20
|
* #### API Key
|
|
21
21
|
*
|
|
22
|
-
* ```
|
|
22
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
23
23
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
24
24
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
25
25
|
*
|
|
26
26
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
27
27
|
* const credential = new AzureKeyCredential("<api key>");
|
|
28
|
-
*
|
|
29
28
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
30
29
|
* ```
|
|
31
30
|
*
|
|
@@ -34,13 +33,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
34
33
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
35
34
|
* package for more information about authenticating with Azure Active Directory.
|
|
36
35
|
*
|
|
37
|
-
* ```
|
|
38
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
36
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
39
37
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
38
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
40
39
|
*
|
|
41
40
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
42
41
|
* const credential = new DefaultAzureCredential();
|
|
43
|
-
*
|
|
44
42
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
45
43
|
* ```
|
|
46
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,0BAA0B;IAIrC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,+BAA+B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,4CAA4C,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n */\n\nimport type {\n AnalyzeConversationJobsInput,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationTaskUnion,\n ConversationAnalysisClientOptionalParams,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse,\n} from \"./models.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 { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { ConversationAnalysisClient as GeneratedClient } from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { conversationAnalysisAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the conversational language understanding\n * features in Azure Cognitive 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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new ConversationAnalysisClient(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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n */\nexport class ConversationAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint - Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options - The parameter options\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options: ConversationAnalysisClientOptionalParams = {},\n ) {\n this._client = new GeneratedClient(endpoint, options);\n\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-conversations\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : conversationAnalysisAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task - A single conversational task to execute.\n * @param options - The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams,\n ): Promise<AnalyzeConversationResponse> {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.analyzeConversation\",\n options || {},\n (updatedOptions) =>\n this._client.analyzeConversation(\n task,\n updatedOptions,\n ) as Promise<AnalyzeConversationResponse>,\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task - The collection of conversations to analyze and one or more tasks to execute.\n * @param options - The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams,\n ): Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n > {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.beginConversationAnalysis\",\n options || {},\n (updatedOptions) =>\n this._client.beginConversationAnalysis(task, updatedOptions) as Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n >,\n );\n }\n}\n"]}
|
|
@@ -14,13 +14,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
14
14
|
*
|
|
15
15
|
* #### API Key
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
18
18
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
19
19
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
20
20
|
*
|
|
21
21
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
22
22
|
* const credential = new AzureKeyCredential("<api key>");
|
|
23
|
-
*
|
|
24
23
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
@@ -29,13 +28,12 @@ import type { PollOperationState, PollerLike } from "@azure/core-lro";
|
|
|
29
28
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
30
29
|
* package for more information about authenticating with Azure Active Directory.
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
33
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
31
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
34
32
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
33
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
35
34
|
*
|
|
36
35
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
37
36
|
* const credential = new DefaultAzureCredential();
|
|
38
|
-
*
|
|
39
37
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
40
38
|
* ```
|
|
41
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.d.ts","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC;;;;;OAKG;gBAED,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,GAAG,aAAa,EAC3C,OAAO,GAAE,wCAA6C;IAiBxD;;;;OAIG;IACH,mBAAmB,CACjB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,iCAAiC,GAC1C,OAAO,CAAC,2BAA2B,CAAC;IAYvC;;;;OAIG;IACG,yBAAyB,CAC7B,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,kCAAkC,GAC3C,OAAO,CACR,UAAU,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,CAAC,CAC3F;CAUF"}
|
|
@@ -19,13 +19,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
19
19
|
*
|
|
20
20
|
* #### API Key
|
|
21
21
|
*
|
|
22
|
-
* ```
|
|
22
|
+
* ```ts snippet:ReadmeSampleCreateClient_Node
|
|
23
23
|
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
24
24
|
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
25
25
|
*
|
|
26
26
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
27
27
|
* const credential = new AzureKeyCredential("<api key>");
|
|
28
|
-
*
|
|
29
28
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
30
29
|
* ```
|
|
31
30
|
*
|
|
@@ -34,13 +33,12 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
34
33
|
* See the [`@azure/identity`](https://npmjs.com/package/\@azure/identity)
|
|
35
34
|
* package for more information about authenticating with Azure Active Directory.
|
|
36
35
|
*
|
|
37
|
-
* ```
|
|
38
|
-
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
36
|
+
* ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory
|
|
39
37
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
38
|
+
* import { ConversationAnalysisClient } from "@azure/ai-language-conversations";
|
|
40
39
|
*
|
|
41
40
|
* const endpoint = "https://<resource name>.cognitiveservices.azure.com";
|
|
42
41
|
* const credential = new DefaultAzureCredential();
|
|
43
|
-
*
|
|
44
42
|
* const client = new ConversationAnalysisClient(endpoint, credential);
|
|
45
43
|
* ```
|
|
46
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,0BAA0B;IAIrC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,+BAA+B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,4CAA4C,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n */\n\nimport type {\n AnalyzeConversationJobsInput,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationTaskUnion,\n ConversationAnalysisClientOptionalParams,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse,\n} from \"./models.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 { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { ConversationAnalysisClient as GeneratedClient } from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { conversationAnalysisAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the conversational language understanding\n * features in Azure Cognitive 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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new ConversationAnalysisClient(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 { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n */\nexport class ConversationAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint - Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options - The parameter options\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options: ConversationAnalysisClientOptionalParams = {},\n ) {\n this._client = new GeneratedClient(endpoint, options);\n\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-conversations\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : conversationAnalysisAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task - A single conversational task to execute.\n * @param options - The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams,\n ): Promise<AnalyzeConversationResponse> {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.analyzeConversation\",\n options || {},\n (updatedOptions) =>\n this._client.analyzeConversation(\n task,\n updatedOptions,\n ) as Promise<AnalyzeConversationResponse>,\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task - The collection of conversations to analyze and one or more tasks to execute.\n * @param options - The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams,\n ): Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n > {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.beginConversationAnalysis\",\n options || {},\n (updatedOptions) =>\n this._client.beginConversationAnalysis(task, updatedOptions) as Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n >,\n );\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "An isomorphic client library for the Azure Conversational Language Understanding service.",
|
|
6
|
-
"version": "1.0.0-alpha.
|
|
6
|
+
"version": "1.0.0-alpha.20250115.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=18.0.0"
|
|
9
9
|
},
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@azure/core-auth": "^1.9.0",
|
|
13
13
|
"@azure/core-client": "^1.9.2",
|
|
14
14
|
"@azure/core-lro": "^2.7.2",
|
|
15
|
-
"@azure/core-rest-pipeline": "^1.18.
|
|
15
|
+
"@azure/core-rest-pipeline": "^1.18.2",
|
|
16
16
|
"@azure/core-tracing": "^1.2.0",
|
|
17
17
|
"tslib": "^2.8.1"
|
|
18
18
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
|
|
35
35
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
36
36
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
37
|
-
"@azure/identity": "^4.0
|
|
38
|
-
"@azure/logger": "^1.
|
|
37
|
+
"@azure/identity": "^4.5.0",
|
|
38
|
+
"@azure/logger": "^1.1.4",
|
|
39
39
|
"@types/node": "^18.0.0",
|
|
40
40
|
"@vitest/browser": "^2.1.8",
|
|
41
41
|
"@vitest/coverage-istanbul": "^2.1.8",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
80
80
|
"unit-test:browser": "echo skipped",
|
|
81
81
|
"unit-test:node": "dev-tool run test:vitest",
|
|
82
|
-
"update-snippets": "
|
|
82
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
83
83
|
},
|
|
84
84
|
"sideEffects": false,
|
|
85
85
|
"//metadata": {
|