from transformers import pipeline

sentiment_model = pipeline(
    "sentiment-analysis",
    model="nlptown/bert-base-multilingual-uncased-sentiment"
)

def analyze_text(text: str):
    sentiment = sentiment_model(text[:512])[0]

    summary = text[:300] + "..."  # replace with LLM later

    return {
        "summary": summary,
        "sentiment": sentiment["label"],
        "sentiment_score": sentiment["score"]
    }
