Operations (sample payloads)

Main operations

Classify Text

Classify some text based on a number of available categories Sample Input

{
    "text": "The new iPhone 14 Pro features a 48MP camera and Dynamic Island.",
    "categories": [
        "Technology",
        "Fashion",
        "Sports",
        "Politics"
    ],
    "examples": [
        \{
            "category": "Technology",
            "text": "The latest MacBook Air comes with the M2 chip for improved performance."
        \},
        \{
            "category": "Fashion",
            "text": "Gucci's new collection showcases bold colors and vintage-inspired designs."
        \},
        \{
            "category": "Sports",
            "text": "The Golden State Warriors won the NBA championship for the fourth time in eight years."
        \},
        \{
            "category": "Politics",
            "text": "The upcoming election will focus on economic policies and healthcare reform."
        \}
    ]
}

Sample Output

{
    "category": "Technology"
}

Sentiment Analysis

Perform sentiment analysis on text data. Sample Input

\{
    "text": "I absolutely love this product! It's amazing and has improved my life significantly. However, the customer service could be better.",
    "language": "en"
\}

Sample Output

{
    "sentiment": "MIXED",
    "score": \{
        "positive": 0.75,
        "negative": 0.15,
        "neutral": 0.05,
        "mixed": 0.05
    \}
}

Was this page helpful?