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

LLMAccessor.ai_embed(input_col: Union[str, Expression], dimension: int = 1024, *, provider: str = None, model: str = None, config: Dict[str, str] = None, cache_table: Optional[str] = None, cache_key: Optional[str] = None) → DataFrame[source]#

Generate embedding vectors for text.

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

  • dimension – Dimension of the embedding vector (default 1024).

  • provider – Provider name.

  • model – Model name.

  • config – Optional runtime config.

  • cache_table – Pre-registered catalog table identifier for the embedding cache.

  • cache_key – Column name used as cache key.

Returns

  • embedding (ARRAY<FLOAT>): the embedding vector.

Return type

A new DataFrame with a column appended

Example::
>>> df.llm.ai_embed("text", 512, model="qwen-plus")
>>> df.llm.ai_embed(
...     "text", 512, model="qwen-plus",
...     cache_table="default_catalog.default_database.embed_cache",
...     cache_key="text")

previous

pyflink.dataframe.ai.llm.LLMAccessor.ai_mask

next

PyFlink Multimodal

Show Source

Created using Sphinx 4.5.0.