Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataFrame
    • DataFrame
    • DataFrame Creation
    • Input/Output
    • SQL
    • Data Types
    • User Defined Functions
    • Configuration
    • Catalog
    • GPU Support
    • AI / LLM
  • PyFlink Multimodal
  • PyFlink DataStream
  • PyFlink Common

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")

previous

pyflink.dataframe.ai.llm.LLMAccessor.ai_classify

next

pyflink.dataframe.ai.llm.LLMAccessor.ai_extract

Show Source

Created using Sphinx 4.5.0.