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_classify#

LLMAccessor.ai_classify(input_col: Union[str, Expression], labels: List[str], *, provider: str = None, model: str = None, config: Dict[str, str] = None) → DataFrame[source]#

Classify text into one of the provided labels.

Parameters
  • input_col – Column name (str) or Expression for the input text.

  • labels – List of label strings.

  • provider – Provider name.

  • model – Model name.

  • config – Optional runtime config.

Returns

  • category (STRING): the predicted label.

  • confidence (DOUBLE): confidence score.

Return type

A new DataFrame with columns appended

Example::
>>> df.llm.ai_classify("text", ["positive", "negative"],
...                    model="qwen-plus")

previous

pyflink.dataframe.ai.llm.LLMAccessor.predict

next

pyflink.dataframe.ai.llm.LLMAccessor.ai_sentiment

Show Source

Created using Sphinx 4.5.0.