How to run ConversationAnalysisClient.analyze_conversation method (Python API)

Timorius 0 Reputation points
2023-04-21T12:13:58.9733333+00:00

Hello, I am looking to run the example code for the conversation analysis within the ConversationAnalysisClient given in the documentation for "Cognitive Services - Conversational Language Understanding" (Link: https://learn.microsoft.com/en-us/python/api/overview/azure/ai-language-conversations-readme?view=azure-python, Abstract "Analyze Text with a Conversation App"). To run this code example it is shown that a project name and deployment name are necessary, however I am unable to find the appropriate service for a deployment / project in the Azure portal. So far I created a Ressource Group and Language Service. With the Service I have an endpoint and keys to create the ConversationAnalysisClient and can use the method begin_conversation_anaysis, but the method analyze_conversation additionally requires the named parameters. In the documentation are some explanations about training a model, however I'd like to test the existing base model. For further information, I have a Azure for Students subscription (free tier). The code snippet:

query = "Send an email to Carol about the tomorrow's demo"
result = client.analyze_conversation(
    task={
        "kind": "Conversation",
        "analysisInput": {
            "conversationItem": {
                "participantId": "1",
                "id": "1",
                "modality": "text",
                "language": "en",
                "text": query
            },
            "isLoggingEnabled": False
        },
        "parameters": {
            "projectName": project_name,
            "deploymentName": deployment_name,
            "verbose": True
        }
    })

I'm thankful for anything that can point me in the right direction with this problem.

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,010 questions
Azure AI Language
Azure AI Language
An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
364 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,450 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 46,996 Reputation points
    2023-04-22T09:14:08.9633333+00:00

    Hello @Timorius

    Thanks for reaching out to us, I can understand you want to test the base model with Python without training a model. However, a project created is a must. You can quick create some models in Azure Language Studio to test but in Python SDK the project name is needed, which means you must have a project created first. I am sorry for the inconvenience.

    I would recommend you create a quick sample in Language Studio as below screenshot, you just need some typical samples then you will have some ideas about how it works. You can either test it directly in the Language Studio(I personally think it is faster, the UI is very straightforward) or call it by Python SDK. User's image

    Document for how to create a project - https://learn.microsoft.com/en-us/azure/cognitive-services/language-service/conversational-language-understanding/how-to/create-project?tabs=rest-api%2CLanguage-Studio

    If you have any questions for how to create a project and test it in the Language Studio, please let me know. For the price you mentioned, you are free account, and you will get 5000 text records free per month. User's image

    I hope this helps, we would forward this feedback to content team to provide more quick testing ways. Regards, Yutong

    -Please kindly accept the answer if you feel helpful to support community, thanks a lot.

    0 comments No comments