updated structured output for sentiment

This commit is contained in:
Simon Moisy 2025-03-18 10:59:03 +08:00
parent a1cd2a0b06
commit 7c5602543d

View File

@ -12,9 +12,14 @@ class Category(str, Enum):
TECHNOLOGICAL_DEVELOPMENTS = "Technological Developments" TECHNOLOGICAL_DEVELOPMENTS = "Technological Developments"
WHALE_EXCHANGE_ACTIVITY = "Whale & Exchange Activity" WHALE_EXCHANGE_ACTIVITY = "Whale & Exchange Activity"
class Sentiment(str, Enum):
POSITIVE = "Positive"
NEUTRAL = "Neutral"
NEGATIVE = "Negative"
class ArticleClassification(BaseModel): class ArticleClassification(BaseModel):
category: Category category: Category
sentiment: int sentiment: Sentiment
class ArticleAnalyzer: class ArticleAnalyzer:
def __init__(self): def __init__(self):
@ -28,7 +33,7 @@ class ArticleAnalyzer:
- Technological Developments - Technological Developments
- Whale & Exchange Activity - Whale & Exchange Activity
Also, assign a sentiment (1 for Positive, -1 for Negative, or 0 for Neutral). Also, assign a sentiment (Positive, Neutral or Negative)
""" """
print(f"This JSON model is going to be used for structured ouput classification : {ArticleClassification.model_json_schema()}") print(f"This JSON model is going to be used for structured ouput classification : {ArticleClassification.model_json_schema()}")