Async with content moderation and computer vision client python

2JK 241 Reputation points


Is there an asynchronous way to use the Content Moderation and Computer Vision clients? I need something similar to the Text Analytics client, where you can reference the TA client from This predictably throws an exception:

async with cm_client:
     screen = await cm_client.text_moderation.screen_text(text_content_type="text/plain", text_content=io.BytesIO(sentence.encode()), 
                            language="eng", pii=True, classify=True

Same for the CV client. Is there a workaround or is this just not supported in these clients?


Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
332 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,062 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,522 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 47,676 Reputation points


    Text Analytics client is workable. Probably reason for the issue is not installing the client well and not import the class correctly.

    Could you please check:

    1. Install :
    2. import as the code sample:

    If you still suffer from any error, could you please share your error details to us?