pyflink.dataframe.ai.llm.LLMAccessor.ai_extract#
- LLMAccessor.ai_extract(input_col: str | Expression, schema: str, *, provider: str = None, model: str = None, config: Dict[str, str] = None) DataFrame[source]#
Extract structured information from text.
- Parameters:
input_col – Column name (str) or Expression for the input text.
schema – JSON schema string describing the fields to extract, e.g.
'{"name":"STRING", "phone":"STRING"}'.provider – Provider name.
model – Model name.
config – Optional runtime config.
- Returns:
extracted_json(STRING): extracted fields as a JSON string.
- Return type:
A new DataFrame with a column appended
Example:
>>> df.llm.ai_extract("text", ... '{"name":"STRING", "phone":"STRING"}', model="qwen-plus")