Lab Information
The datacenter AI Engineering team is developing tools to interpret the tone of developer communications. You are tasked to build a Python-based AI Sentiment Analyzer that identifies whether a given message or feedback is Positive, Negative, or Neutral, helping teams gauge emotional context quickly.
Create a Python program named under /root/openaiproject/sentiment_analyzer.py that analyzes the sentiment (Positive, Negative, or Neutral) of a given text using the OpenAI API.
Initialize the OpenAI client with the provided api_key and base_url.
Define a function named analyze_sentiment(text: str) -> str that: Constructs a parameterized prompt asking the AI to analyze the sentiment of the given text and respond with Sentiment and Reason.…