pyflink.dataframe.ai.llm.LLMAccessor.ai_sentiment#
- LLMAccessor.ai_sentiment(input_col: Union[str, Expression], *, provider: str = None, model: str = None, config: Dict[str, str] = None) DataFrame[source]#
Analyze the sentiment of input text.
- Parameters
input_col – Column name (str) or Expression for the input text.
provider – Provider name.
model – Model name.
config – Optional runtime config.
- Returns
score(DOUBLE): sentiment score from -1.0 to 1.0.label(STRING): one of “positive”, “negative”, “neutral”.confidence(DOUBLE): confidence score.
- Return type
A new DataFrame with columns appended
- Example::
>>> df.llm.ai_sentiment("review", model="qwen-plus")