Vikas Singh

Vikas Singh

  • 213
  • 8.4k
  • 56.7k

ModuleNotFoundError: No module named 'azure.ai.language'

May 15 2024 10:54 AM

Getting error using below code, As I want to access my Azure OpenAI into Google colab with python script.

However, getting error

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-15-f8d490e5f0f6> in <cell line: 2>()
      1 from azure.core.credentials import AzureKeyCredential
----> 2 from azure.ai.language.conversations import ConversationAnalysisClient
      3 
      4 # Azure OpenAI Credentials
      5 key = "99d8153831534d8d9e05630ec6be0f8a"

ModuleNotFoundError: No module named 'azure.ai.language'

from azure.core.credentials import AzureKeyCredential
from azure.ai.language.conversations import ConversationAnalysisClient

# Azure OpenAI Credentials
key = "Azue OpenAI Keys"
endpoint = "Azue OpenAI Endpoint"

# Create a conversation analysis client
credential = AzureKeyCredential(key)
conversation_client = ConversationAnalysisClient(endpoint=endpoint, credential=credential)

# Prompt
prompt = "What is the capital of India?"

# Analyze sentiment
response = conversation_client.analyze_sentiment(prompt)

# Extract sentiment
sentiment = response.sentiment

# Print the sentiment
print("Sentiment:", sentiment)
 


Answers (4)