ai_extract

AI/LLM を使用してドキュメント列から構造化データを抽出します。

対応する Databricks SQL 関数については、 ai_extract 関数を参照してください。

構文

from pyspark.sql import functions as dbf

dbf.ai_extract(col=<col>, schema=<schema>, options=<options>)

Parameters

パラメーター タイプ 説明
col pyspark.sql.Column または str 抽出するドキュメント コンテンツを含む列。
schema dict または list Python dict ({"type": ..., "description": ...}するフィールド名) またはフィールド名文字列のリスト。 JSON リテラルに自動的にシリアル化されます。
options dict任意 抽出動作を制御するためのオプションのディクショナリ。

返品

pyspark.sql.Column: 抽出されたフィールドを含む VariantType の新しい列。

Examples

df.select(ai_extract("text", {"name": {"type": "string", "description": "Name"}}))
df.select(ai_extract("text", ["name", "age"]))