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

LLMAccessor.ai_translate(input_col: Union[str, Expression], source_lang: str, target_lang: str, *, provider: str = None, model: str = None, config: Dict[str, str] = None) → DataFrame[source]#

Translate text from one language to another.

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

  • source_lang – Source language code (e.g. "zh", "en", "auto" for auto-detection). Supported: auto, zh, en, ja, ko, fr, de, es, ru, ar, pt.

  • target_lang – Target language code (cannot be "auto").

  • provider – Provider name.

  • model – Model name.

  • config – Optional runtime config.

Returns

  • translated_text (STRING): the translated text.

  • detected_language (STRING): detected source language code.

Return type

A new DataFrame with columns appended

Example::
>>> df.llm.ai_translate("text", "zh", "en", model="qwen-plus")

previous

pyflink.dataframe.ai.llm.LLMAccessor.ai_extract

next

pyflink.dataframe.ai.llm.LLMAccessor.ai_summarize

Show Source

Created using Sphinx 4.5.0.