This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ConversationAnalysis client.
The language service conversations API is a suite of natural language processing (NLP) skills that can be used to analyze structured conversations (textual or spoken). The synchronous API in this suite accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, Conversational Language Understanding, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.
In some cases, this API needs to forward requests and responses between the caller and an upstream service. The asynchronous APIs in this suite enable tasks like Conversation Summarization and Conversational PII detection.
Key links:
- LTS versions of Node.js
- Latest versions of Safari, Chrome, Edge and Firefox.
See our support policy for more details.
- An Azure subscription.
- An existing [Cognitive Services][cognitive_resource] or Language resource. If you need to create the resource, you can use the Azure Portal or Azure CLI.
If you use the Azure CLI, replace and with your own unique names:
az cognitiveservices account create --kind ConversationalLanguageUnderstanding --resource-group <your-resource-group-name> --name <your-resource-name> --sku <your-sku-name> --location <your-location>Install the Azure ConversationAnalysis client library for JavaScript with npm:
npm install @azure/ai-language-conversationsTo create a client object to access the Language API, you will need the endpoint of your Language resource and a credential. The Conversation Analysis client can use an API key credential to authenticate.
You can find the endpoint for your Language resource either in the Azure Portal or by using the Azure CLI snippet below:
az cognitiveservices account show --name <your-resource-name> --resource-group <your-resource-group-name> --query "properties.endpoint"Use the Azure Portal to browse to your Language resource and retrieve an API key, or use the Azure CLI snippet below:
Note: Sometimes the API key is referred to as a "subscription key" or "subscription API key."
az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name>Once you have an API key and endpoint, you can use the AzureKeyCredential class to authenticate the client as follows:
const { AzureKeyCredential } = require("@azure/core-auth");
const { ConversationAnalysisClient } = require("@azure/ai-language-conversations");
const client = new ConversationAnalysisClient("" , new AzureKeyCredential("" ));To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our bundling documentation.
ConversationAnalysisClient is the primary interface for developers using the Azure ConversationAnalysis client library. Explore the methods on this client object to understand the different features of the Azure ConversationAnalysis service that you can access.
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:
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");For more detailed instructions on how to enable logs, you can look at the @azure/logger package docs.
Please take a look at the samples directory for detailed examples on how to use this library.
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
