Skip to content

Sentiment Analysis Task

openaivec.task.nlp.sentiment_analysis

Sentiment analysis task definition.

Classes

SentimentAnalysis

Bases: BaseModel

Sentiment analysis output.

Functions

sentiment_analysis

sentiment_analysis() -> PreparedTask[SentimentAnalysis]

Create a sentiment analysis task.

Source code in src/openaivec/task/nlp/sentiment_analysis.py
def sentiment_analysis() -> PreparedTask[SentimentAnalysis]:
    """Create a sentiment analysis task."""
    return PreparedTask(
        instructions=_build_instructions(),
        response_format=SentimentAnalysis,
    )