azure.ai.language.conversations package¶
-
class
azure.ai.language.conversations.
ConversationAnalysisClient
(endpoint: str, credential: Union[azure.core.credentials.AzureKeyCredential, azure.core.credentials.TokenCredential], **kwargs: Any)[source]¶ 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.
See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ for more information about requests and responses you can pass to this client.
- Parameters
endpoint (str) – Supported Cognitive Services endpoint (e.g., https://
<resource-name>
.cognitiveservices.azure.com). Required.credential (AzureKeyCredential or TokenCredential) – Credential needed for the client to connect to Azure. This can be the an instance of AzureKeyCredential if using a Language API key or a token credential from
azure.identity
.
- Keyword Arguments
api_version (str) – Api Version. Default value is “2022-05-01”. Note that overriding this default value may result in unsupported behavior.
-
analyze_conversation
(task: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Analyzes the input conversation utterance.
See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/analyze-conversation for more information.
- Parameters
task (JSON or IO) – A single conversational task to execute. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# JSON input template you can fill out and use as your body input. task = { "kind": "str", # Required. Enumeration of supported Conversation tasks. Known values are: "Conversation". "analysisInput": { "conversationItem": { "id": "str", # Required. The ID of a conversation item. "participantId": "str", # Required. The participant ID of a conversation item. "modality": "string", # Required, Enumeration of supported conversational modalities. Known values are: "text", and "transcript". "language": "str", # Optional. The override language of a conversation item in BCP 47 language representation. "text": "str", # Required. The text input. } }, "parameters": { "projectName": "str", # Required. The name of the project to use. "deploymentName": "str", # Required. The name of the deployment to use. "stringIndexType": "str", # Optional. Default value is "TextElements_v8". Specifies the method used to interpret string offsets. Set to "UnicodeCodePoint" for Python strings. Known values are: "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit". "verbose": "bool", # Optional. If true, the service will return more detailed information in the response. "isLoggingEnabled": "bool", # Optional. If true, the service will keep the query for further review. "directTarget": "str", # Optional. The name of a target project to forward the request to. "targetProjectParameters": "dict" # Optional. A dictionary representing the parameters for each target project. } } # The response is polymorphic. The following are possible polymorphic responses based off discriminator "kind": # response body for status code(s): 200 response.json() == { "kind": "str", # Required. Enumeration of supported conversational task results. Known values are: "ConversationResult". "result": { "query": "str", # Required. The conversation utterance given by the caller. "detectedLanguage": "str", # Optional. The system detected language for the query in BCP 47 language representation. "prediction": { "topIntent": "str", # Required. The intent with the highest score. "projectKind": "str", # Required. The type of the project. Known values are: "Conversation" and "Orchestration". } } }
-
send_request
(request: azure.core.rest._rest_py3.HttpRequest, **kwargs: Any) → azure.core.rest._rest_py3.HttpResponse[source]¶ Runs the network request through the client’s chained policies.
>>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") <HttpRequest [GET], url: 'https://www.example.org/'> >>> response = client.send_request(request) <HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
- Parameters
request (HttpRequest) – The network request you want to make. Required.
- Keyword Arguments
stream (bool) – Whether the response payload will be streamed. Defaults to False.
- Returns
The response of your network call. Does not do error handling on your response.
- Return type