Python AttributeError: 'TextAnalyticsClient' object has no attribute 'begin_extract_summary'

Ingrid Henkel 111 Reputation points Microsoft Employee
2023-05-04T04:04:37.7366667+00:00

I am attempting to use this script in the Python samples for TextAnalytics.

https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py

azure-ai-textanalytics is installed and the resource is in the East US region. I haven't changed the script except to get the environment variables from an .env file.

When I run it, I get the following error.

AttributeError: 'TextAnalyticsClient' object has no attribute 'begin_extract_summary'

I can run many of the other samples but this one nor the synchronous version runs.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,536 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ingrid Henkel 111 Reputation points Microsoft Employee
    2023-05-05T00:40:09.7266667+00:00

    Extractive summary is available in the 5.3.0b2 version. Use:

    pip install azure-ai-textanalytics==5.3.0b2

    The sample is missing an event loop policy for the asynchronous version so be sure to add the following line above the asyncio.run(main()) line.

        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
    
    
    1 person found this answer helpful.
    0 comments No comments