Megosztás a következőn keresztül:


ConversationAnalysisClient Osztály

A Language Service Conversations API egy természetes nyelvi feldolgozási (NLP) képességeket tartalmazó csomag, amely strukturált beszélgetések (szöveges vagy beszélt) elemzésére használható. További dokumentáció a következő helyen https://docs.microsoft.com/azure/cognitive-services/language-service/overviewtalálható: .

Öröklődés
azure.ai.language.conversations.aio._client.ConversationAnalysisClient
ConversationAnalysisClient

Konstruktor

ConversationAnalysisClient(endpoint: str, credential: AzureKeyCredential | AsyncTokenCredential, **kwargs: Any)

Paraméterek

endpoint
str
Kötelező

Támogatott Cognitive Services-végpont (például https://<resource-name>.cognitiveservices.azure.com). Kötelező.

credential
AzureKeyCredential vagy AsyncTokenCredential
Kötelező

Az ügyfél azure-hoz való csatlakozásához szükséges hitelesítő adatok. Ez lehet az AzureKeyCredential egy példánya, ha language API-kulcsot vagy jogkivonat hitelesítő adatait használja a következőből: identity.

api_version
str

API-verzió. A rendelkezésre álló értékek: "2023-04-01" és "2022-05-01". Az alapértelmezett érték a "2023-04-01". Vegye figyelembe, hogy az alapértelmezett érték felülbírálása nem támogatott viselkedést eredményezhet.

polling_interval
int

Alapértelmezett várakozási idő két lekérdezés között az LRO-műveletekhez, ha nincs Retry-After fejléc.

Metódusok

analyze_conversation

Elemzi a bemeneti beszélgetés kimondott szövegét.

További információ: https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-runtime/analyze-conversation.

begin_conversation_analysis

Elemzési feladat elküldése beszélgetésekhez.

Küldjön be egy beszélgetésgyűjteményt elemzésre. Adjon meg egy vagy több végrehajtandó egyedi feladatot.

További információ: https://learn.microsoft.com/rest/api/language/2023-04-01/analyze-conversation/submit-job.

close
send_request

A hálózati kérést az ügyfél láncolt szabályzatain keresztül futtatja.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

További információ erről a kódfolyamatról: https://aka.ms/azsdk/dpcodegen/python/send_request

analyze_conversation

Elemzi a bemeneti beszélgetés kimondott szövegét.

További információ: https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-runtime/analyze-conversation.

async analyze_conversation(task: MutableMapping[str, Any] | IO, **kwargs: Any) -> MutableMapping[str, Any]

Paraméterek

task
<xref:JSON> vagy IO
Kötelező

Egyetlen végrehajtható beszélgetési feladat. JSON- vagy I/O-típus. Kötelező.

content_type
str

Törzsparaméter tartalomtípusa. Az ismert értékek a következők: "application/json". Az alapértelmezett érték a Nincs.

Válaszok

JSON-objektum

Visszatérési típus

<xref:JSON>

Kivételek

Példák


   # The input is polymorphic. The following are possible polymorphic inputs based off
     discriminator "kind":

   # JSON input template for discriminator value "Conversation":
   analyze_conversation_task = {
       "analysisInput": {
           "conversationItem": {
               "id": "str",  # The ID of a conversation item. Required.
               "participantId": "str",  # The participant ID of a
                 conversation item. Required.
               "language": "str",  # Optional. The override language of a
                 conversation item in BCP 47 language representation.
               "modality": "str",  # Optional. Enumeration of supported
                 conversational modalities. Known values are: "transcript" and "text".
               "role": "str"  # Optional. Role of the participant. Known
                 values are: "agent", "customer", and "generic".
           }
       },
       "kind": "Conversation",
       "parameters": {
           "deploymentName": "str",  # The name of the deployment to use.
             Required.
           "projectName": "str",  # The name of the project to use. Required.
           "directTarget": "str",  # Optional. The name of a target project to
             forward the request to.
           "isLoggingEnabled": bool,  # Optional. If true, the service will keep
             the query for further review.
           "stringIndexType": "TextElements_v8",  # 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".
           "targetProjectParameters": {
               "str": analysis_parameters
           },
           "verbose": bool  # Optional. If true, the service will return more
             detailed information in the response.
       }
   }

   # JSON input template you can fill out and use as your body input.
   task = analyze_conversation_task
   # The response is polymorphic. The following are possible polymorphic responses based
     off discriminator "kind":

   # JSON input template for discriminator value "ConversationResult":
   analyze_conversation_task_result = {
       "kind": "ConversationResult",
       "result": {
           "prediction": base_prediction,
           "query": "str",  # The conversation utterance given by the caller.
             Required.
           "detectedLanguage": "str"  # Optional. The system detected language
             for the query in BCP 47 language representation..
       }
   }

   # JSON input template for discriminator value "Conversation":
   base_prediction = {
       "entities": [
           {
               "category": "str",  # The entity category. Required.
               "confidenceScore": 0.0,  # The entity confidence score.
                 Required.
               "length": 0,  # The length of the text. Required.
               "offset": 0,  # The starting index of this entity in the
                 query. Required.
               "text": "str",  # The predicted entity text. Required.
               "extraInformation": [
                   base_extra_information
               ],
               "resolutions": [
                   base_resolution
               ]
           }
       ],
       "intents": [
           {
               "category": "str",  # A predicted class. Required.
               "confidenceScore": 0.0  # The confidence score of the class
                 from 0.0 to 1.0. Required.
           }
       ],
       "projectKind": "Conversation",
       "topIntent": "str"  # Optional. The intent with the highest score.
   }

   # JSON input template for discriminator value "Orchestration":
   base_prediction = {
       "intents": {
           "str": target_intent_result
       },
       "projectKind": "Orchestration",
       "topIntent": "str"  # Optional. The intent with the highest score.
   }

   # response body for status code(s): 200
   response == analyze_conversation_task_result

begin_conversation_analysis

Elemzési feladat elküldése beszélgetésekhez.

Küldjön be egy beszélgetésgyűjteményt elemzésre. Adjon meg egy vagy több végrehajtandó egyedi feladatot.

További információ: https://learn.microsoft.com/rest/api/language/2023-04-01/analyze-conversation/submit-job.

async begin_conversation_analysis(task: MutableMapping[str, Any] | IO, **kwargs: Any) -> AsyncLROPoller[MutableMapping[str, Any]]

Paraméterek

task
<xref:JSON> vagy IO
Kötelező

Elemezni kívánt beszélgetések gyűjteménye és egy vagy több végrehajtandó feladat. JSON- vagy I/O-típus. Kötelező.

content_type
str

Törzsparaméter tartalomtípusa. Az ismert értékek a következők: "application/json". Az alapértelmezett érték a Nincs.

continuation_token
str

Egy folytatási jogkivonat a poller mentett állapotból való újraindításához.

polling
bool vagy AsyncPollingMethod

Alapértelmezés szerint a lekérdezési módszer az AsyncLROBasePolling lesz. Adja meg a False (Hamis) értéket, ha nem kérdezi le a műveletet, vagy a saját inicializált lekérdezési objektumát adja át egy személyes lekérdezési stratégiához.

polling_interval
int

Alapértelmezett várakozási idő két lekérdezés között az LRO-műveletekhez, ha nincs Retry-After fejléc.

Válaszok

Az AsyncLROPoller egy példánya, amely JSON-objektumot ad vissza

Visszatérési típus

AsyncLROPoller[<xref:JSON>]

Kivételek

Példák


   # JSON input template you can fill out and use as your body input.
   task = {
       "analysisInput": {
           "conversations": [
               conversation
           ]
       },
       "tasks": [
           analyze_conversation_lro_task
       ],
       "displayName": "str"  # Optional. Display name for the analysis job.
   }

   # response body for status code(s): 200
   response == {
       "createdDateTime": "2020-02-20 00:00:00",  # Required.
       "jobId": "str",  # Required.
       "lastUpdatedDateTime": "2020-02-20 00:00:00",  # Required.
       "status": "str",  # The status of the task at the mentioned last update time.
         Required. Known values are: "notStarted", "running", "succeeded", "failed",
         "cancelled", "cancelling", and "partiallyCompleted".
       "tasks": {
           "completed": 0,  # Count of tasks that finished successfully.
             Required.
           "failed": 0,  # Count of tasks that failed. Required.
           "inProgress": 0,  # Count of tasks that are currently in progress.
             Required.
           "total": 0,  # Total count of tasks submitted as part of the job.
             Required.
           "items": [
               analyze_conversation_job_result
           ]
       },
       "displayName": "str",  # Optional.
       "errors": [
           {
               "code": "str",  # One of a server-defined set of error codes.
                 Required. Known values are: "InvalidRequest", "InvalidArgument",
                 "Unauthorized", "Forbidden", "NotFound", "ProjectNotFound",
                 "OperationNotFound", "AzureCognitiveSearchNotFound",
                 "AzureCognitiveSearchIndexNotFound", "TooManyRequests",
                 "AzureCognitiveSearchThrottling",
                 "AzureCognitiveSearchIndexLimitReached", "InternalServerError",
                 "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and
                 "Warning".
               "message": "str",  # A human-readable representation of the
                 error. Required.
               "details": [
                   ...
               ],
               "innererror": {
                   "code": "str",  # One of a server-defined set of
                     error codes. Required. Known values are: "InvalidRequest",
                     "InvalidParameterValue", "KnowledgeBaseNotFound",
                     "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling",
                     "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest",
                     "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect",
                     "InvalidDocumentBatch", "UnsupportedLanguageCode", and
                     "InvalidCountryHint".
                   "message": "str",  # Error message. Required.
                   "details": {
                       "str": "str"  # Optional. Error details.
                   },
                   "innererror": ...,
                   "target": "str"  # Optional. Error target.
               },
               "target": "str"  # Optional. The target of the error.
           }
       ],
       "expirationDateTime": "2020-02-20 00:00:00",  # Optional.
       "nextLink": "str",  # Optional.
       "statistics": {
           "conversationsCount": 0,  # Number of conversations submitted in the
             request. Required.
           "documentsCount": 0,  # Number of documents submitted in the request.
             Required.
           "erroneousConversationsCount": 0,  # Number of invalid documents.
             This includes documents that are empty, over the size limit, or in
             unsupported languages. Required.
           "erroneousDocumentsCount": 0,  # Number of invalid documents. This
             includes empty, over-size limit or non-supported languages documents.
             Required.
           "transactionsCount": 0,  # Number of transactions for the request.
             Required.
           "validConversationsCount": 0,  # Number of conversation documents.
             This excludes documents that are empty, over the size limit, or in
             unsupported languages. Required.
           "validDocumentsCount": 0  # Number of valid documents. This excludes
             empty, over-size limit or non-supported languages documents. Required.
       }
   }

close

async close() -> None

Kivételek

send_request

A hálózati kérést az ügyfél láncolt szabályzatain keresztül futtatja.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

További információ erről a kódfolyamatról: https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]

Paraméterek

request
HttpRequest
Kötelező

A létrehozni kívánt hálózati kérelem. Kötelező.

stream
bool

A válasz hasznos adatainak streamelése. Alapértelmezés szerint Hamis.

Válaszok

A hálózati hívás válasza. Nem végez hibakezelést a válaszon.

Visszatérési típus

Kivételek